mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Test] Add linker_overridden feature.
When testing different linkers, it's sometimes useful to run the tests with `SWIFT_DRIVER_TEST_OPTIONS=" -use-ld=<linker>"`. If we do this, it will break a handful of tests because they expect the compiler driver to choose an appropriate linker automatically. To avoid having these fail, detect when someone has done this, and set a new feature, `linker_overridden`, then mark the tests in question with `UNSUPPORTED: linker_overridden`. rdar://123504095
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// UNSUPPORTED: linker_overridden
|
||||
|
||||
// RUN: %swiftc_driver -driver-print-jobs %S/../Inputs/empty.swift -lto=llvm-thin -target x86_64-unknown-linux-gnu | %FileCheck %s --check-prefix=CHECK-SIMPLE-THIN --check-prefix=CHECK-SIMPLE-THIN-linux-gnu
|
||||
// RUN: %swiftc_driver -driver-print-jobs %S/../Inputs/empty.swift -lto=llvm-thin -target x86_64-unknown-windows-msvc | %FileCheck %s --check-prefix=CHECK-SIMPLE-THIN --check-prefix=CHECK-SIMPLE-THIN-windows-msvc
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// UNSUPPORTED: linker_overridden
|
||||
|
||||
// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 -emit-library %s -module-name ARCHIVER -static 2>&1 | %FileCheck -check-prefix CHECK-MACOS %s
|
||||
|
||||
// CHECK-MACOS: swift
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
// loaded too late").
|
||||
// REQUIRES: no_asan
|
||||
|
||||
// UNSUPPORTED: linker_overridden
|
||||
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %use_just_built_liblto %target-swiftc_driver -emit-library -static -lto=llvm-full %lto_flags -emit-module %S/Inputs/lto/module1.swift -working-directory %t
|
||||
// RUN: %use_just_built_liblto %target-swiftc_driver -lto=llvm-full %lto_flags %s -I%t -L%t -lmodule1 -module-name main -o %t/main
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
// REQUIRES: executable_test
|
||||
// REQUIRES: optimized_stdlib
|
||||
// REQUIRES: OS=macosx || OS=linux-gnu
|
||||
// UNSUPPORTED: linker_overridden
|
||||
|
||||
// For LTO, the linker dlopen()'s the libLTO library, which is a scenario that
|
||||
// ASan cannot work in ("Interceptors are not working, AddressSanitizer is
|
||||
|
||||
@@ -547,6 +547,11 @@ config.swift_driver_test_options += os.environ.get('SWIFT_DRIVER_TEST_OPTIONS',
|
||||
config.swift_ide_test_test_options += os.environ.get('SWIFT_IDE_TEST_TEST_OPTIONS', '')
|
||||
config.sil_test_options = os.environ.get('SIL_TEST_OPTIONS', '')
|
||||
|
||||
# Check if we overrode the linker; if we do, set a feature to say that, which
|
||||
# lets us disable tests that rely on the driver choosing the linker.
|
||||
if re.search(r'(?:^|[ \t])-use-ld=[^ \t]*', config.swift_driver_test_options):
|
||||
config.available_features.add('linker_overridden')
|
||||
|
||||
config.clang_module_cache_path = make_path(config.swift_test_results_dir, "clang-module-cache")
|
||||
shutil.rmtree(config.clang_module_cache_path, ignore_errors=True)
|
||||
mcp_opt = "-module-cache-path %s" % shell_quote(config.clang_module_cache_path)
|
||||
|
||||
Reference in New Issue
Block a user