Skip to content

Commit 6d9fe82

Browse files
[Caching][Test] Call all python scripts through python exe
Improve tests to call python script through python executable. Even this doesn't cause any errors now, it will be a problem for future when we run CAS tests on Windows platform. Clean up the current test to avoid bad test example.
1 parent be35394 commit 6d9fe82

10 files changed

+37
-37
lines changed

test/CAS/binary_module_deps.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// RUN: %validate-json %t/deps.json | %FileCheck %s -DTEMP=%t
1111

1212
/// Test binary module key: binary module key is the CASID of itself.
13-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json swiftPrebuiltExternal:A moduleCacheKey > %t/A.key.casid
13+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json swiftPrebuiltExternal:A moduleCacheKey > %t/A.key.casid
1414
// RUN: llvm-cas --cas %t/cas --cat-blob @%t/A.key.casid > %t/Loaded.swiftmodule
1515
// RUN: diff %t/A.swiftmodule %t/Loaded.swiftmodule
1616

test/CAS/can-import.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@
88
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import \
99
// RUN: %t/main.swift -o %t/deps.json -swift-version 5 -cache-compile-job -cas-path %t/cas -I %t/include
1010

11-
// RUN: %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:A > %t/A.cmd
11+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:A > %t/A.cmd
1212
// RUN: %swift_frontend_plain @%t/A.cmd
1313

14-
// RUN: %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:B > %t/B.cmd
14+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:B > %t/B.cmd
1515
// RUN: %swift_frontend_plain @%t/B.cmd
1616

17-
// RUN: %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/SwiftShims.cmd
17+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/SwiftShims.cmd
1818
// RUN: %swift_frontend_plain @%t/SwiftShims.cmd
1919

20-
// RUN: %S/Inputs/BuildCommandExtractor.py %t/deps.json Swift > %t/Swift.cmd
20+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Swift > %t/Swift.cmd
2121
// RUN: %swift_frontend_plain @%t/Swift.cmd
2222

23-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json Swift moduleCacheKey | tr -d '\n' > %t/Swift.key
24-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:SwiftShims moduleCacheKey | tr -d '\n' > %t/Shims.key
25-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:A moduleCacheKey | tr -d '\n' > %t/A.key
26-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:B moduleCacheKey | tr -d '\n' > %t/B.key
27-
// RUN: %S/Inputs/BuildCommandExtractor.py %t/deps.json MyApp > %t/MyApp.cmd
23+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json Swift moduleCacheKey | tr -d '\n' > %t/Swift.key
24+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:SwiftShims moduleCacheKey | tr -d '\n' > %t/Shims.key
25+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:A moduleCacheKey | tr -d '\n' > %t/A.key
26+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:B moduleCacheKey | tr -d '\n' > %t/B.key
27+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json MyApp > %t/MyApp.cmd
2828

2929
// RUN: echo "[{" > %/t/map.json
3030
// RUN: echo "\"moduleName\": \"Swift\"," >> %/t/map.json

test/CAS/cas-explicit-module-map.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
// RUN: %target-swift-emit-pcm -Xfrontend -cache-compile-job -Xfrontend -allow-unstable-cache-key-for-testing -Xfrontend -cas-path -Xfrontend %t/cas -module-cache-path %t/clang-module-cache -module-name SwiftShims %swift-lib-dir/swift/shims/module.modulemap -o %t/SwiftShims.pcm
55
// RUN: %target-swift-emit-pcm -Xfrontend -cache-compile-job -Xfrontend -allow-unstable-cache-key-for-testing -Xfrontend -cas-path -Xfrontend %t/cas -module-cache-path %t/clang-module-cache -module-name SwiftShims %swift-lib-dir/swift/shims/module.modulemap -o %t/SwiftShims.pcm -### > %t/Shims.cmd
66
// RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-output-keys -- @%t/Shims.cmd > %t/Shims.key.json
7-
// RUN: %S/Inputs/ExtractOutputKey.py %t/Shims.key.json %t/SwiftShims.pcm | tr -d '\n' > %t/Shims.key
7+
// RUN: %{python} %S/Inputs/ExtractOutputKey.py %t/Shims.key.json %t/SwiftShims.pcm | tr -d '\n' > %t/Shims.key
88

99
// RUN: %target-swift-emit-pcm -Xfrontend -cache-compile-job -Xfrontend -allow-unstable-cache-key-for-testing -module-cache-path %t/clang-module-cache -Xfrontend -cas-path -Xfrontend %t/cas -module-name _SwiftConcurrencyShims %swift-lib-dir/swift/shims/module.modulemap -o %t/_SwiftConcurrencyShims.pcm
1010
// RUN: %target-swift-emit-pcm -Xfrontend -cache-compile-job -Xfrontend -allow-unstable-cache-key-for-testing -module-cache-path %t/clang-module-cache -Xfrontend -cas-path -Xfrontend %t/cas -module-name _SwiftConcurrencyShims %swift-lib-dir/swift/shims/module.modulemap -o %t/_SwiftConcurrencyShims.pcm -### > %t/ConcurrencyShims.cmd
1111
// RUN: %cache-tool -cas-path %t/cas -cache-tool-action print-output-keys -- @%t/ConcurrencyShims.cmd > %t/ConcurrencyShims.key.json
12-
// RUN: %S/Inputs/ExtractOutputKey.py %t/ConcurrencyShims.key.json %t/_SwiftConcurrencyShims.pcm | tr -d '\n' > %t/ConcurrencyShims.key
12+
// RUN: %{python} %S/Inputs/ExtractOutputKey.py %t/ConcurrencyShims.key.json %t/_SwiftConcurrencyShims.pcm | tr -d '\n' > %t/ConcurrencyShims.key
1313

1414
// RUN: %target-swift-frontend -emit-module -module-cache-path %t/clang-module-cache %t/A.swift -o %t/A.swiftmodule -swift-version 5
1515
// RUN: %target-swift-frontend -emit-module -module-cache-path %t/clang-module-cache %t/B.swift -o %t/B.swiftmodule -I %t -swift-version 5
1616
// RUN: %target-swift-frontend -scan-dependencies -module-cache-path %t/clang-module-cache %t/Test.swift -o %t/deps.json -I %t -swift-version 5 -cache-compile-job -cas-path %t/cas
1717
// RUN: %validate-json %t/deps.json &>/dev/null
1818

19-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json swiftPrebuiltExternal:A moduleCacheKey | tr -d '\n' > %t/A.key
20-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json swiftPrebuiltExternal:B moduleCacheKey | tr -d '\n' > %t/B.key
19+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json swiftPrebuiltExternal:A moduleCacheKey | tr -d '\n' > %t/A.key
20+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json swiftPrebuiltExternal:B moduleCacheKey | tr -d '\n' > %t/B.key
2121

2222
/// Prepare the cas objects that can be used to construct CompileJobResultSchema object.
2323
// RUN: llvm-cas --cas %t/cas --get-cache-result @%t/A.key > %t/A.result
@@ -116,7 +116,7 @@
116116
// RUN: -module-cache-path %t.module-cache -explicit-swift-module-map-file @%t/map.casid %s -cache-compile-job \
117117
// RUN: -cas-path %t/cas -allow-unstable-cache-key-for-testing -swift-version 5 -enable-library-evolution > %t/keys.json
118118

119-
// RUN: %S/Inputs/ExtractOutputKey.py %t/keys.json %t/Foo.swiftinterface > %t/interface.casid
119+
// RUN: %{python} %S/Inputs/ExtractOutputKey.py %t/keys.json %t/Foo.swiftinterface > %t/interface.casid
120120
// RUN: %target-swift-frontend -typecheck-module-from-interface %t/Foo.swiftinterface -disable-implicit-swift-modules \
121121
// RUN: -module-cache-path %t.module-cache -explicit-swift-module-map-file @%t/map.casid \
122122
// RUN: -cache-compile-job -cas-path %t/cas -allow-unstable-cache-key-for-testing -swift-version 5 -enable-library-evolution \

test/CAS/deps_cas_fs.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
// RUN: %validate-json %t/deps.json &>/dev/null
1313

1414
/// check cas-fs content
15-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json E casFSRootID > %t/E_fs.casid
15+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json E casFSRootID > %t/E_fs.casid
1616
// RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/E_fs.casid | %FileCheck %s -check-prefix FS_ROOT_E
17-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json F casFSRootID > %t/F_fs.casid
17+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json F casFSRootID > %t/F_fs.casid
1818
// RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/F_fs.casid | %FileCheck %s -check-prefix FS_ROOT_F
19-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json Test casFSRootID > %t/Test_fs.casid
19+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json Test casFSRootID > %t/Test_fs.casid
2020
// RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/Test_fs.casid | %FileCheck %s -check-prefix FS_ROOT_TEST
2121

2222
// FS_ROOT_E-DAG: layouts-x86_64.yaml

test/CAS/include-tree-cxx.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
// RUN: %target-swift-frontend -scan-dependencies -module-name Test -module-cache-path %t/clang-module-cache %t/main.swift -o %t/deps.json -I %t/include -swift-version 4 -cache-compile-job -cas-path %t/cas -cxx-interoperability-mode=default
55

6-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:MyCXX clangIncludeTree | %FileCheck %s
7-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:MyCXX moduleCacheKey | %FileCheck %s
6+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:MyCXX clangIncludeTree | %FileCheck %s
7+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:MyCXX moduleCacheKey | %FileCheck %s
88

99
// CHECK: llvmcas://
1010

test/CAS/include-tree.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
// RUN: split-file %s %t
66

77
// RUN: %target-swift-frontend -scan-dependencies -module-name Test -module-cache-path %t/clang-module-cache %t/main.swift -o %t/deps.json -I %t/include -swift-version 4 -cache-compile-job -cas-path %t/cas
8-
// RUN: %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:DotDot > %t/DotDot.cmd
8+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:DotDot > %t/DotDot.cmd
99
// RUN: %swift_frontend_plain @%t/DotDot.cmd
1010

11-
// RUN: %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/SwiftShims.cmd
11+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json clang:SwiftShims > %t/SwiftShims.cmd
1212
// RUN: %swift_frontend_plain @%t/SwiftShims.cmd
1313

14-
// RUN: %S/Inputs/BuildCommandExtractor.py %t/deps.json Swift > %t/Swift.cmd
14+
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/deps.json Swift > %t/Swift.cmd
1515
// RUN: %swift_frontend_plain @%t/Swift.cmd
1616

1717
/// Test that if there are non-existing module-map file passed through -Xcc, this still compiles.

test/CAS/module_deps.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
// RUN: %FileCheck -check-prefix CHECK_CLANG_TARGET %s < %t/deps_clang_target.json
2727

2828
/// check cas-fs content
29-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json E casFSRootID > %t/E_fs.casid
29+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json E casFSRootID > %t/E_fs.casid
3030
// RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/E_fs.casid | %FileCheck %s -check-prefix FS_ROOT_E
31-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:F casFSRootID > %t/F_fs.casid
31+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:F casFSRootID > %t/F_fs.casid
3232
// RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/F_fs.casid | %FileCheck %s -check-prefix FS_ROOT_F
3333

3434
/// make sure the number of CASFS is correct. 10 entries with 2 line each + 1 extra bracket
35-
// RUN: NUM_CMDS=$(%S/Inputs/SwiftDepsExtractor.py %t/deps.json deps commandLine | wc -l)
35+
// RUN: NUM_CMDS=$(%{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json deps commandLine | wc -l)
3636
// RUN: if [ ! $NUM_CMDS -eq 21 ]; then echo "wrong number of CASFS from scanning"; exit 1; fi
3737

3838
// FS_ROOT_E-DAG: E.swiftinterface

test/CAS/module_deps_clang_extras.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
// RUN: -Xcc -I%t/empty.hmap
1313
// RUN: %validate-json %t/deps.json &>/dev/null
1414

15-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json deps casFSRootID > %t/fs.casid
15+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json deps casFSRootID > %t/fs.casid
1616
// RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/fs.casid | %FileCheck %s -DDIR=%basename_t -check-prefix FS_ROOT
17-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:Dummy clangIncludeTree > %t/tree.casid
17+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:Dummy clangIncludeTree > %t/tree.casid
1818
// RUN: clang-cas-test --cas %t/cas --print-include-tree @%t/tree.casid | %FileCheck %s -DDIR=%basename_t -check-prefix INCLUDE_TREE
1919

2020
// FS_ROOT: [[DIR]].tmp/empty.hmap

test/CAS/module_deps_include_tree.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
// RUN: %FileCheck -check-prefix CHECK_CLANG_TARGET %s < %t/deps_clang_target.json
2727

2828
/// check cas-fs content
29-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json E casFSRootID > %t/E_fs.casid
29+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json E casFSRootID > %t/E_fs.casid
3030
// RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/E_fs.casid | %FileCheck %s -check-prefix FS_ROOT_E
3131

32-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:F clangIncludeTree > %t/F_tree.casid
32+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:F clangIncludeTree > %t/F_tree.casid
3333
// RUN: clang-cas-test --cas %t/cas --print-include-tree @%t/F_tree.casid | %FileCheck %s -check-prefix INCLUDE_TREE_F
3434

3535
/// make sure the number of CASFS is correct. 10 entries with 2 line each + 1 extra bracket
36-
// RUN: NUM_CMDS=$(%S/Inputs/SwiftDepsExtractor.py %t/deps.json deps commandLine | wc -l)
36+
// RUN: NUM_CMDS=$(%{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json deps commandLine | wc -l)
3737
// RUN: if [ ! $NUM_CMDS -eq 21 ]; then echo "wrong number of CASFS from scanning"; exit 1; fi
3838

3939
// FS_ROOT_E-DAG: E.swiftinterface

test/CAS/module_path_remap.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,26 @@
99
// RUN: -import-objc-header %S/../ScanDependencies/Inputs/CHeaders/Bridging.h -swift-version 4 -cache-compile-job \
1010
// RUN: -cas-path %t/cas -scanner-prefix-map %swift_src_root=/^src -scanner-prefix-map %t=/^tmp
1111

12-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json deps casFSRootID > %t/deps.fs.casid
12+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json deps casFSRootID > %t/deps.fs.casid
1313
// RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/deps.fs.casid | %FileCheck %s -check-prefix DEPS-FS
1414
// DEPS-FS: /^src/test/CAS/module_path_remap.swift
1515

16-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json deps bridgingHeader | %FileCheck %s -check-prefix DEPS-BRIDGING
16+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json deps bridgingHeader | %FileCheck %s -check-prefix DEPS-BRIDGING
1717
// DEPS-BRIDGING: -fmodule-file=F=/^tmp/clang-module-cache/F-{{.*}}.pcm
1818

19-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json F casFSRootID > %t/F.fs.casid
19+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json F casFSRootID > %t/F.fs.casid
2020
// RUN: llvm-cas --cas %t/cas --ls-tree-recursive @%t/F.fs.casid | %FileCheck %s -check-prefix F-FS
2121
// F-FS: /^src/test/ScanDependencies/Inputs/Swift/F.swiftinterface
2222

23-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json F commandLine | %FileCheck %s -check-prefix F-CMD
23+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json F commandLine | %FileCheck %s -check-prefix F-CMD
2424
// F-CMD: /^src/test/ScanDependencies/Inputs/Swift/F.swiftinterface
2525
// F-CMD: -fmodule-file=SwiftShims=/^tmp/clang-module-cache/SwiftShims-{{.*}}.pcm
2626

27-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:F clangIncludeTree > %t/tree.casid
27+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:F clangIncludeTree > %t/tree.casid
2828
// RUN: clang-cas-test --cas %t/cas --print-include-tree @%t/tree.casid | %FileCheck %s -check-prefix TREE
2929
// TREE: /^src/test/CAS/../ScanDependencies/Inputs/CHeaders/F.h
3030

31-
// RUN: %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:F commandLine | %FileCheck %s -check-prefix CLANG-CMD
31+
// RUN: %{python} %S/Inputs/SwiftDepsExtractor.py %t/deps.json clang:F commandLine | %FileCheck %s -check-prefix CLANG-CMD
3232
// CLANG-CMD: /^src/test/ScanDependencies/Inputs/CHeaders/module.modulemap
3333

3434

0 commit comments

Comments
 (0)