[PATCH] D101995: [lit] Allow specification of LLD variant paths via environment variable
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 7 00:56:40 PDT 2021
jhenderson updated this revision to Diff 343599.
jhenderson added a comment.
Fix diff. I'm going to hold off landing this for now until the discussion on the mailing list (https://lists.llvm.org/pipermail/llvm-dev/2021-May/150428.html) has reached a conclusion.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101995/new/
https://reviews.llvm.org/D101995
Files:
llvm/utils/lit/lit/llvm/config.py
llvm/utils/lit/tests/Inputs/lld-search-env/lit.cfg
llvm/utils/lit/tests/Inputs/lld-search-env/tool1
llvm/utils/lit/tests/Inputs/lld-search-env/tool2
llvm/utils/lit/tests/Inputs/lld-search-env/tool3
llvm/utils/lit/tests/Inputs/lld-search-env/tool4
llvm/utils/lit/tests/Inputs/lld-search-env/true.txt
llvm/utils/lit/tests/lld-search-env.py
Index: llvm/utils/lit/tests/lld-search-env.py
===================================================================
--- /dev/null
+++ llvm/utils/lit/tests/lld-search-env.py
@@ -0,0 +1,8 @@
+## Show that lit uses a set of environment variables to locate the LLD variants.
+
+# RUN: %{lit} %{inputs}/lld-search-env 2>&1 | FileCheck %s -DDIR=%p
+
+# CHECK: note: using ld.lld: [[DIR]]{{[\\/]}}Inputs{{[\\/]}}lld-search-env{{[\\/]}}tool1
+# CHECK: note: using lld-link: [[DIR]]{{[\\/]}}Inputs{{[\\/]}}lld-search-env{{[\\/]}}tool2
+# CHECK: note: using ld64.lld: [[DIR]]{{[\\/]}}Inputs{{[\\/]}}lld-search-env{{[\\/]}}tool3
+# CHECK: note: using wasm-ld: [[DIR]]{{[\\/]}}Inputs{{[\\/]}}lld-search-env{{[\\/]}}tool4
Index: llvm/utils/lit/tests/Inputs/lld-search-env/true.txt
===================================================================
--- /dev/null
+++ llvm/utils/lit/tests/Inputs/lld-search-env/true.txt
@@ -0,0 +1 @@
+# RUN: true
Index: llvm/utils/lit/tests/Inputs/lld-search-env/lit.cfg
===================================================================
--- /dev/null
+++ llvm/utils/lit/tests/Inputs/lld-search-env/lit.cfg
@@ -0,0 +1,16 @@
+import lit.formats
+config.name = 'search-env'
+config.suffixes = ['.txt']
+config.test_format = lit.formats.ShTest()
+config.test_source_root = None
+config.test_exec_root = None
+config.llvm_tools_dir = ''
+import lit.llvm
+lit.llvm.initialize(lit_config, config)
+import os.path
+curdir = os.path.dirname(__file__)
+lit.llvm.llvm_config.with_environment('LDLLD', os.path.join(curdir, 'tool1'))
+lit.llvm.llvm_config.with_environment('LLDLINK', os.path.join(curdir, 'tool2'))
+lit.llvm.llvm_config.with_environment('LD64LLD', os.path.join(curdir, 'tool3'))
+lit.llvm.llvm_config.with_environment('WASMLD', os.path.join(curdir, 'tool4'))
+lit.llvm.llvm_config.use_lld()
Index: llvm/utils/lit/lit/llvm/config.py
===================================================================
--- llvm/utils/lit/lit/llvm/config.py
+++ llvm/utils/lit/lit/llvm/config.py
@@ -595,10 +595,10 @@
# Discover the 'clang' and 'clangcc' to use.
- ld_lld = self.use_llvm_tool('ld.lld', required=required)
- lld_link = self.use_llvm_tool('lld-link', required=required)
- ld64_lld = self.use_llvm_tool('ld64.lld', required=required)
- wasm_ld = self.use_llvm_tool('wasm-ld', required=required)
+ ld_lld = self.use_llvm_tool('ld.lld', search_env='LDLLD', required=required)
+ lld_link = self.use_llvm_tool('lld-link', search_env='LLDLINK', required=required)
+ ld64_lld = self.use_llvm_tool('ld64.lld', search_env='LD64LLD', required=required)
+ wasm_ld = self.use_llvm_tool('wasm-ld', search_env='WASMLD', required=required)
was_found = ld_lld and lld_link and ld64_lld and wasm_ld
tool_substitutions = []
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101995.343599.patch
Type: text/x-patch
Size: 2814 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210507/81d20a31/attachment.bin>
More information about the llvm-commits
mailing list