|
1 | 1 | /// Test the -module-alias flag with an explicit module loader.
|
2 | 2 |
|
3 | 3 | // RUN: %empty-directory(%t)
|
| 4 | +// RUN: mkdir -p %t/inputs |
| 5 | +// RUN: mkdir -p %t/outputs |
4 | 6 |
|
5 | 7 | /// Create a module Bar
|
6 |
| -// RUN: echo 'public func bar() {}' > %t/FileBar.swift |
7 |
| -// RUN: %target-swift-frontend -module-name Bar %t/FileBar.swift -emit-module -emit-module-path %t/Bar.swiftmodule |
| 8 | +// RUN: echo 'public func bar() {}' > %t/inputs/FileBar.swift |
| 9 | +// RUN: %target-swift-frontend -module-name Bar %t/inputs/FileBar.swift -emit-module -emit-module-path %t/inputs/Bar.swiftmodule |
8 | 10 |
|
9 | 11 | /// Check Bar.swiftmodule is created
|
10 |
| -// RUN: test -f %t/Bar.swiftmodule |
| 12 | +// RUN: test -f %t/inputs/Bar.swiftmodule |
11 | 13 |
|
12 | 14 | /// Next create an explicit module dependency map to build module Foo
|
13 |
| -// RUN: mkdir -p %t/inputs |
14 |
| -// RUN: echo 'import Cat' > %t/FileFoo.swift |
| 15 | +// RUN: echo 'import Cat' > %t/inputs/FileFoo.swift |
15 | 16 |
|
16 | 17 | // RUN: echo "[{" > %/t/inputs/map.json
|
17 |
| -// RUN: echo "\"moduleName\": \"Foo\"," >> %/t/inputs/map.json |
18 |
| -// RUN: echo "\"modulePath\": \"%/t/inputs/Foo.swiftmodule\"," >> %/t/inputs/map.json |
19 |
| -// RUN: echo "\"docPath\": \"%/t/inputs/Foo.swiftdoc\"," >> %/t/inputs/map.json |
20 |
| -// RUN: echo "\"sourceInfoPath\": \"%/t/inputs/Foo.swiftsourceinfo\"," >> %/t/inputs/map.json |
21 |
| -// RUN: echo "\"isFramework\": false" >> %/t/inputs/map.json |
22 |
| -// RUN: echo "}," >> %/t/inputs/map.json |
23 |
| -// RUN: echo "{" >> %/t/inputs/map.json |
24 | 18 | // RUN: echo "\"moduleName\": \"Bar\"," >> %/t/inputs/map.json
|
25 |
| -// RUN: echo "\"modulePath\": \"%t/Bar.swiftmodule\"," >> %/t/inputs/map.json |
| 19 | +// RUN: echo "\"modulePath\": \"%/t/inputs/Bar.swiftmodule\"," >> %/t/inputs/map.json |
26 | 20 | // RUN: echo "\"isFramework\": false" >> %/t/inputs/map.json
|
27 | 21 | // RUN: echo "}," >> %/t/inputs/map.json
|
28 | 22 | // RUN: echo "{" >> %/t/inputs/map.json
|
|
42 | 36 | // RUN: echo "}]" >> %/t/inputs/map.json
|
43 | 37 |
|
44 | 38 | /// Create a module Foo that imports Cat with -module-alias Cat=Bar with an explicit module loader
|
45 |
| -// RUN: %target-swift-frontend -module-name Foo %t/FileFoo.swift -module-alias Cat=Bar -I %t -emit-module -emit-module-path %t/Foo.swiftmodule -disable-implicit-swift-modules -explicit-swift-module-map-file %t/inputs/map.json -Rmodule-loading 2> %t/load-result.output |
| 39 | +// RUN: %target-swift-frontend -module-name Foo %t/inputs/FileFoo.swift -module-alias Cat=Bar -I %t/inputs -emit-module -emit-module-path %t/outputs/Foo.swiftmodule -disable-implicit-swift-modules -explicit-swift-module-map-file %t/inputs/map.json -Rmodule-loading 2> %t/outputs/load-result.output |
46 | 40 |
|
47 |
| -// RUN: test -f %t/Foo.swiftmodule |
48 |
| -// RUN: test -f %t/Bar.swiftmodule |
49 |
| -// RUN: not test -f %t/Cat.swiftmodule |
| 41 | +// RUN: test -f %t/outputs/Foo.swiftmodule |
| 42 | +// RUN: test -f %t/inputs/Bar.swiftmodule |
| 43 | +// RUN: not test -f %t/inputs/Cat.swiftmodule |
50 | 44 |
|
51 |
| -// RUN: %FileCheck %s -input-file %t/load-result.output -check-prefix CHECK |
| 45 | +// RUN: %FileCheck %s -input-file %t/outputs/load-result.output -check-prefix CHECK |
52 | 46 | // CHECK: remark: loaded module at {{.*}}Bar.swiftmodule
|
53 | 47 |
|
0 commit comments