From 4eb17f623e0a105e2df8a2e5ed92ead2d3d0f09e Mon Sep 17 00:00:00 2001 From: "Henrik G. Olsson" Date: Wed, 8 Oct 2025 15:38:58 -0700 Subject: [PATCH 1/5] Revert "Merge pull request #84775 from slavapestov/disable-failing-tests-harder" This reverts commit 65419656ae5a90c10043709a89e4edfa25704ce7, reversing changes made to 537353074df5458b5150ab898eb6756063b7243a. --- test/Interop/Cxx/class/access/swiftify-private-fileid.swift | 2 +- test/Interop/Cxx/stdlib/std-span-transformed-execution.swift | 2 +- test/Interop/Cxx/stdlib/use-std-span-typechecker.swift | 2 +- test/Interop/Cxx/stdlib/use-std-span.swift | 2 +- .../Interop/Cxx/swiftify-import/import-as-instance-method.swift | 2 +- test/Interop/Cxx/swiftify-import/span-in-ctor.swift | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/Interop/Cxx/class/access/swiftify-private-fileid.swift b/test/Interop/Cxx/class/access/swiftify-private-fileid.swift index 948f935554d1f..bd4e1de106c8d 100644 --- a/test/Interop/Cxx/class/access/swiftify-private-fileid.swift +++ b/test/Interop/Cxx/class/access/swiftify-private-fileid.swift @@ -1,4 +1,4 @@ -// REQUIRES: rdar162106643 +// REQUIRES: rdar://162106643 // RUN: rm -rf %t // RUN: split-file %s %t diff --git a/test/Interop/Cxx/stdlib/std-span-transformed-execution.swift b/test/Interop/Cxx/stdlib/std-span-transformed-execution.swift index 1b22a53f8e671..d1ea3dd629990 100644 --- a/test/Interop/Cxx/stdlib/std-span-transformed-execution.swift +++ b/test/Interop/Cxx/stdlib/std-span-transformed-execution.swift @@ -1,4 +1,4 @@ -// REQUIRES: rdar162106653 +// REQUIRES: rdar://162106653 // RUN: %target-run-simple-swift(-plugin-path %swift-plugin-dir -I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -swift-version 6 -Xfrontend -disable-availability-checking -Xcc -std=c++20 -enable-experimental-feature LifetimeDependence -enable-experimental-feature SafeInteropWrappers) diff --git a/test/Interop/Cxx/stdlib/use-std-span-typechecker.swift b/test/Interop/Cxx/stdlib/use-std-span-typechecker.swift index ba5d494ad0955..8bc6a28c70a5d 100644 --- a/test/Interop/Cxx/stdlib/use-std-span-typechecker.swift +++ b/test/Interop/Cxx/stdlib/use-std-span-typechecker.swift @@ -1,4 +1,4 @@ -// REQUIRES: rdar162106722 +// REQUIRES: rdar://162106722 // RUN: %target-typecheck-verify-swift -I %S/Inputs -enable-experimental-cxx-interop -Xcc -std=c++20 2>&1 diff --git a/test/Interop/Cxx/stdlib/use-std-span.swift b/test/Interop/Cxx/stdlib/use-std-span.swift index 37a817c027cfa..2dd6fe9273c9a 100644 --- a/test/Interop/Cxx/stdlib/use-std-span.swift +++ b/test/Interop/Cxx/stdlib/use-std-span.swift @@ -1,4 +1,4 @@ -// REQUIRES: rdar162106580 +// REQUIRES: rdar://162106580 // RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -Xcc -std=c++20) // RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -Xcc -std=c++20 -Xcc -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG) diff --git a/test/Interop/Cxx/swiftify-import/import-as-instance-method.swift b/test/Interop/Cxx/swiftify-import/import-as-instance-method.swift index c2e9d579bab79..1f19956e56f02 100644 --- a/test/Interop/Cxx/swiftify-import/import-as-instance-method.swift +++ b/test/Interop/Cxx/swiftify-import/import-as-instance-method.swift @@ -1,4 +1,4 @@ -// REQUIRES: rdar162106619 +// REQUIRES: rdar://162106619 // REQUIRES: swift_feature_SafeInteropWrappers diff --git a/test/Interop/Cxx/swiftify-import/span-in-ctor.swift b/test/Interop/Cxx/swiftify-import/span-in-ctor.swift index e09bcdd2a276f..cd29b618c3376 100644 --- a/test/Interop/Cxx/swiftify-import/span-in-ctor.swift +++ b/test/Interop/Cxx/swiftify-import/span-in-ctor.swift @@ -1,4 +1,4 @@ -// REQUIRES: rdar162106747 +// REQUIRES: rdar://162106747 // REQUIRES: swift_feature_SafeInteropWrappers From e61630ea35c0d596643f72bff2a86d623e72cd9f Mon Sep 17 00:00:00 2001 From: "Henrik G. Olsson" Date: Wed, 8 Oct 2025 15:13:12 -0700 Subject: [PATCH 2/5] Revert "Merge pull request #84769 from Azoy/disable-some-tests" This reverts commit fe525539e531736997b1c7a727029d828c5661b4, reversing changes made to 5e325632ed7659c9fec68c37793eb5bda026af35. --- test/Interop/Cxx/class/access/swiftify-private-fileid.swift | 2 -- test/Interop/Cxx/stdlib/std-span-transformed-execution.swift | 2 -- test/Interop/Cxx/stdlib/use-std-span-typechecker.swift | 2 -- test/Interop/Cxx/stdlib/use-std-span.swift | 2 -- .../Interop/Cxx/swiftify-import/import-as-instance-method.swift | 2 -- test/Interop/Cxx/swiftify-import/span-in-ctor.swift | 2 -- 6 files changed, 12 deletions(-) diff --git a/test/Interop/Cxx/class/access/swiftify-private-fileid.swift b/test/Interop/Cxx/class/access/swiftify-private-fileid.swift index bd4e1de106c8d..cd12684535fd3 100644 --- a/test/Interop/Cxx/class/access/swiftify-private-fileid.swift +++ b/test/Interop/Cxx/class/access/swiftify-private-fileid.swift @@ -1,5 +1,3 @@ -// REQUIRES: rdar://162106643 - // RUN: rm -rf %t // RUN: split-file %s %t diff --git a/test/Interop/Cxx/stdlib/std-span-transformed-execution.swift b/test/Interop/Cxx/stdlib/std-span-transformed-execution.swift index d1ea3dd629990..aac46b5afa75b 100644 --- a/test/Interop/Cxx/stdlib/std-span-transformed-execution.swift +++ b/test/Interop/Cxx/stdlib/std-span-transformed-execution.swift @@ -1,5 +1,3 @@ -// REQUIRES: rdar://162106653 - // RUN: %target-run-simple-swift(-plugin-path %swift-plugin-dir -I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -swift-version 6 -Xfrontend -disable-availability-checking -Xcc -std=c++20 -enable-experimental-feature LifetimeDependence -enable-experimental-feature SafeInteropWrappers) // TODO: test failed in Windows PR testing: rdar://144384453 diff --git a/test/Interop/Cxx/stdlib/use-std-span-typechecker.swift b/test/Interop/Cxx/stdlib/use-std-span-typechecker.swift index 8bc6a28c70a5d..98ad28fac487e 100644 --- a/test/Interop/Cxx/stdlib/use-std-span-typechecker.swift +++ b/test/Interop/Cxx/stdlib/use-std-span-typechecker.swift @@ -1,5 +1,3 @@ -// REQUIRES: rdar://162106722 - // RUN: %target-typecheck-verify-swift -I %S/Inputs -enable-experimental-cxx-interop -Xcc -std=c++20 2>&1 import StdSpan diff --git a/test/Interop/Cxx/stdlib/use-std-span.swift b/test/Interop/Cxx/stdlib/use-std-span.swift index 2dd6fe9273c9a..478be72399651 100644 --- a/test/Interop/Cxx/stdlib/use-std-span.swift +++ b/test/Interop/Cxx/stdlib/use-std-span.swift @@ -1,5 +1,3 @@ -// REQUIRES: rdar://162106580 - // RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -Xcc -std=c++20) // RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -Xcc -std=c++20 -Xcc -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG) diff --git a/test/Interop/Cxx/swiftify-import/import-as-instance-method.swift b/test/Interop/Cxx/swiftify-import/import-as-instance-method.swift index 1f19956e56f02..b9406f0d3e0d8 100644 --- a/test/Interop/Cxx/swiftify-import/import-as-instance-method.swift +++ b/test/Interop/Cxx/swiftify-import/import-as-instance-method.swift @@ -1,5 +1,3 @@ -// REQUIRES: rdar://162106619 - // REQUIRES: swift_feature_SafeInteropWrappers // RUN: %empty-directory(%t) diff --git a/test/Interop/Cxx/swiftify-import/span-in-ctor.swift b/test/Interop/Cxx/swiftify-import/span-in-ctor.swift index cd29b618c3376..d138152bb06b1 100644 --- a/test/Interop/Cxx/swiftify-import/span-in-ctor.swift +++ b/test/Interop/Cxx/swiftify-import/span-in-ctor.swift @@ -1,5 +1,3 @@ -// REQUIRES: rdar://162106747 - // REQUIRES: swift_feature_SafeInteropWrappers // RUN: rm -rf %t From 91128e2002a268d3348a8ce5cc3945a4cb5c669f Mon Sep 17 00:00:00 2001 From: "Henrik G. Olsson" Date: Wed, 8 Oct 2025 15:21:08 -0700 Subject: [PATCH 3/5] add missing cstddef import --- test/Interop/CxxToSwiftToCxx/span/span-execution.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/Interop/CxxToSwiftToCxx/span/span-execution.cpp b/test/Interop/CxxToSwiftToCxx/span/span-execution.cpp index 839e89ba38eb6..ac951b42b428e 100644 --- a/test/Interop/CxxToSwiftToCxx/span/span-execution.cpp +++ b/test/Interop/CxxToSwiftToCxx/span/span-execution.cpp @@ -11,9 +11,8 @@ // REQUIRES: executable_test -// REQUIRES: OS=macosx || rdar-161999258 - //--- header.h +#include #include #include From ed8b70c2ec0fe5811b5b649c18254195cda5fc18 Mon Sep 17 00:00:00 2001 From: "Henrik G. Olsson" Date: Thu, 9 Oct 2025 21:59:30 -0700 Subject: [PATCH 4/5] cstddef -> cstdint --- test/Interop/CxxToSwiftToCxx/span/span-execution.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Interop/CxxToSwiftToCxx/span/span-execution.cpp b/test/Interop/CxxToSwiftToCxx/span/span-execution.cpp index ac951b42b428e..5d8d94c235941 100644 --- a/test/Interop/CxxToSwiftToCxx/span/span-execution.cpp +++ b/test/Interop/CxxToSwiftToCxx/span/span-execution.cpp @@ -12,7 +12,7 @@ // REQUIRES: executable_test //--- header.h -#include +#include #include #include From edf402db0ac6da9b6480b576958ad3ef3f0b1d2d Mon Sep 17 00:00:00 2001 From: "Henrik G. Olsson" Date: Thu, 9 Oct 2025 21:47:36 -0700 Subject: [PATCH 5/5] [cxx-interop] Add llvm-lit feature 'std_span' This adds a check in CMake for whether the current C++ stdlib contains the 'span' header. If so, the llvm-lit feature 'std_span' is set. Also adds 'REQUIRES: std_span' to interop tests that include 'span'. This means we no longer have to choose between blanket disabling `std::span` tests on all Linux distributions, or listing every Linux distro with a libstdc++ version without `std::span` support as unsupported. rdar://161999160 rdar://161999174 rdar://162106580 rdar://162106619 rdar://162106643 rdar://162106653 rdar://162106722 rdar://162106747 --- test/CMakeLists.txt | 3 +++ test/Interop/Cxx/class/access/swiftify-private-fileid.swift | 1 + test/Interop/Cxx/class/safe-interop-mode.swift | 1 + test/Interop/Cxx/stdlib/std-span-interface.swift | 2 +- test/Interop/Cxx/stdlib/std-span-transformed-execution.swift | 1 + test/Interop/Cxx/stdlib/use-std-span-typechecker.swift | 1 + test/Interop/Cxx/stdlib/use-std-span.swift | 1 + .../Cxx/swiftify-import/import-as-instance-method.swift | 1 + test/Interop/Cxx/swiftify-import/span-in-ctor.swift | 1 + test/Interop/CxxToSwiftToCxx/span/span-execution.cpp | 1 + test/Macros/SwiftifyImport/CxxSpan/LifetimeboundSpan.swift | 3 +-- test/Macros/SwiftifyImport/CxxSpan/NoEscapeSpan.swift | 3 +-- .../InterfaceGen/gen_clang_cxx_module_with_cxx20.swift | 3 +-- test/lit.site.cfg.in | 3 +++ 14 files changed, 18 insertions(+), 7 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 98fdb1942b5fe..acdba36e7d48f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -370,6 +370,9 @@ if(NOT "${COVERAGE_DB}" STREQUAL "") COMMENT "Touching covering tests") endif() +include(CheckIncludeFileCXX) +check_include_file_cxx("span" HAVE_STD_SPAN) + foreach(SDK ${SWIFT_SDKS}) foreach(ARCH ${SWIFT_SDK_${SDK}_ARCHITECTURES}) # macCatalyst needs to run two sets of tests: one with the normal macosx target triple diff --git a/test/Interop/Cxx/class/access/swiftify-private-fileid.swift b/test/Interop/Cxx/class/access/swiftify-private-fileid.swift index cd12684535fd3..8944779e6fc96 100644 --- a/test/Interop/Cxx/class/access/swiftify-private-fileid.swift +++ b/test/Interop/Cxx/class/access/swiftify-private-fileid.swift @@ -4,6 +4,7 @@ // RUN: %target-swift-frontend -emit-ir -I %swift_src_root/lib/ClangImporter/SwiftBridging -plugin-path %swift-plugin-dir %t/blessed.swift -module-name main -I %t/Inputs -o %t/out -Xcc -std=c++20 -cxx-interoperability-mode=default -enable-experimental-feature SafeInteropWrappers -verify // REQUIRES: swift_feature_SafeInteropWrappers +// REQUIRES: std_span //--- Inputs/swiftify-non-public.h #pragma once diff --git a/test/Interop/Cxx/class/safe-interop-mode.swift b/test/Interop/Cxx/class/safe-interop-mode.swift index 2b9187a7a263e..e6ee9c161c8a4 100644 --- a/test/Interop/Cxx/class/safe-interop-mode.swift +++ b/test/Interop/Cxx/class/safe-interop-mode.swift @@ -5,6 +5,7 @@ // REQUIRES: objc_interop // REQUIRES: swift_feature_LifetimeDependence +// REQUIRES: std_span //--- Inputs/module.modulemap module Test { diff --git a/test/Interop/Cxx/stdlib/std-span-interface.swift b/test/Interop/Cxx/stdlib/std-span-interface.swift index c2f4b2de098c6..2a5691421a19b 100644 --- a/test/Interop/Cxx/stdlib/std-span-interface.swift +++ b/test/Interop/Cxx/stdlib/std-span-interface.swift @@ -7,7 +7,7 @@ // REQUIRES: swift_feature_SafeInteropWrappers // REQUIRES: swift_feature_Lifetimes -// REQUIRES: rdar161999174 +// REQUIRES: std_span #if !BRIDGING_HEADER import StdSpan diff --git a/test/Interop/Cxx/stdlib/std-span-transformed-execution.swift b/test/Interop/Cxx/stdlib/std-span-transformed-execution.swift index aac46b5afa75b..7c04a7293e671 100644 --- a/test/Interop/Cxx/stdlib/std-span-transformed-execution.swift +++ b/test/Interop/Cxx/stdlib/std-span-transformed-execution.swift @@ -7,6 +7,7 @@ // REQUIRES: swift_feature_LifetimeDependence // REQUIRES: executable_test +// REQUIRES: std_span #if !BRIDGING_HEADER import StdSpan diff --git a/test/Interop/Cxx/stdlib/use-std-span-typechecker.swift b/test/Interop/Cxx/stdlib/use-std-span-typechecker.swift index 98ad28fac487e..0a77811ba0905 100644 --- a/test/Interop/Cxx/stdlib/use-std-span-typechecker.swift +++ b/test/Interop/Cxx/stdlib/use-std-span-typechecker.swift @@ -1,4 +1,5 @@ // RUN: %target-typecheck-verify-swift -I %S/Inputs -enable-experimental-cxx-interop -Xcc -std=c++20 2>&1 +// REQUIRES: std_span import StdSpan diff --git a/test/Interop/Cxx/stdlib/use-std-span.swift b/test/Interop/Cxx/stdlib/use-std-span.swift index 478be72399651..d9302da7d43b1 100644 --- a/test/Interop/Cxx/stdlib/use-std-span.swift +++ b/test/Interop/Cxx/stdlib/use-std-span.swift @@ -5,6 +5,7 @@ // UNSUPPORTED: OS=windows-msvc // REQUIRES: executable_test +// REQUIRES: std_span import StdlibUnittest #if !BRIDGING_HEADER diff --git a/test/Interop/Cxx/swiftify-import/import-as-instance-method.swift b/test/Interop/Cxx/swiftify-import/import-as-instance-method.swift index b9406f0d3e0d8..c1779a087ce18 100644 --- a/test/Interop/Cxx/swiftify-import/import-as-instance-method.swift +++ b/test/Interop/Cxx/swiftify-import/import-as-instance-method.swift @@ -1,4 +1,5 @@ // REQUIRES: swift_feature_SafeInteropWrappers +// REQUIRES: std_span // RUN: %empty-directory(%t) // RUN: split-file %s %t diff --git a/test/Interop/Cxx/swiftify-import/span-in-ctor.swift b/test/Interop/Cxx/swiftify-import/span-in-ctor.swift index d138152bb06b1..348258acdfd0f 100644 --- a/test/Interop/Cxx/swiftify-import/span-in-ctor.swift +++ b/test/Interop/Cxx/swiftify-import/span-in-ctor.swift @@ -1,4 +1,5 @@ // REQUIRES: swift_feature_SafeInteropWrappers +// REQUIRES: std_span // RUN: rm -rf %t // RUN: split-file %s %t diff --git a/test/Interop/CxxToSwiftToCxx/span/span-execution.cpp b/test/Interop/CxxToSwiftToCxx/span/span-execution.cpp index 5d8d94c235941..192b386fb3619 100644 --- a/test/Interop/CxxToSwiftToCxx/span/span-execution.cpp +++ b/test/Interop/CxxToSwiftToCxx/span/span-execution.cpp @@ -10,6 +10,7 @@ // RUN: %target-run %t/swift-cxx-execution | %FileCheck %s // REQUIRES: executable_test +// REQUIRES: std_span //--- header.h #include diff --git a/test/Macros/SwiftifyImport/CxxSpan/LifetimeboundSpan.swift b/test/Macros/SwiftifyImport/CxxSpan/LifetimeboundSpan.swift index 37c4761fa39f1..9b091d101f6cd 100644 --- a/test/Macros/SwiftifyImport/CxxSpan/LifetimeboundSpan.swift +++ b/test/Macros/SwiftifyImport/CxxSpan/LifetimeboundSpan.swift @@ -3,8 +3,7 @@ // RUN: %target-swift-frontend %s -enable-experimental-cxx-interop -I %S/Inputs -Xcc -std=c++20 -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -dump-macro-expansions -verify -strict-memory-safety 2>&1 | %FileCheck --match-full-lines %s -// FIXME swift-ci linux tests do not support std::span -// UNSUPPORTED: OS=linux-gnu +// REQUIRES: std_span import CxxStdlib import StdSpan diff --git a/test/Macros/SwiftifyImport/CxxSpan/NoEscapeSpan.swift b/test/Macros/SwiftifyImport/CxxSpan/NoEscapeSpan.swift index bd9e9451217be..246a61a1eaafa 100644 --- a/test/Macros/SwiftifyImport/CxxSpan/NoEscapeSpan.swift +++ b/test/Macros/SwiftifyImport/CxxSpan/NoEscapeSpan.swift @@ -3,8 +3,7 @@ // RUN: %target-swift-frontend %s -cxx-interoperability-mode=default -I %S/Inputs -Xcc -std=c++20 -swift-version 5 -module-name main -disable-availability-checking -typecheck -enable-experimental-feature Lifetimes -plugin-path %swift-plugin-dir -strict-memory-safety -warnings-as-errors -dump-macro-expansions 2>&1 | %FileCheck --match-full-lines %s -// FIXME swift-ci linux tests do not support std::span -// UNSUPPORTED: OS=linux-gnu +// REQUIRES: std_span import CxxStdlib import StdSpan diff --git a/test/SourceKit/InterfaceGen/gen_clang_cxx_module_with_cxx20.swift b/test/SourceKit/InterfaceGen/gen_clang_cxx_module_with_cxx20.swift index dc0758966dfc0..443f9bda02f5c 100644 --- a/test/SourceKit/InterfaceGen/gen_clang_cxx_module_with_cxx20.swift +++ b/test/SourceKit/InterfaceGen/gen_clang_cxx_module_with_cxx20.swift @@ -4,7 +4,6 @@ // Now make sure we emit the correct interface for std::span if C++20 is enabled. // RUN: %sourcekitd-test -req=interface-gen -module UsesCXX20 -- -cxx-interoperability-mode=default -Xfrontend -disable-implicit-concurrency-module-import -Xfrontend -disable-implicit-string-processing-module-import -I %S/Inputs -target %target-triple -sdk %sdk -Xcc -std=c++20 | %FileCheck %s -// FIXME: older libstdc++ version on Swift CI does not support C++20 -// UNSUPPORTED: OS=linux-gnu +// REQUIRES: std_span // CHECK: public typealias MySpanOfInt = std.span< diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index 4da78ee4d43ec..d1ea2880b3551 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -182,3 +182,6 @@ if config.test_exec_root is None: lit_config.load_config(config, os.path.join(config.test_exec_root, "lit.swift-features.cfg")) lit_config.load_config( config, os.path.join(config.swift_src_root, "test", "lit.cfg")) + +if '@HAVE_STD_SPAN@' == '1': + config.available_features.add('std_span')