mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
46 lines
2.9 KiB
INI
46 lines
2.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)
|
|
config.target_clang = config.target_clang.replace("-apple-macosx13.0", "-apple-macos14")
|
|
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", "OS=wasip1"]
|
|
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']
|
|
|
|
target_cpu = [y for (x, y) in config.substitutions if x == "%target-cpu"][0]
|
|
target_triple = [y for (x, y) in config.substitutions if x == "%target-triple"][0]
|
|
|
|
# (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(("%target-embedded-link", config.target_clang + " -x c %S/Inputs/linux-rng-support.c -x none"))
|
|
config.substitutions.append(("%embedded-unicode-tables", f"-Xlinker {config.swift_obj_root}/lib/swift/embedded/{target_cpu}-unknown-linux-gnu/libswiftUnicodeDataTables.a"))
|
|
elif "OS=macosx" in config.available_features:
|
|
config.substitutions.append(("%target-embedded-link", config.target_clang))
|
|
config.substitutions.append(("%embedded-unicode-tables", f"-Xlinker {config.swift_obj_root}/lib/swift/embedded/{target_cpu}-apple-macos/libswiftUnicodeDataTables.a"))
|
|
else:
|
|
config.substitutions.append(("%target-embedded-link", config.target_clang))
|
|
config.substitutions.append(("%embedded-unicode-tables", f"-Xlinker {config.swift_obj_root}/lib/swift/embedded/{target_triple}/libswiftUnicodeDataTables.a"))
|