|
5 | 5 | // resource directory will contain a swiftmodule for the standard library.
|
6 | 6 |
|
7 | 7 | // %t/good-sdk contains a loadable standard library.
|
| 8 | +// RUN: %empty-directory(%t/good-sdk) |
8 | 9 | // RUN: %empty-directory(%t/good-sdk/usr/lib/swift)
|
9 | 10 | // RUN: cp -r %platform-module-dir/Swift.swiftmodule %t/good-sdk/usr/lib/swift/Swift.swiftmodule
|
10 | 11 |
|
11 | 12 | // %t/bad-sdk contains an invalid standard library that cannot be loaded.
|
| 13 | +// RUN: %empty-directory(%t/bad-sdk) |
12 | 14 | // RUN: %empty-directory(%t/bad-sdk/usr/lib/swift/Swift.swiftmodule)
|
13 | 15 | // RUN: touch %t/bad-sdk/usr/lib/swift/Swift.swiftmodule/garbage-garbage-garbage.swiftmodule
|
14 | 16 |
|
15 | 17 | // %t/empty-toolchain does not contain a standard library.
|
| 18 | +// RUN: %empty-directory(%t/empty-toolchain) |
16 | 19 | // RUN: %empty-directory(%t/empty-toolchain/usr/lib/swift)
|
17 | 20 |
|
18 | 21 | // FIXME: Until we have private imports, we need SwiftShims in the toolchain.
|
19 | 22 | // RUN: cp -r %test-resource-dir/shims %t/empty-toolchain/usr/lib/swift/shims
|
20 | 23 |
|
| 24 | +// %t/really-empty-toolchain does not contain a standard library or SwiftShims. |
| 25 | +// RUN: %empty-directory(%t/really-empty-toolchain) |
| 26 | +// RUN: %empty-directory(%t/really-empty-toolchain/usr/lib/swift) |
| 27 | + |
21 | 28 | // If the compiler's resource directory does not contain a runtime swiftmodule,
|
22 | 29 | // we should fall back to the SDK.
|
23 | 30 |
|
|
34 | 41 | // If neither the resource directory nor the SDK contains a runtime swiftmodule,
|
35 | 42 | // loading should fail. This just proves that we aren't getting runtime imports
|
36 | 43 | // some other way.
|
| 44 | +// |
| 45 | +// We also check that ClangImporter noticed SwiftShims in the toolchain and |
| 46 | +// didn't add a -isystem flag to look in the SDK. |
37 | 47 |
|
38 | 48 | // FIXME: We can't properly test this on a non-Darwin platform because we'll get
|
39 | 49 | // the same error message for "unloadable standard library" and "no standard
|
40 | 50 | // library". (SR-10097)
|
41 | 51 | // REQUIRES: objc_interop
|
42 | 52 |
|
43 | 53 | // RUN: %empty-directory(%t/mcp)
|
44 |
| -// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/bad-sdk) -resource-dir %t/empty-toolchain/usr/lib/swift -module-cache-path %t/mcp -typecheck %s 2>&1 | %FileCheck %s |
45 |
| -// CHECK: error: could not find module 'Swift' for target '{{.*}}'; found: garbage-garbage-garbage |
| 54 | +// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/bad-sdk) -resource-dir %t/empty-toolchain/usr/lib/swift -module-cache-path %t/mcp -typecheck %s -dump-clang-diagnostics 2>&1 | %FileCheck --check-prefix CHECK-EMPTY %s |
| 55 | +// CHECK-EMPTY-NOT: '-isystem' '{{.*}}/bad-sdk/usr/lib/swift/shims' |
| 56 | +// CHECK-EMPTY: error: could not find module 'Swift' for target '{{.*}}'; found: garbage-garbage-garbage |
| 57 | + |
| 58 | +// Check that, when the toolchain *doesn't* have SwiftShims in it, ClagImporter |
| 59 | +// *does* add a -I flag to look in the SDK. |
| 60 | + |
| 61 | +// RUN: %empty-directory(%t/mcp) |
| 62 | +// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/bad-sdk) -resource-dir %t/really-empty-toolchain/usr/lib/swift -module-cache-path %t/mcp -typecheck %s -dump-clang-diagnostics 2>&1 | %FileCheck --check-prefix CHECK-REALLY-EMPTY %s |
| 63 | +// CHECK-REALLY-EMPTY: '-isystem' '{{.*}}/bad-sdk/usr/lib/swift/shims' |
| 64 | +// CHECK-REALLY-EMPTY: error: could not find module 'Swift' for target '{{.*}}'; found: garbage-garbage-garbage |
46 | 65 |
|
47 | 66 | let x: Int = 1
|
0 commit comments