Skip to content

Commit 3266b5f

Browse files
authored
Merge pull request #84774 from hnrklssn/fix-std-span-linux
Fix std::span tests on linux
2 parents 08d88bc + 484cf68 commit 3266b5f

File tree

13 files changed

+34
-21
lines changed

13 files changed

+34
-21
lines changed

test/Interop/Cxx/class/access/swiftify-private-fileid.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
// REQUIRES: rdar162106643
2-
31
// RUN: rm -rf %t
42
// RUN: split-file %s %t
53

64
// 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
75

86
// REQUIRES: swift_feature_SafeInteropWrappers
7+
// REQUIRES: std_span
98

109
//--- Inputs/swiftify-non-public.h
1110
#pragma once

test/Interop/Cxx/class/safe-interop-mode.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
// REQUIRES: objc_interop
77
// REQUIRES: swift_feature_LifetimeDependence
8+
// REQUIRES: std_span
89

910
//--- Inputs/module.modulemap
1011
module Test {

test/Interop/Cxx/stdlib/std-span-interface.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
// REQUIRES: swift_feature_SafeInteropWrappers
99
// REQUIRES: swift_feature_Lifetimes
10-
// REQUIRES: rdar161999174
10+
// REQUIRES: std_span
1111

1212
#if !BRIDGING_HEADER
1313
import StdSpan

test/Interop/Cxx/stdlib/std-span-transformed-execution.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// REQUIRES: rdar162106653
2-
31
// 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)
42

53
// TODO: test failed in Windows PR testing: rdar://144384453
@@ -9,6 +7,7 @@
97
// REQUIRES: swift_feature_LifetimeDependence
108

119
// REQUIRES: executable_test
10+
// REQUIRES: std_span
1211

1312
#if !BRIDGING_HEADER
1413
import StdSpan

test/Interop/Cxx/stdlib/use-std-span-typechecker.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// REQUIRES: rdar162106722
2-
31
// RUN: %target-typecheck-verify-swift -I %S/Inputs -enable-experimental-cxx-interop -Xcc -std=c++20 2>&1
2+
// REQUIRES: std_span
43

54
import StdSpan
65

test/Interop/Cxx/stdlib/use-std-span.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
// REQUIRES: rdar162106580
2-
31
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -Xcc -std=c++20)
42
// 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)
53

64
// TODO: test failed in Windows PR testing: rdar://144384453
75
// UNSUPPORTED: OS=windows-msvc
86

7+
// TODO: test failed in macOS PR testing but passes locally: rdar://163049442
8+
// UNSUPPORTED: OS=macosx
9+
910
// REQUIRES: executable_test
11+
// REQUIRES: std_span
1012

1113
import StdlibUnittest
1214
#if !BRIDGING_HEADER

test/Interop/Cxx/swiftify-import/import-as-instance-method.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// REQUIRES: rdar162106619
2-
31
// REQUIRES: swift_feature_SafeInteropWrappers
2+
// REQUIRES: std_span
43

54
// RUN: %empty-directory(%t)
65
// RUN: split-file %s %t

test/Interop/Cxx/swiftify-import/span-in-ctor.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// REQUIRES: rdar162106747
2-
31
// REQUIRES: swift_feature_SafeInteropWrappers
2+
// REQUIRES: std_span
43

54
// RUN: rm -rf %t
65
// RUN: split-file %s %t

test/Interop/CxxToSwiftToCxx/span/span-execution.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
// RUN: %target-run %t/swift-cxx-execution | %FileCheck %s
1111

1212
// REQUIRES: executable_test
13-
14-
// REQUIRES: OS=macosx || rdar-161999258
13+
// REQUIRES: std_span
1514

1615
//--- header.h
16+
#include <cstdint>
1717
#include <string>
1818
#include <span>
1919

test/Interop/lit.local.cfg

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,24 @@ if get_target_os() in ['linux-gnu']:
4848
if os.path.exists('/usr/include/c++/v1') or os.path.exists('/usr/local/include/c++/v1'):
4949
config.available_features.add('system_wide_libcxx')
5050

51+
if config.target_sdk_libcxx_path != '':
52+
if os.path.exists(os.path.join(config.target_sdk_libcxx_path, "span")):
53+
config.available_features.add('std_span')
54+
elif get_target_os() in ['linux-gnu']:
55+
for p in ['/usr/include/c++/', '/usr/local/include/c++/']:
56+
if not os.path.isdir(p):
57+
continue
58+
for subdir in os.listdir(p):
59+
if not subdir.isdigit():
60+
# skip paths libc++ paths like /usr/include/c++/v1, we want libstdc++ paths only (like /usr/include/c++/13)
61+
continue
62+
if os.path.exists(os.path.join(p, subdir, "span")):
63+
config.available_features.add('std_span')
64+
elif get_target_os() in ['windows-msvc']:
65+
# We don't test on any versions of MSVC without std::span support.
66+
# FIXME: figure out where to do lookup for C++ stdlib headers on Windows - we'll probably need it eventually
67+
config.available_features.add('std_span')
68+
5169
# Enable C++ interop when compiling Swift sources.
5270
config.substitutions.insert(0, ('%target-interop-build-swift',
5371
'%target-build-swift -cxx-interoperability-mode=default '))

0 commit comments

Comments
 (0)