[PATCH] D65619: [lit] use built-in clear_environment instead of external env command

Bob Haarman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 16:31:48 PDT 2019


inglorion created this revision.
inglorion added reviewers: rnk, jdenny, amccarth.
Herald added a subscriber: delcypher.
Herald added a project: LLVM.

r366980 made lit invocations instead invoke env ...options... lit. This
invokes the external env command, which we generally avoid (as per
r242696).  This change replaces the env invocation by lit's built-in
clear_environment configuration functionality.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65619

Files:
  llvm/utils/lit/tests/lit.cfg


Index: llvm/utils/lit/tests/lit.cfg
===================================================================
--- llvm/utils/lit/tests/lit.cfg
+++ llvm/utils/lit/tests/lit.cfg
@@ -35,6 +35,13 @@
 else:
   lit_path = os.path.join(config.test_source_root, '..')
 
+# This test suite calls %{lit} to test lit's behavior for the sample test
+# suites in %{inputs}.  This test suite's results are then determined in part
+# by %{lit}'s textual output, which includes the output of FileCheck calls
+# within %{inputs}'s test suites.  Thus, %{lit} clears environment variables
+# that can affect FileCheck's output.
+llvm_config.clear_environment(['FILECHECK_OPTS', 'FILECHECK_DUMP_INPUT_ON_FAILURE'])
+
 # Required because some tests import the lit module
 llvm_config.with_environment('PYTHONPATH', lit_path, append_path=True)
 
@@ -44,16 +51,10 @@
     if directory:
         llvm_config.with_environment('PATH', directory, append_path=True)
 
-# This test suite calls %{lit} to test lit's behavior for the sample test
-# suites in %{inputs}.  This test suite's results are then determined in part
-# by %{lit}'s textual output, which includes the output of FileCheck calls
-# within %{inputs}'s test suites.  Thus, %{lit} clears environment variables
-# that can affect FileCheck's output.
 config.substitutions.append(('%{inputs}', os.path.join(
     config.test_source_root, 'Inputs')))
 config.substitutions.append(('%{lit}',
-    "{env} %{{python}} {lit}".format(
-        env="env FILECHECK_OPTS= FILECHECK_DUMP_INPUT_ON_FAILURE=",
+    "%{{python}} {lit}".format(
         lit=os.path.join(lit_path, 'lit.py'))))
 config.substitutions.append(('%{python}', '"%s"' % (sys.executable)))
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65619.212925.patch
Type: text/x-patch
Size: 1683 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190801/db207bfb/attachment.bin>


More information about the llvm-commits mailing list