Skip to content

Commit 90c5cfe

Browse files
committed
[test] Add a Linux test for indirect link dependencies relying on -L.
This is the Linux equivalent of 3731a2f. There's probably a way to merge them into one file cleanly, but the extra linker args on OS X make it a little tricky. I'm deciding not to worry about it right now.
1 parent dd0db18 commit 90c5cfe

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// REQUIRES: OS=linux-gnu
2+
// RUN: rm -rf %t && mkdir %t
3+
4+
// RUN: echo 'int abc = 42;' | %clang -x c - -shared -fPIC -o %t/libabc.so
5+
// RUN: echo 'int test() { extern int abc; return abc; }' | %clang -x c - -L%t -shared -fPIC -labc -o %t/libfoo.so
6+
7+
// RUN: %swift_driver -I %S/Inputs/custom-modules -L%t %s | FileCheck %s
8+
// CHECK: {{okay}}
9+
10+
// Now test a dependency on a library in the compiler's resource directory.
11+
// RUN: mkdir -p %t/rsrc/%target-sdk-name/
12+
// RUN: ln -s %t/libabc.so %t/rsrc/%target-sdk-name/
13+
// RUN: ln -s %platform-module-dir/../* %t/rsrc/%target-sdk-name/
14+
// RUN: ln -s %platform-module-dir/../../shims %t/rsrc/
15+
// RUN: mkdir -p %t/other
16+
// RUN: ln -s %t/libfoo.so %t/other
17+
18+
// RUN: %swift_driver -I %S/Inputs/custom-modules -L%t/other -resource-dir %t/rsrc/ %s | FileCheck %s
19+
20+
import foo
21+
22+
if test() == 42 {
23+
print("okay")
24+
} else {
25+
print("problem")
26+
}

0 commit comments

Comments
 (0)