Skip to content

Commit da8b721

Browse files
Merge pull request #85926 from cachemeifyoucan/eng/PR-ebm-scirpt
[TEST-ONLY] Add utility to perform explicit module build
2 parents efdd008 + 756e539 commit da8b721

19 files changed

+156
-230
lines changed

test/CAS/Xcc_args.swift

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,8 @@
88
// RUN: -Xcc -I%t/empty.hmap -module-load-mode prefer-serialized \
99
// RUN: -file-compilation-dir %t
1010

11-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shims.cmd
12-
// RUN: %swift_frontend_plain @%t/shims.cmd
11+
// RUN: %{python} %S/../../utils/swift-build-modules.py --cas %t/cas %swift_frontend_plain %t/deps.json -o %t/MyApp.cmd
1312

14-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:_Macro > %t/Macro.cmd
15-
// RUN: %swift_frontend_plain @%t/Macro.cmd
16-
17-
// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json
18-
// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid
19-
20-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd
2113
// RUN: %FileCheck %s --input-file=%t/MyApp.cmd
2214

2315
// CHECK: "-direct-clang-cc1-module-build"
@@ -29,9 +21,8 @@
2921

3022
// RUN: %target-swift-frontend \
3123
// RUN: -typecheck -cache-compile-job -cas-path %t/cas \
32-
// RUN: -swift-version 5 -disable-implicit-swift-modules \
24+
// RUN: -swift-version 5 -module-name Test \
3325
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
34-
// RUN: -module-name Test -explicit-swift-module-map-file @%t/map.casid \
3526
// RUN: %t/test.swift @%t/MyApp.cmd
3627

3728
//--- test.swift

test/CAS/Xcc_objc_direct.swift

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,12 @@
77
// RUN: -file-compilation-dir %t \
88
// RUN: -I %t/include -module-load-mode prefer-serialized
99

10-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shims.cmd
11-
// RUN: %swift_frontend_plain @%t/shims.cmd
12-
13-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:B > %t/B.cmd
14-
// RUN: %swift_frontend_plain @%t/B.cmd
15-
16-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json A > %t/A.cmd
17-
// RUN: %swift_frontend_plain @%t/A.cmd
18-
19-
// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json
20-
// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid
21-
22-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd
10+
// RUN: %{python} %S/../../utils/swift-build-modules.py --cas %t/cas %swift_frontend_plain %t/deps.json -o %t/MyApp.cmd
2311

2412
// RUN: %target-swift-frontend \
2513
// RUN: -typecheck -cache-compile-job -cas-path %t/cas \
26-
// RUN: -swift-version 5 -disable-implicit-swift-modules \
14+
// RUN: -swift-version 5 -module-name Test \
2715
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
28-
// RUN: -module-name Test -explicit-swift-module-map-file @%t/map.casid \
2916
// RUN: %t/test.swift @%t/MyApp.cmd
3017

3118
//--- test.swift

test/CAS/block-list.swift

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
// RUN: -scanner-prefix-map-paths %t /^tmp -I %t/include \
88
// RUN: %t/main.swift -o %t/deps.json -cache-compile-job -cas-path %t/cas
99

10-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd
11-
// RUN: %swift_frontend_plain @%t/shim.cmd
12-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json A > %t/A.cmd
13-
// RUN: %swift_frontend_plain @%t/A.cmd
10+
// RUN: %{python} %S/../../utils/swift-build-modules.py --cas %t/cas %swift_frontend_plain %t/deps.json -o %t/MyApp.cmd
1411

12+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json A > %t/A.cmd
1513
// RUN: %FileCheck %s -check-prefix CMD -input-file=%t/A.cmd
1614
// CMD: -blocklist-file
1715
// CMD-NEXT: /^tmp/blocklist.yml
@@ -24,17 +22,11 @@
2422
// FS-DAG: blocklist.yml
2523
// FS-DAG: empty.yml
2624

27-
// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json
28-
// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid
29-
30-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd
31-
3225
// RUN: %target-swift-frontend \
3326
// RUN: -target %target-future-triple \
3427
// RUN: -emit-ir -o - -cache-compile-job -cas-path %t/cas -O \
35-
// RUN: -swift-version 5 -disable-implicit-swift-modules \
28+
// RUN: -swift-version 5 -module-name Test \
3629
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
37-
// RUN: -module-name Test -explicit-swift-module-map-file @%t/map.casid \
3830
// RUN: -blocklist-file /^tmp/blocklist.yml -blocklist-file /^tmp/empty.yml \
3931
// RUN: -enable-layout-string-value-witnesses -enable-layout-string-value-witnesses-instantiation \
4032
// RUN: -enable-experimental-feature LayoutStringValueWitnesses -enable-experimental-feature LayoutStringValueWitnessesInstantiation \

test/CAS/bridging-header-prefix-map.swift

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,21 @@
2525
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps-2.json Test casFSRootID > %t/root-2.casid
2626
// RUN: diff %t/root-1.casid %t/root-2.casid
2727

28-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps-1.json clang:SwiftShims > %t/shim.cmd
29-
// RUN: %swift_frontend_plain @%t/shim.cmd
30-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps-1.json bridgingHeader > %t/header.cmd
28+
// RUN: %{python} %S/../../utils/swift-build-modules.py --cas %t/cas %swift_frontend_plain %t/deps-1.json -o %t/MyApp.cmd -b %t/header.cmd
29+
3130
// RUN: %target-swift-frontend @%t/header.cmd /^header/Bridging.h -disable-implicit-swift-modules -O -o %t/bridging.pch
3231
// RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-output-keys -- \
3332
// RUN: %target-swift-frontend @%t/header.cmd /^header/Bridging.h -disable-implicit-swift-modules -O -o %t/bridging.pch > %t/keys.json
3433
// RUN: %{python} %S/Inputs/ExtractOutputKey.py %t/keys.json > %t/key
3534

36-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps-1.json Test > %t/MyApp.cmd
3735
// RUN: echo "\"-disable-implicit-string-processing-module-import\"" >> %t/MyApp.cmd
3836
// RUN: echo "\"-disable-implicit-concurrency-module-import\"" >> %t/MyApp.cmd
39-
// RUN: echo "\"-disable-implicit-swift-modules\"" >> %t/MyApp.cmd
4037
// RUN: echo "\"-import-objc-header\"" >> %t/MyApp.cmd
4138
// RUN: echo "\"/^header/Bridging.h\"" >> %t/MyApp.cmd
4239
// RUN: echo "\"-import-pch\"" >> %t/MyApp.cmd
4340
// RUN: echo "\"%t/bridging.pch\"" >> %t/MyApp.cmd
4441
// RUN: echo "\"-bridging-header-pch-key\"" >> %t/MyApp.cmd
4542
// RUN: echo "\"@%t/key\"" >> %t/MyApp.cmd
46-
// RUN: echo "\"-explicit-swift-module-map-file\"" >> %t/MyApp.cmd
47-
// RUN: echo "\"@%t/map.casid\"" >> %t/MyApp.cmd
48-
// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps-1.json > %t/map.json
49-
// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid
5043
// RUN: %target-swift-frontend -cache-compile-job -module-name Test -O -cas-path %t/cas @%t/MyApp.cmd /^tmp/test.swift \
5144
// RUN: -emit-module -o %t/Test.swiftmodule
5245

test/CAS/cached_diagnostics.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,19 @@
44
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
55
// RUN: %s -o %t/deps.json -cache-compile-job -cas-path %t/cas -module-load-mode prefer-serialized -scanner-output-dir %t
66

7-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd
8-
// RUN: %swift_frontend_plain @%t/shim.cmd
7+
// RUN: %{python} %S/../../utils/swift-build-modules.py --cas %t/cas %swift_frontend_plain %t/deps.json -o %t/MyApp.cmd -b %t/header.cmd
98

10-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json bridgingHeader > %t/header.cmd
119
// RUN: %target-swift-frontend @%t/header.cmd %S/Inputs/objc.h -disable-implicit-swift-modules -O -o %t/objc.pch 2>&1 | %FileCheck %s -check-prefix CHECK-BRIDGE
1210
// RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-output-keys -- \
1311
// RUN: %target-swift-frontend @%t/header.cmd %S/Inputs/objc.h -disable-implicit-swift-modules -O -o %t/objc.pch > %t/keys.json
1412
// RUN: %{python} %S/Inputs/ExtractOutputKey.py %t/keys.json > %t/key
1513

16-
// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json
17-
// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid
18-
19-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd
2014
// RUN: echo "\"-disable-implicit-string-processing-module-import\"" >> %t/MyApp.cmd
2115
// RUN: echo "\"-disable-implicit-concurrency-module-import\"" >> %t/MyApp.cmd
22-
// RUN: echo "\"-disable-implicit-swift-modules\"" >> %t/MyApp.cmd
2316
// RUN: echo "\"-import-objc-header\"" >> %t/MyApp.cmd
2417
// RUN: echo "\"%t/objc.pch\"" >> %t/MyApp.cmd
2518
// RUN: echo "\"-bridging-header-pch-key\"" >> %t/MyApp.cmd
2619
// RUN: echo "\"@%t/key\"" >> %t/MyApp.cmd
27-
// RUN: echo "\"-explicit-swift-module-map-file\"" >> %t/MyApp.cmd
28-
// RUN: echo "\"@%t/map.casid\"" >> %t/MyApp.cmd
2920

3021
// RUN: %target-swift-frontend -cache-compile-job -module-name Test -O -cas-path %t/cas @%t/MyApp.cmd %s \
3122
// RUN: -emit-module -o %t/test.swiftmodule 2>&1 | %FileCheck %s

test/CAS/cached_diagnostics_empty_filename.swift

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
// RUN: -disable-implicit-string-processing-module-import \
88
// RUN: %t/test.swift -o %t/deps.json -cache-compile-job -cas-path %t/cas -module-load-mode prefer-serialized
99

10-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd
11-
// RUN: %swift_frontend_plain @%t/shim.cmd
12-
13-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:_SwiftConcurrencyShims > %t/cshim.cmd
14-
// RUN: %swift_frontend_plain @%t/cshim.cmd
15-
1610
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:A > %t/A.cmd
1711
// RUN: %swift_frontend_plain @%t/A.cmd -Rcache-compile-job 2>&1 | %FileCheck %s --check-prefix=CHECK --check-prefix=CACHE-MISS
1812

@@ -25,14 +19,8 @@
2519
// CHECK: warning: warning a.h
2620
// CACHE-HIT: remark: replay output file
2721

28-
// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json
29-
// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid
30-
31-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd
22+
// RUN: %{python} %S/../../utils/swift-build-modules.py --cas %t/cas %swift_frontend_plain %t/deps.json -o %t/MyApp.cmd
3223
// RUN: echo "\"-disable-implicit-string-processing-module-import\"" >> %t/MyApp.cmd
33-
// RUN: echo "\"-disable-implicit-swift-modules\"" >> %t/MyApp.cmd
34-
// RUN: echo "\"-explicit-swift-module-map-file\"" >> %t/MyApp.cmd
35-
// RUN: echo "\"@%t/map.casid\"" >> %t/MyApp.cmd
3624

3725
// RUN: %target-swift-frontend -cache-compile-job -module-name Test -O -cas-path %t/cas @%t/MyApp.cmd %t/test.swift \
3826
// RUN: -emit-module -o %t/test.swiftmodule -require-explicit-sendable -strict-concurrency=complete

test/CAS/cached_diagnostics_macro.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,14 @@
1616
// RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-include-tree-list @%t/fs.casid | %FileCheck %s --check-prefix=FS
1717

1818
// FS: MacroDefinition
19-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/SwiftShims.cmd
20-
// RUN: %swift_frontend_plain @%t/SwiftShims.cmd
2119

22-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json MyApp > %t/MyApp.cmd
23-
24-
// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json
25-
// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid
20+
// RUN: %{python} %S/../../utils/swift-build-modules.py --cas %t/cas %swift_frontend_plain %t/deps.json -o %t/MyApp.cmd
2621

2722
// RUN: %target-swift-frontend -diagnostic-style=swift \
2823
// RUN: -emit-module -o %t/Test.swiftmodule -cache-compile-job -cas-path %t/cas \
29-
// RUN: -swift-version 5 -disable-implicit-swift-modules \
24+
// RUN: -swift-version 5 -module-name MyApp -O \
3025
// RUN: -external-plugin-path %t#%swift-plugin-server \
3126
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
32-
// RUN: -module-name MyApp -explicit-swift-module-map-file @%t/map.casid -O \
3327
// RUN: %t/main.swift @%t/MyApp.cmd -serialize-diagnostics-path %t/Test.diag 2> %t/diag2.txt
3428

3529
// RUN: diff %t/diag1.txt %t/diag2.txt

test/CAS/cached_diagnostics_pcm.swift

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
66
// RUN: %t/test.swift -o %t/deps.json -cache-compile-job -cas-path %t/cas -module-load-mode prefer-serialized
77

8-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd
9-
// RUN: %swift_frontend_plain @%t/shim.cmd
10-
118
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:A > %t/A.cmd
129
// RUN: %swift_frontend_plain @%t/A.cmd -Rcache-compile-job 2>&1 | %FileCheck %s --check-prefix=CHECK --check-prefix=CACHE-MISS
1310

@@ -20,15 +17,10 @@
2017
// CHECK: warning: warning a.h
2118
// CACHE-HIT: remark: replay output file
2219

23-
// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json > %t/map.json
24-
// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid
20+
// RUN: %{python} %S/../../utils/swift-build-modules.py --cas %t/cas %swift_frontend_plain %t/deps.json -o %t/MyApp.cmd
2521

26-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd
2722
// RUN: echo "\"-disable-implicit-string-processing-module-import\"" >> %t/MyApp.cmd
2823
// RUN: echo "\"-disable-implicit-concurrency-module-import\"" >> %t/MyApp.cmd
29-
// RUN: echo "\"-disable-implicit-swift-modules\"" >> %t/MyApp.cmd
30-
// RUN: echo "\"-explicit-swift-module-map-file\"" >> %t/MyApp.cmd
31-
// RUN: echo "\"@%t/map.casid\"" >> %t/MyApp.cmd
3224

3325
// RUN: %target-swift-frontend -cache-compile-job -module-name Test -O -cas-path %t/cas @%t/MyApp.cmd %t/test.swift \
3426
// RUN: -emit-module -o %t/test.swiftmodule

test/CAS/coverage-dir.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
// RUN: %t/main.swift -o %t/deps.json -cache-compile-job -cas-path %t/cas -profile-coverage-mapping -profile-generate
77

88
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd
9-
// RUN: %swift_frontend_plain @%t/shim.cmd
109
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json A > %t/A.cmd
11-
// RUN: %swift_frontend_plain @%t/A.cmd
1210

1311
// RUN: %FileCheck %s --input-file=%t/shim.cmd
1412
// RUN: %FileCheck %s --input-file=%t/A.cmd

test/CAS/cross_import.swift

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,8 @@
2121
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -O \
2222
// RUN: -o %t/deps.json -I %t -cache-compile-job -cas-path %t/cas -swift-version 5 -enable-cross-import-overlays -module-load-mode prefer-serialized
2323

24-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/shim.cmd
25-
// RUN: %swift_frontend_plain @%t/shim.cmd
26-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:C > %t/C.cmd
27-
// RUN: %swift_frontend_plain @%t/C.cmd
24+
// RUN: %{python} %S/../../utils/swift-build-modules.py --cas %t/cas %swift_frontend_plain %t/deps.json -o %t/MyApp.cmd
2825

29-
// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/deps.json %t > %t/map.json
30-
// RUN: llvm-cas --cas %t/cas --make-blob --data %t/map.json > %t/map.casid
31-
32-
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Test > %t/MyApp.cmd
3326
// RUN: %FileCheck %s --input-file=%t/MyApp.cmd --check-prefix CMD
3427
// CMD: -swift-module-cross-import
3528
// CMD-NEXT: [[CMI1:[B|C]]]
@@ -41,9 +34,9 @@
4134
// RUN: %target-swift-frontend -emit-module -o %t/Test.swiftmodule \
4235
// RUN: -emit-module-interface-path %t/Test.swiftinterface \
4336
// RUN: -cache-compile-job -cas-path %t/cas \
44-
// RUN: -disable-implicit-swift-modules -swift-version 5 -enable-cross-import-overlays \
37+
// RUN: -swift-version 5 -enable-cross-import-overlays \
4538
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib \
46-
// RUN: -module-name Test -explicit-swift-module-map-file @%t/map.casid \
39+
// RUN: -module-name Test \
4740
// RUN: %t/main.swift @%t/MyApp.cmd
4841

4942
// RUN: %FileCheck %s --input-file=%t/Test.swiftinterface

0 commit comments

Comments
 (0)