From 0aa8722aa9e13e29d4a98770bb67c42c8280286c Mon Sep 17 00:00:00 2001 From: "Henrik G. Olsson" Date: Tue, 4 Nov 2025 20:28:55 -0800 Subject: [PATCH] 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. --- .../SwiftifyImport/CxxSpan/lit.local.cfg | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/Macros/SwiftifyImport/CxxSpan/lit.local.cfg diff --git a/test/Macros/SwiftifyImport/CxxSpan/lit.local.cfg b/test/Macros/SwiftifyImport/CxxSpan/lit.local.cfg new file mode 100644 index 0000000000000..8b4a121d405d4 --- /dev/null +++ b/test/Macros/SwiftifyImport/CxxSpan/lit.local.cfg @@ -0,0 +1,23 @@ +def get_target_os(): + import re + (run_cpu, run_vendor, run_os, run_version) = re.match('([^-]+)-([^-]+)-([^0-9]+)(.*)', config.variant_triple).groups() + return run_os + +if config.target_sdk_libcxx_path != '': + if os.path.exists(os.path.join(config.target_sdk_libcxx_path, "span")): + config.available_features.add('std_span') +elif get_target_os() in ['linux-gnu']: + for p in ['/usr/include/c++/', '/usr/local/include/c++/']: + if not os.path.isdir(p): + continue + for subdir in os.listdir(p): + if not subdir.isdigit(): + # skip paths libc++ paths like /usr/include/c++/v1, we want libstdc++ paths only (like /usr/include/c++/13) + continue + if os.path.exists(os.path.join(p, subdir, "span")): + config.available_features.add('std_span') +elif get_target_os() in ['windows-msvc']: + # We don't test on any versions of MSVC without std::span support. + # FIXME: figure out where to do lookup for C++ stdlib headers on Windows - we'll probably need it eventually + config.available_features.add('std_span') +