Files
swift-mirror/test/embedded/lit.local.cfg

37 lines
1.9 KiB
INI

# Make a local copy of the substitutions.
config.substitutions = list(config.substitutions)
# A handful of test setup tweaks that we want for *all* Embedded Swift tests (i.e. all tests in this directory):
# (1) When targeting macOS, raise the deployment target to macOS 14.0 (from the default 13.0)
if config.target_sdk_name == 'macosx':
def do_fixup(key, value):
if isinstance(value, str):
value = value.replace("-apple-macosx13.0", "-apple-macos14")
elif isinstance(value, SubstituteCaptures):
value.substitution = value.substitution.replace("-apple-macosx13.0", "-apple-macos14")
return (key, value)
config.substitutions = [do_fixup(a, b) for (a, b) in config.substitutions]
# (2) If building embedded stdlib is off (SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB in CMake), make all tests unsupported
if 'embedded_stdlib' not in config.available_features:
config.unsupported = True
# (3) Restrict Embedded Swift tests only to the currently supported set of test target OS's, skip them otherwise.
supported_test_os_list = ["OS=macosx", "OS=linux-gnu", "OS=none-eabi", "OS=none-elf"]
if config.available_features.intersection(set(supported_test_os_list)) == set():
config.unsupported = True
# (4) Use the new Swift driver (swift-driver), instead of the legacy C++ Swift driver (which is unfortunately what
# standard Swift lit tests still use by default).
config.environment = dict(config.environment)
if 'SWIFT_USE_OLD_DRIVER' in config.environment: del config.environment['SWIFT_USE_OLD_DRIVER']
if 'SWIFT_AVOID_WARNING_USING_OLD_DRIVER' in config.environment: del config.environment['SWIFT_AVOID_WARNING_USING_OLD_DRIVER']
# (5) Provide some useful substitutions to simplify writing tests that work across platforms (macOS, Linux, etc.)
if "OS=linux-gnu" in config.available_features:
config.substitutions.append(("%linux_rng_support_c_if_needed", "%S/Inputs/linux-rng-support.c"))
else:
config.substitutions.append(("%linux_rng_support_c_if_needed", ""))