Skip to content

Commit 1d28b80

Browse files
committed
Add CAS test for module dependencies
1 parent be3009d commit 1d28b80

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

test/CAS/module_dep_path.swift

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: mkdir -p %t/clang-module-cache
3+
// RUN: mkdir -p %t/cas
4+
5+
// A
6+
7+
// RUN: touch %t/A.swift
8+
// RUN: %target-swift-frontend -emit-module -module-cache-path %t/clang-module-cache %t/A.swift -o %t/A.swiftmodule -I %S/../ScanDependencies/Inputs/Swift -swift-version 6 -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib -O
9+
// RUN: llvm-cas --cas %t/cas --make-blob --data %t/A.swiftmodule > %t/A.casid
10+
11+
// B
12+
13+
// RUN: echo "import A" > %t/B.swift
14+
// RUN: %target-swift-frontend -module-name B -scan-dependencies -module-cache-path %t/clang-module-cache %t/B.swift -o %t/B-deps.json -swift-version 6 -cache-compile-job -cas-path %t/cas %t/B.swift -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib -O -I %t
15+
16+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/B-deps.json B> %t/B.cmd
17+
// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/B-deps.json > %t/B-map.json
18+
// RUN: llvm-cas --cas %t/cas --make-blob --data %t/B-map.json > %t/B-map.casid
19+
20+
// RUN: echo %t/B.swift > %t/inputs.FileList
21+
// RUN: %target-swift-frontend -emit-module -o %t/B.swiftmodule -g \
22+
// RUN: -cache-compile-job -cas-path %t/cas -swift-version 6 \
23+
// RUN: -module-name B -swift-module-file=A=@%t/A.casid \
24+
// RUN: -explicit-swift-module-map-file @%t/B-map.casid \
25+
// RUN: -filelist %t/inputs.FileList @%t/B.cmd -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib
26+
27+
// Main
28+
29+
// RUN: %target-swift-frontend -module-name Main -scan-dependencies -module-cache-path %t/clang-module-cache %s -o %t/deps.json -swift-version 6 -cache-compile-job -cas-path %t/cas %s -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib -O -I %t
30+
// UN: %validate-json %t/deps.json | %FileCheck %s -DTEMP=%t
31+
32+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Main> %t/Main.cmd
33+
// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json
34+
// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid
35+
36+
// RUN: rm %t/A.swiftmodule %t/A.swift
37+
// RUN: echo %s > %t/inputs.FileList
38+
// RUN: %target-swift-frontend -emit-module -o %t/Main.swiftmodule -g \
39+
// RUN: -cache-compile-job -cas-path %t/cas -swift-version 6 \
40+
// RUN: -module-name Main -swift-module-file=B=@%t/B.casid \
41+
// RUN: -explicit-swift-module-map-file @%t/map.casid \
42+
// RUN: -filelist %t/inputs.FileList @%t/Main.cmd -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib
43+
44+
import B

0 commit comments

Comments
 (0)