Skip to content

Commit 5462c0a

Browse files
committed
Ensure that the host library path is provided to tests.
Eliminate the "copy the plugin library" step for these tests, which was always a hack and doesn't scale when we add more shared libraries.
1 parent 9c5357e commit 5462c0a

File tree

7 files changed

+38
-58
lines changed

7 files changed

+38
-58
lines changed

test/Driver/driver-compile.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@
4848
// RUN: %empty-directory(%t/DISTINCTIVE-PATH/usr/bin/)
4949
// RUN: %empty-directory(%t/DISTINCTIVE-PATH/usr/lib/)
5050
// RUN: %hardlink-or-copy(from: %swift_frontend_plain, to: %t/DISTINCTIVE-PATH/usr/bin/swiftc)
51-
// RUN: %copy-plugin-support-library(%t/DISTINCTIVE-PATH/usr/lib/)
5251
// RUN: ln -s "swiftc" %t/DISTINCTIVE-PATH/usr/bin/swift-update
53-
// RUN: %t/DISTINCTIVE-PATH/usr/bin/swiftc -driver-print-jobs -c -update-code -target x86_64-apple-macosx10.9 %s 2>&1 > %t.upd.txt
52+
// RUN: %host-library-env %t/DISTINCTIVE-PATH/usr/bin/swiftc -driver-print-jobs -c -update-code -target x86_64-apple-macosx10.9 %s 2>&1 > %t.upd.txt
5453
// RUN: %FileCheck -check-prefix UPDATE-CODE %s < %t.upd.txt
5554
// Clean up the test executable because hard links are expensive.
5655
// RUN: rm -rf %t/DISTINCTIVE-PATH/usr/bin/swiftc

test/Driver/linker-clang_rt.swift

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,32 @@
88
// RUN: %empty-directory(%t/bin)
99
// RUN: %empty-directory(%t/lib)
1010
// RUN: %hardlink-or-copy(from: %swift_frontend_plain, to: %t/bin/swiftc)
11-
// RUN: %copy-plugin-support-library(%t/lib/)
1211
// RUN: %empty-directory(%t/lib/swift/clang/lib/darwin/)
1312

1413
// RUN: %t/bin/swiftc -driver-print-jobs -target x86_64-apple-macosx10.9 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-NO-RUNTIME %s
1514

1615
// RUN: touch %t/lib/swift/clang/lib/darwin/libclang_rt.osx.a %t/lib/swift/clang/lib/darwin/libclang_rt.ios.a %t/lib/swift/clang/lib/darwin/libclang_rt.iossim.a %t/lib/swift/clang/lib/darwin/libclang_rt.tvos.a %t/lib/swift/clang/lib/darwin/libclang_rt.tvossim.a %t/lib/swift/clang/lib/darwin/libclang_rt.watchos.a %t/lib/swift/clang/lib/darwin/libclang_rt.watchossim.a
1716

18-
// RUN: %t/bin/swiftc -driver-print-jobs -target x86_64-apple-macosx10.9 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-MACOS %s
19-
// RUN: %t/bin/swiftc -driver-print-jobs -target x86_64-apple-ios13.1-macabi %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-MACCATALYST %s
20-
21-
// RUN: %t/bin/swiftc -driver-print-jobs -target i386-apple-ios7-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-IOSSIM %s
22-
// RUN: %t/bin/swiftc -driver-print-jobs -target i386-apple-ios7 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-IOSSIM %s
23-
// RUN: %t/bin/swiftc -driver-print-jobs -target x86_64-apple-ios7-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-IOSSIM %s
24-
// RUN: %t/bin/swiftc -driver-print-jobs -target x86_64-apple-ios7 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-IOSSIM %s
25-
// RUN: %t/bin/swiftc -driver-print-jobs -target armv7s-apple-ios7 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-IOS %s
26-
// RUN: %t/bin/swiftc -driver-print-jobs -target arm64-apple-ios7-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-IOSSIM %s
27-
// RUN: %t/bin/swiftc -driver-print-jobs -target arm64-apple-ios7 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-IOS %s
28-
29-
// RUN: %t/bin/swiftc -driver-print-jobs -target x86_64-apple-tvos9-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-TVOSSIM %s
30-
// RUN: %t/bin/swiftc -driver-print-jobs -target x86_64-apple-tvos9 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-TVOSSIM %s
31-
// RUN: %t/bin/swiftc -driver-print-jobs -target arm64-apple-tvos9-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-TVOSSIM %s
32-
// RUN: %t/bin/swiftc -driver-print-jobs -target arm64-apple-tvos9 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-TVOS %s
33-
34-
// RUN: %t/bin/swiftc -driver-print-jobs -target i386-apple-watchos2-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-WATCHOSSIM %s
35-
// RUN: %t/bin/swiftc -driver-print-jobs -target i386-apple-watchos2 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-WATCHOSSIM %s
36-
// RUN: %t/bin/swiftc -driver-print-jobs -target armv7k-apple-watchos2 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-WATCHOS %s
37-
// RUN: %t/bin/swiftc -driver-print-jobs -target arm64-apple-watchos2-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-WATCHOSSIM %s
17+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target x86_64-apple-macosx10.9 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-MACOS %s
18+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target x86_64-apple-ios13.1-macabi %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-MACCATALYST %s
19+
20+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target i386-apple-ios7-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-IOSSIM %s
21+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target i386-apple-ios7 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-IOSSIM %s
22+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target x86_64-apple-ios7-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-IOSSIM %s
23+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target x86_64-apple-ios7 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-IOSSIM %s
24+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target armv7s-apple-ios7 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-IOS %s
25+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target arm64-apple-ios7-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-IOSSIM %s
26+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target arm64-apple-ios7 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-IOS %s
27+
28+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target x86_64-apple-tvos9-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-TVOSSIM %s
29+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target x86_64-apple-tvos9 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-TVOSSIM %s
30+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target arm64-apple-tvos9-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-TVOSSIM %s
31+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target arm64-apple-tvos9 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-TVOS %s
32+
33+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target i386-apple-watchos2-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-WATCHOSSIM %s
34+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target i386-apple-watchos2 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-WATCHOSSIM %s
35+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target armv7k-apple-watchos2 %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-WATCHOS %s
36+
// RUN: %host-library-env %t/bin/swiftc -driver-print-jobs -target arm64-apple-watchos2-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix CHECK -check-prefix CHECK-WATCHOSSIM %s
3837

3938
// Clean up the test executable because hard links are expensive.
4039
// RUN: rm -f %t/bin/swiftc

test/Driver/options-repl-darwin.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,18 @@
77
// RUN: %empty-directory(%t/usr/bin/)
88
// RUN: %empty-directory(%t/usr/lib/)
99
// RUN: %hardlink-or-copy(from: %swift_driver_plain, to: %t/usr/bin/swift)
10-
// RUN: %copy-plugin-support-library(%t/usr/lib/)
1110

12-
// RUN: %t/usr/bin/swift -repl -### | %FileCheck -check-prefix=INTEGRATED %s
13-
// RUN: %t/usr/bin/swift -### | %FileCheck -check-prefix=INTEGRATED %s
11+
// RUN: %host-library-env %t/usr/bin/swift -repl -### | %FileCheck -check-prefix=INTEGRATED %s
12+
// RUN: %host-library-env %t/usr/bin/swift -### | %FileCheck -check-prefix=INTEGRATED %s
1413

1514
// RUN: touch %t/usr/bin/lldb
1615
// RUN: chmod +x %t/usr/bin/lldb
17-
// RUN: %t/usr/bin/swift -repl -### | %FileCheck -check-prefix=LLDB %s
18-
// RUN: %t/usr/bin/swift -### | %FileCheck -check-prefix=LLDB %s
16+
// RUN: %host-library-env %t/usr/bin/swift -repl -### | %FileCheck -check-prefix=LLDB %s
17+
// RUN: %host-library-env %t/usr/bin/swift -### | %FileCheck -check-prefix=LLDB %s
1918

2019
// RUN: %empty-directory(%t/Toolchains/Test.xctoolchain/usr/bin)
2120
// RUN: %empty-directory(%t/Toolchains/Test.xctoolchain/usr/lib)
2221
// RUN: mv %t/usr/bin/swift %t/Toolchains/Test.xctoolchain/usr/bin/swift
23-
// RUN: %copy-plugin-support-library(%t/Toolchains/Test.xctoolchain/usr/lib/)
2422
// RUN: %t/Toolchains/Test.xctoolchain/usr/bin/swift -repl -### | %FileCheck -check-prefix=LLDB %s
2523

2624
// Clean up the test executable because hard links are expensive.

test/Driver/options-repl.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
// RUN: %empty-directory(%t)
99
// RUN: mkdir -p %t/usr/bin
1010
// RUN: mkdir -p %t/usr/lib
11-
// RUN: %copy-plugin-support-library(%t/usr/lib/)
1211
// RUN: %hardlink-or-copy(from: %swift_frontend_plain, to: %t/usr/bin/swift)
1312

14-
// RUN: %t/usr/bin/swift -sdk "" -deprecated-integrated-repl -### | %FileCheck -check-prefix=INTEGRATED %s
13+
// RUN: %host-library-env %t/usr/bin/swift -sdk "" -deprecated-integrated-repl -### | %FileCheck -check-prefix=INTEGRATED %s
1514

1615
// INTEGRATED: swift{{c?(\.exe)?"?}} -frontend -repl
1716
// INTEGRATED: -module-name REPL
@@ -46,10 +45,10 @@
4645
// like the Xcode installation environment. We use hard links to make sure
4746
// the Swift driver really thinks it's been moved.
4847

49-
// RUN: %t/usr/bin/swift -sdk "" -repl -### | %FileCheck -check-prefix=INTEGRATED %s
50-
// RUN: %t/usr/bin/swift -sdk "" -### | %FileCheck -check-prefix=INTEGRATED %s
48+
// RUN: %host-library-env %t/usr/bin/swift -sdk "" -repl -### | %FileCheck -check-prefix=INTEGRATED %s
49+
// RUN: %host-library-env %t/usr/bin/swift -sdk "" -### | %FileCheck -check-prefix=INTEGRATED %s
5150

5251
// RUN: touch %t/usr/bin/lldb
5352
// RUN: chmod +x %t/usr/bin/lldb
54-
// RUN: %t/usr/bin/swift -sdk "" -repl -### | %FileCheck -check-prefix=LLDB %s
55-
// RUN: %t/usr/bin/swift -sdk "" -### | %FileCheck -check-prefix=LLDB %s
53+
// RUN: %host-library-env %t/usr/bin/swift -sdk "" -repl -### | %FileCheck -check-prefix=LLDB %s
54+
// RUN: %host-library-env %t/usr/bin/swift -sdk "" -### | %FileCheck -check-prefix=LLDB %s

test/Driver/subcommands.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
// RUN: mkdir -p %t.dir/usr/bin
66
// RUN: mkdir -p %t.dir/usr/lib
77
// RUN: %hardlink-or-copy(from: %swift_frontend_plain, to: %t.dir/usr/bin/swift)
8-
// RUN: %copy-plugin-support-library(%t.dir/usr/lib/)
98

10-
// RUN: %t.dir/usr/bin/swift -### 2>&1 | %FileCheck -check-prefix=CHECK-SWIFT-INVOKES-REPL %s
11-
// RUN: %t.dir/usr/bin/swift repl -### 2>&1 | %FileCheck -check-prefix=CHECK-SWIFT-INVOKES-REPL %s
9+
// RUN: %host-library-env %t.dir/usr/bin/swift -### 2>&1 | %FileCheck -check-prefix=CHECK-SWIFT-INVOKES-REPL %s
10+
// RUN: %host-library-env %t.dir/usr/bin/swift repl -### 2>&1 | %FileCheck -check-prefix=CHECK-SWIFT-INVOKES-REPL %s
1211

1312
// CHECK-SWIFT-INVOKES-REPL: {{.*}}/swift{{.*}} -repl
1413

test/Driver/windows-link-job.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// RUN: %empty-directory(%t/DISTINCTIVE-WINDOWS-PATH/usr/bin)
22
// RUN: %empty-directory(%t/DISTINCTIVE-WINDOWS-PATH/usr/lib)
33
// RUN: %hardlink-or-copy(from: %swift_frontend_plain, to: %t/DISTINCTIVE-WINDOWS-PATH/usr/bin/swiftc)
4-
// RUN: %copy-plugin-support-library(%t/DISTINCTIVE-WINDOWS-PATH/usr/lib/)
5-
// RUN: env PATH= %t/DISTINCTIVE-WINDOWS-PATH/usr/bin/swiftc -target x86_64-unknown-windows-msvc -### -module-name link -emit-library %s 2>&1 | %FileCheck %s
4+
// RUN: %host-library-env PATH= %t/DISTINCTIVE-WINDOWS-PATH/usr/bin/swiftc -target x86_64-unknown-windows-msvc -### -module-name link -emit-library %s 2>&1 | %FileCheck %s
65

76
// swift-frontend cannot be copied to another location with bootstrapping because
87
// it will not find the libswiftCore library with its relative RPATH.

test/lit.cfg

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,24 +2479,11 @@ config.substitutions.append(('%target-resilience-test', config.target_resilience
24792479
config.substitutions.append(('%llvm-profdata', config.llvm_profdata))
24802480
config.substitutions.append(('%llvm-cov', config.llvm_cov))
24812481

2482-
# Name of the compiler plugin support library.
2483-
plugin_support_shared_lib_name = ("%sswift_CompilerPluginSupport%s" %
2484-
(config.target_shared_library_prefix, config.target_shared_library_suffix))
2485-
plugin_support_shared_lib = make_path(config.swift_host_lib_dir, plugin_support_shared_lib_name)
2486-
config.substitutions.append(('%compiler_plugin_library',
2487-
plugin_support_shared_lib))
2488-
2489-
if "swift_swift_parser" in config.available_features:
2490-
config.substitutions.append(
2491-
(r'%copy-plugin-support-library\(*(.*)\)',
2492-
SubstituteCaptures(
2493-
r'cp %s \1' %
2494-
(escape_for_substitute_captures(plugin_support_shared_lib)))))
2495-
else:
2496-
config.substitutions.append(
2497-
(r'%copy-plugin-support-library\(*(.*)\)',
2498-
r'echo "No plugin support library to copy"'))
2499-
2482+
# Set up the host library environment.
2483+
host_library_env = (
2484+
"/usr/bin/env " +
2485+
construct_library_path_env(config.swift_host_lib_dir))
2486+
config.substitutions.append(('%host-library-env', host_library_env))
25002487

25012488
if hasattr(config, 'otool_classic'):
25022489
config.substitutions.append(('%otool-classic', config.otool_classic))

0 commit comments

Comments
 (0)