Skip to content

Commit 6253a0d

Browse files
authored
Merge pull request #85900 from compnerd/library-binning
test: adjust the path compuation for plugins
2 parents 5634d99 + 528cca0 commit 6253a0d

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

test/CAS/cache_key_compute.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@
5858
/// Test plugin CAS.
5959
// RUN: %target-swift-frontend -scan-dependencies -module-name Test -O \
6060
// 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-plugin -cas-plugin-path %llvm_libs_dir/libCASPluginTest%llvm_plugin_ext \
61+
// RUN: %t/a.swift -o %t/plugin_deps.json -cache-compile-job -cas-path %t/cas-plugin -cas-plugin-path %plugin(CASPluginTest) \
6262
// RUN: -cas-plugin-option first-prefix=myfirst-
6363

6464
// RUN: %{python} %S/Inputs/GenerateExplicitModuleMap.py %t/plugin_deps.json > %t/plugin_map.json
6565
// RUN: llvm-cas --cas %t/cas --make-blob --data %t/plugin_map.json > %t/map.casid
6666

6767
// RUN: %{python} %S/Inputs/BuildCommandExtractor.py %t/plugin_deps.json Test > %t/plugin_MyApp.cmd
68-
// RUN: %cache-tool -cas-path %t/cas-plugin -cas-plugin-path %llvm_libs_dir/libCASPluginTest%llvm_plugin_ext \
68+
// RUN: %cache-tool -cas-path %t/cas-plugin -cas-plugin-path %plugin(CASPluginTest) \
6969
// RUN: -cas-plugin-option first-prefix=myfirst- -cache-tool-action print-output-keys -- \
7070
// RUN: %target-swift-frontend -cache-compile-job %t/a.swift -emit-module -c -emit-dependencies \
7171
// RUN: -disable-implicit-string-processing-module-import -disable-implicit-concurrency-module-import -parse-stdlib \
@@ -77,9 +77,9 @@
7777
// RUN: echo "\"-parse-stdlib\"" >> %t/MyApp-plugin.cmd
7878

7979
/// Check switching CAS plugin path.
80-
// RUN: %cache-tool -cas-path %t/cas-plugin -cas-plugin-path %llvm_libs_dir/libCASPluginTest%llvm_plugin_ext -cas-plugin-option first-prefix=myfirst- -cache-tool-action print-base-key -- \
81-
// RUN: %target-swift-frontend -cache-compile-job %t/a.swift -c @%t/MyApp-plugin.cmd -cas-path %t/cas-plugin -cas-plugin-path %llvm_libs_dir/libCASPluginTest%llvm_plugin_ext > %t8.casid
82-
// RUN: ln -s %llvm_libs_dir/libCASPluginTest%llvm_plugin_ext %t/libCASPluginTest%llvm_plugin_ext
80+
// RUN: %cache-tool -cas-path %t/cas-plugin -cas-plugin-path %plugin(CASPluginTest) -cas-plugin-option first-prefix=myfirst- -cache-tool-action print-base-key -- \
81+
// RUN: %target-swift-frontend -cache-compile-job %t/a.swift -c @%t/MyApp-plugin.cmd -cas-path %t/cas-plugin -cas-plugin-path %plugin(CASPluginTest) > %t8.casid
82+
// RUN: cp %plugin(CASPluginTest) %t/libCASPluginTest%llvm_plugin_ext
8383
// RUN: %cache-tool -cas-path %t/cas-plugin -cas-plugin-path %t/libCASPluginTest%llvm_plugin_ext -cas-plugin-option first-prefix=myfirst- -cache-tool-action print-base-key -- \
8484
// RUN: %target-swift-frontend -cache-compile-job %t/a.swift -c @%t/MyApp-plugin.cmd -cas-path %t/cas-plugin -cas-plugin-path %t/libCASPluginTest%llvm_plugin_ext > %t9.casid
8585
// RUN: diff %t8.casid %t9.casid

test/CAS/lit.local.cfg

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
# FIXME: CAS file system doesn't support windows. Unsupported for now.
1+
# Make a local copy of the substitutions.
2+
config.substitutions = list(config.substitutions)
3+
4+
def get_target_os():
5+
import re
6+
(run_cpu, run_vendor, run_os, run_version) = re.match('([^-]+)-([^-]+)-([^0-9]+)(.*)', config.variant_triple).groups()
7+
return run_os
8+
9+
import os
10+
11+
if get_target_os() in ('windows-msvc',):
12+
config.substitutions.insert(0, (r'%plugin\(([^)]+)\)', SubstituteCaptures(os.path.join(config.llvm_tools_dir, r'%target-library-name(\1)'))))
13+
else:
14+
config.substitutions.insert(0, (r'%plugin\(([^)]+)\)', SubstituteCaptures(os.path.join(config.llvm_libs_dir, r'%target-library-name(\1)'))))
15+
216
import platform
317
if platform.system() == 'Windows':
418
config.unsupported = True

0 commit comments

Comments
 (0)