[PATCH] D133416: [lit] Test changes to make it work with bazel

Christian Sigg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 05:09:41 PDT 2022


csigg created this revision.
Herald added subscribers: sanjoy.google, delcypher.
Herald added a project: All.
csigg requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

These non-functional changes will make it easier to add the lit tests to the bazel build (see utils/bazel).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133416

Files:
  llvm/utils/lit/tests/Inputs/reorder/.lit_test_times.txt
  llvm/utils/lit/tests/Inputs/reorder/lit_test_times
  llvm/utils/lit/tests/lit.cfg
  llvm/utils/lit/tests/reorder.py


Index: llvm/utils/lit/tests/reorder.py
===================================================================
--- llvm/utils/lit/tests/reorder.py
+++ llvm/utils/lit/tests/reorder.py
@@ -1,11 +1,8 @@
 ## Check that we can reorder test runs.
 
-# RUN: cp %{inputs}/reorder/.lit_test_times.txt %{inputs}/reorder/.lit_test_times.txt.orig
+# RUN: cp %{inputs}/reorder/lit_test_times %{inputs}/reorder/.lit_test_times.txt
 # RUN: not %{lit-no-order-opt} %{inputs}/reorder > %t.out
-# RUN: cp %{inputs}/reorder/.lit_test_times.txt %{inputs}/reorder/.lit_test_times.txt.new
-# RUN: cp %{inputs}/reorder/.lit_test_times.txt.orig %{inputs}/reorder/.lit_test_times.txt
-# RUN: not diff %{inputs}/reorder/.lit_test_times.txt.new %{inputs}/reorder/.lit_test_times.txt.orig
-# RUN: FileCheck --check-prefix=TIMES --implicit-check-not= < %{inputs}/reorder/.lit_test_times.txt.new %s
+# RUN: FileCheck --check-prefix=TIMES < %{inputs}/reorder/.lit_test_times.txt %s
 # RUN: FileCheck < %t.out %s
 # END.
 
Index: llvm/utils/lit/tests/lit.cfg
===================================================================
--- llvm/utils/lit/tests/lit.cfg
+++ llvm/utils/lit/tests/lit.cfg
@@ -35,12 +35,13 @@
   lit_path = os.path.join(llvm_src_root, 'utils', 'lit')
 else:
   lit_path = os.path.join(config.test_source_root, '..')
+lit_path = os.path.abspath(lit_path)
 
 # Required because some tests import the lit module
 if llvm_config:
   llvm_config.with_environment('PYTHONPATH', lit_path, append_path=True)
 else:
-  config.environment['PYTHONPATH'] = os.pathsep.join([lit_path])
+  config.environment['PYTHONPATH'] = lit_path
 # Do not add user-site packages directory to the python search path. This avoids test failures if there's an
 # incompatible lit module installed inside the user-site packages directory, as it gets prioritized over the lit
 # from the PYTHONPATH.
@@ -60,8 +61,7 @@
 # that can affect FileCheck's output.  It also includes "--order=lexical -j1"
 # to ensure predictable test order, as it is often required for FileCheck
 # matches.
-config.substitutions.append(('%{inputs}', os.path.join(
-    config.test_source_root, 'Inputs')))
+config.substitutions.append(('%{inputs}', 'Inputs'))
 config.substitutions.append(('%{lit}', '%{lit-no-order-opt} --order=lexical'))
 config.substitutions.append(('%{lit-no-order-opt}',
     "{env} %{{python}} {lit} -j1".format(
Index: llvm/utils/lit/tests/Inputs/reorder/.lit_test_times.txt
===================================================================
--- /dev/null
+++ llvm/utils/lit/tests/Inputs/reorder/.lit_test_times.txt
@@ -1,5 +0,0 @@
-42.0 not-executed.txt
-3.0 subdir/ccc.txt
-2.0 bbb.txt
--0.2 fff.txt
-0.1 aaa.txt


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133416.458427.patch
Type: text/x-patch
Size: 2669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220907/9e18a2c1/attachment.bin>


More information about the llvm-commits mailing list