Skip to content

Commit 0aa8722

Browse files
committed
enable SwiftifyImports/CxxSpan tests (NFC)
These tests require the 'std_span' feature, but that feature was previously only added in the test/Interop test suite. As a result these tests would never run.
1 parent b1c2bc1 commit 0aa8722

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
def get_target_os():
2+
import re
3+
(run_cpu, run_vendor, run_os, run_version) = re.match('([^-]+)-([^-]+)-([^0-9]+)(.*)', config.variant_triple).groups()
4+
return run_os
5+
6+
if config.target_sdk_libcxx_path != '':
7+
if os.path.exists(os.path.join(config.target_sdk_libcxx_path, "span")):
8+
config.available_features.add('std_span')
9+
elif get_target_os() in ['linux-gnu']:
10+
for p in ['/usr/include/c++/', '/usr/local/include/c++/']:
11+
if not os.path.isdir(p):
12+
continue
13+
for subdir in os.listdir(p):
14+
if not subdir.isdigit():
15+
# skip paths libc++ paths like /usr/include/c++/v1, we want libstdc++ paths only (like /usr/include/c++/13)
16+
continue
17+
if os.path.exists(os.path.join(p, subdir, "span")):
18+
config.available_features.add('std_span')
19+
elif get_target_os() in ['windows-msvc']:
20+
# We don't test on any versions of MSVC without std::span support.
21+
# FIXME: figure out where to do lookup for C++ stdlib headers on Windows - we'll probably need it eventually
22+
config.available_features.add('std_span')
23+

0 commit comments

Comments
 (0)