|
1 | 1 | // RUN: %empty-directory(%t)
|
2 |
| -// RUN: mkdir -p %t/cas |
| 2 | +// RUN: split-file %s %t |
| 3 | + |
| 4 | +// RUN: %target-swift-frontend -scan-dependencies -module-name Test -O \ |
| 5 | +// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib \ |
| 6 | +// RUN: %t/a.swift %t/b.swift -o %t/deps.json -cache-compile-job -cas-path %t/cas |
| 7 | + |
| 8 | +// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json |
| 9 | +// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid |
| 10 | + |
| 11 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd |
| 12 | +// RUN: echo "\"-disable-implicit-string-processing-module-import\"" >> %t/MyApp.cmd |
| 13 | +// RUN: echo "\"-disable-implicit-concurrency-module-import\"" >> %t/MyApp.cmd |
| 14 | +// RUN: echo "\"-parse-stdlib\"" >> %t/MyApp.cmd |
3 | 15 |
|
4 | 16 | /// Doesn't run because the command doesn't have CAS enabled.
|
5 | 17 | // RUN: not %cache-tool -cas-path %t/cas -cache-tool-action print-base-key -- \
|
6 |
| -// RUN: %target-swift-frontend %s -c -allow-unstable-cache-key-for-testing 2>&1 | \ |
| 18 | +// RUN: %target-swift-frontend %t/a.swift -c @%t/MyApp.cmd 2>&1 | \ |
7 | 19 | // RUN: %FileCheck %s --check-prefix=NO-CAS
|
8 | 20 |
|
9 | 21 | // NO-CAS: Requested command-line arguments do not enable CAS
|
10 | 22 |
|
11 | 23 | /// Check few working cases.
|
12 | 24 | // RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-base-key -- \
|
13 |
| -// RUN: %target-swift-frontend -cache-compile-job %s -c -allow-unstable-cache-key-for-testing > %t1.casid |
| 25 | +// RUN: %target-swift-frontend -cache-compile-job %t/a.swift -c @%t/MyApp.cmd > %t1.casid |
14 | 26 | /// A different CAS doesn't affect base key.
|
15 | 27 | // RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-base-key -- \
|
16 |
| -// RUN: %target-swift-frontend -cache-compile-job %s -c -allow-unstable-cache-key-for-testing -cas-path %t > %t2.casid |
| 28 | +// RUN: %target-swift-frontend -cache-compile-job %t/a.swift -c @%t/MyApp.cmd -cas-path %t > %t2.casid |
17 | 29 | /// Output path doesn't affect base key.
|
18 | 30 | // RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-base-key -- \
|
19 |
| -// RUN: %target-swift-frontend -cache-compile-job %s -c -allow-unstable-cache-key-for-testing -o %t/test.o > %t3.casid |
| 31 | +// RUN: %target-swift-frontend -cache-compile-job %t/a.swift -c @%t/MyApp.cmd -o %t/test.o > %t3.casid |
20 | 32 | /// Add -D will change.
|
21 | 33 | // RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-base-key -- \
|
22 |
| -// RUN: %target-swift-frontend -cache-compile-job %s -c -allow-unstable-cache-key-for-testing -DTEST > %t4.casid |
| 34 | +// RUN: %target-swift-frontend -cache-compile-job %t/a.swift -c @%t/MyApp.cmd -DTEST > %t4.casid |
23 | 35 |
|
24 | 36 | // RUN: diff %t1.casid %t2.casid
|
25 | 37 | // RUN: diff %t1.casid %t3.casid
|
26 | 38 | // RUN: not diff %t1.casid %t4.casid
|
27 | 39 |
|
28 | 40 | /// Check filelist option.
|
29 |
| -// RUN: echo "%s" > %t/filelist-1 |
30 |
| -// RUN: echo "%s" > %t/filelist-2 |
31 |
| -// RUN: cp %s %t/temp.swift |
32 |
| -// RUN: echo "%t/temp.swift" > %t/filelist-3 |
| 41 | +// RUN: echo "%t/a.swift" > %t/filelist-1 |
| 42 | +// RUN: echo "%t/a.swift" > %t/filelist-2 |
| 43 | +// RUN: echo "%t/b.swift" > %t/filelist-3 |
33 | 44 | // RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-base-key -- \
|
34 |
| -// RUN: %target-swift-frontend -cache-compile-job -filelist %t/filelist-1 -c -allow-unstable-cache-key-for-testing > %t5.casid |
| 45 | +// RUN: %target-swift-frontend -cache-compile-job -filelist %t/filelist-1 -c @%t/MyApp.cmd > %t5.casid |
35 | 46 | // RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-base-key -- \
|
36 |
| -// RUN: %target-swift-frontend -cache-compile-job -filelist %t/filelist-2 -c -allow-unstable-cache-key-for-testing > %t6.casid |
| 47 | +// RUN: %target-swift-frontend -cache-compile-job -filelist %t/filelist-2 -c @%t/MyApp.cmd > %t6.casid |
37 | 48 | // RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-base-key -- \
|
38 |
| -// RUN: %target-swift-frontend -cache-compile-job -filelist %t/filelist-3 -c -allow-unstable-cache-key-for-testing > %t7.casid |
| 49 | +// RUN: %target-swift-frontend -cache-compile-job -filelist %t/filelist-3 -c @%t/MyApp.cmd > %t7.casid |
39 | 50 | // RUN: diff %t5.casid %t6.casid
|
40 | 51 | // RUN: not diff %t5.casid %t7.casid
|
41 | 52 |
|
42 | 53 | /// Test output keys.
|
43 | 54 | // RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-output-keys -- \
|
44 |
| -// RUN: %target-swift-frontend -cache-compile-job %s -emit-module -c -emit-dependencies \ |
45 |
| -// RUN: -emit-tbd -emit-tbd-path %t/test.tbd -o %t/test.o -allow-unstable-cache-key-for-testing | %FileCheck %s |
| 55 | +// RUN: %target-swift-frontend -cache-compile-job %t/a.swift -emit-module -c -emit-dependencies \ |
| 56 | +// RUN: -emit-tbd -emit-tbd-path %t/test.tbd -o %t/test.o @%t/MyApp.cmd | %FileCheck %s |
46 | 57 |
|
47 | 58 | /// Test plugin CAS.
|
| 59 | +// RUN: %target-swift-frontend -scan-dependencies -module-name Test -O \ |
| 60 | +// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib \ |
| 61 | +// RUN: %t/a.swift -o %t/plugin_deps.json -cache-compile-job -cas-path %t/cas -cas-plugin-path %llvm_libs_dir/libCASPluginTest%llvm_plugin_ext \ |
| 62 | +// RUN: -cas-plugin-option first-prefix=myfirst- |
| 63 | + |
| 64 | +// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/plugin_deps.json > %t/plugin_map.json |
| 65 | +// RUN: llvm-cas --cas %t/cas --make-blob --data %t/plugin_map.json > %t/map.casid |
| 66 | + |
| 67 | +// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/plugin_deps.json Test > %t/plugin_MyApp.cmd |
48 | 68 | // RUN: %cache-tool -cas-path %t/cas -cas-plugin-path %llvm_libs_dir/libCASPluginTest%llvm_plugin_ext \
|
49 | 69 | // RUN: -cas-plugin-option first-prefix=myfirst- -cache-tool-action print-output-keys -- \
|
50 |
| -// RUN: %target-swift-frontend -cache-compile-job %s -emit-module -c -emit-dependencies \ |
51 |
| -// RUN: -emit-tbd -emit-tbd-path %t/test.tbd -o %t/test.o -allow-unstable-cache-key-for-testing | %FileCheck %s --check-prefix=CHECK --check-prefix=PLUGIN |
| 70 | +// RUN: %target-swift-frontend -cache-compile-job %t/a.swift -emit-module -c -emit-dependencies \ |
| 71 | +// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib \ |
| 72 | +// RUN: -emit-tbd -emit-tbd-path %t/test.tbd -o %t/test.o @%t/plugin_MyApp.cmd | %FileCheck %s --check-prefix=CHECK --check-prefix=PLUGIN |
52 | 73 |
|
53 |
| -// CHECK: "Input": "{{.*}}{{/|\\}}cache_key_compute.swift" |
| 74 | +// CHECK: "Input": "{{.*}}{{/|\\}}a.swift" |
54 | 75 | // CHECK-NEXT: "CacheKey"
|
55 | 76 | // PLUGIN-SAME: myfirst-llvmcas://
|
56 | 77 |
|
|
81 | 102 | // CHECK-NEXT: }
|
82 | 103 | // CHECK-NEXT: ]
|
83 | 104 |
|
| 105 | +//--- a.swift |
| 106 | +func a() {} |
| 107 | + |
| 108 | +//--- b.swift |
| 109 | +func b() {} |
0 commit comments