Skip to content

Commit d4ffaa3

Browse files
committed
[test] Check LD_LIBRARY_PATH a little less strictly.
LD_LIBRARY_PATH is one of the few environment variables the LLVM 'lit' tool /doesn't/ strip out, presumably because on some Linux systems it's necessary to run some of the built products being tested. However, the Swift driver also uses LD_LIBRARY_PATH when providing -L options to the script interpreter on Linux. Weaken some of our tests when there's an LD_LIBRARY_PATH in the environment. (There are similar environment variables on OS X, but we don't have to do anything special there because lit /does/ strip those out. This is presumably okay because all of LLVM's load-time dependencies on OS X are in standard system locations.) https://bugs.swift.org/browse/SR-813
1 parent 344d6e2 commit d4ffaa3

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

test/Driver/environment.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// UNSUPPORTED: objc_interop
22
// Apple's "System Integrity Protection" makes this test fail on OS X.
33

4-
// RUN: %swift_driver -target x86_64-unknown-gnu-linux -L/foo/ -driver-use-frontend-path %S/Inputs/print-var.sh %s LD_LIBRARY_PATH | FileCheck %s
4+
// RUN: %swift_driver -target x86_64-unknown-gnu-linux -L/foo/ -driver-use-frontend-path %S/Inputs/print-var.sh %s LD_LIBRARY_PATH | FileCheck -check-prefix=CHECK${LD_LIBRARY_PATH+_LAX} %s
5+
56
// CHECK: {{^/foo/:[^:]+/lib/swift/linux$}}
7+
// CHECK_LAX: {{^/foo/:[^:]+/lib/swift/linux}}

test/Driver/options-interpreter.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 -resource-dir /RSRC/ %s | FileCheck -check-prefix=CHECK-RESOURCE-DIR-ONLY %s
1818
// CHECK-RESOURCE-DIR-ONLY: # DYLD_LIBRARY_PATH=/RSRC/macosx{{$}}
1919

20-
// RUN: %swift_driver -### -target x86_64-unknown-linux-gnu -resource-dir /RSRC/ %s | FileCheck -check-prefix=CHECK-RESOURCE-DIR-ONLY-LINUX %s
20+
// RUN: %swift_driver -### -target x86_64-unknown-linux-gnu -resource-dir /RSRC/ %s | FileCheck -check-prefix=CHECK-RESOURCE-DIR-ONLY-LINUX${LD_LIBRARY_PATH+_LAX} %s
2121
// CHECK-RESOURCE-DIR-ONLY-LINUX: # LD_LIBRARY_PATH=/RSRC/linux{{$}}
22+
// CHECK-RESOURCE-DIR-ONLY-LINUX_LAX: # LD_LIBRARY_PATH=/RSRC/linux{{$|:}}
2223

2324
// RUN: %swift_driver -### -target x86_64-apple-macosx10.9 -L/foo/ %s | FileCheck -check-prefix=CHECK-L %s
2425
// CHECK-L: # DYLD_LIBRARY_PATH={{/foo/:[^:]+/lib/swift/macosx$}}
@@ -57,8 +58,10 @@
5758
// CHECK-COMPLEX-DAG: DYLD_FRAMEWORK_PATH=/foo/:/bar/:/abc/{{$| }}
5859
// CHECK-COMPLEX-DAG: DYLD_LIBRARY_PATH={{/foo2/:/bar2/:[^:]+/lib/swift/macosx($| )}}
5960

60-
// RUN: %swift_driver -### -target x86_64-unknown-linux-gnu -L/foo/ %s | FileCheck -check-prefix=CHECK-L-LINUX %s
61+
// RUN: %swift_driver -### -target x86_64-unknown-linux-gnu -L/foo/ %s | FileCheck -check-prefix=CHECK-L-LINUX${LD_LIBRARY_PATH+_LAX} %s
6162
// CHECK-L-LINUX: # LD_LIBRARY_PATH={{/foo/:[^:]+/lib/swift/linux$}}
63+
// CHECK-L-LINUX_LAX: # LD_LIBRARY_PATH={{/foo/:[^:]+/lib/swift/linux($|:)}}
6264

63-
// RUN: env LD_LIBRARY_PATH=/abc/ %swift_driver_plain -### -target x86_64-unknown-linux-gnu -L/foo/ -L/bar/ %s | FileCheck -check-prefix=CHECK-LINUX-COMPLEX %s
65+
// RUN: env LD_LIBRARY_PATH=/abc/ %swift_driver_plain -### -target x86_64-unknown-linux-gnu -L/foo/ -L/bar/ %s | FileCheck -check-prefix=CHECK-LINUX-COMPLEX${LD_LIBRARY_PATH+_LAX} %s
6466
// CHECK-LINUX-COMPLEX: # LD_LIBRARY_PATH={{/foo/:/bar/:[^:]+/lib/swift/linux:/abc/$}}
67+
// CHECK-LINUX-COMPLEX_LAX: # LD_LIBRARY_PATH={{/foo/:/bar/:[^:]+/lib/swift/linux:/abc/($|:)}}

0 commit comments

Comments
 (0)