[test] Add a test for indirect link dependencies relying on -L.

...as described in rdar://problem/23588774. We don't really have a good way
to make this test cross-platform as such, but I'll add a Linux version soon.
This commit is contained in:
Jordan Rose
2015-12-02 21:39:04 -08:00
parent 16a647249d
commit 3731a2ff0c
3 changed files with 21 additions and 0 deletions

View File

@@ -0,0 +1 @@
int test();

View File

@@ -0,0 +1,4 @@
module foo {
header "foo.h"
link "foo"
}

View File

@@ -0,0 +1,16 @@
// REQUIRES: OS=macosx
// RUN: rm -rf %t && mkdir %t
// RUN: echo 'int abc = 42;' | %clang -x c - -dynamiclib -Xlinker -install_name -Xlinker libabc.dylib -o %t/libabc.dylib
// RUN: echo 'int test() { extern int abc; return abc; }' | %clang -x c - -L%t -dynamiclib -labc -o %t/libfoo.dylib
// RUN: %swift_driver -I %S/Inputs/custom-modules -L%t %s | FileCheck %s
// CHECK: {{okay}}
import foo
if test() == 42 {
print("okay")
} else {
print("problem")
}