[llvm] 1dbcb79 - [lit] Test changes to make it work with bazel

Christian Sigg via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 8 05:52:23 PDT 2022


Author: Christian Sigg
Date: 2022-09-08T14:52:08+02:00
New Revision: 1dbcb79498d0db465234c68adf52b88e7f87a832

URL: https://github.com/llvm/llvm-project/commit/1dbcb79498d0db465234c68adf52b88e7f87a832
DIFF: https://github.com/llvm/llvm-project/commit/1dbcb79498d0db465234c68adf52b88e7f87a832.diff

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

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

Reviewed By: bkramer

Differential Revision: https://reviews.llvm.org/D133416

Added: 
    llvm/utils/lit/tests/Inputs/reorder/lit_test_times

Modified: 
    llvm/utils/lit/tests/lit.cfg
    llvm/utils/lit/tests/reorder.py
    mlir/test/lit.cfg.py

Removed: 
    llvm/utils/lit/tests/Inputs/reorder/.lit_test_times.txt


################################################################################
diff  --git a/llvm/utils/lit/tests/Inputs/reorder/.lit_test_times.txt b/llvm/utils/lit/tests/Inputs/reorder/lit_test_times
similarity index 100%
rename from llvm/utils/lit/tests/Inputs/reorder/.lit_test_times.txt
rename to llvm/utils/lit/tests/Inputs/reorder/lit_test_times

diff  --git a/llvm/utils/lit/tests/lit.cfg b/llvm/utils/lit/tests/lit.cfg
index fa11e8f9643a6..b9a846ac4784d 100644
--- a/llvm/utils/lit/tests/lit.cfg
+++ b/llvm/utils/lit/tests/lit.cfg
@@ -35,12 +35,13 @@ if llvm_src_root:
   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 @@ for attribute in ('llvm_tools_dir', 'lit_tools_dir'):
 # 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(

diff  --git a/llvm/utils/lit/tests/reorder.py b/llvm/utils/lit/tests/reorder.py
index b4d7beb6e54ee..8ebeac393d557 100644
--- a/llvm/utils/lit/tests/reorder.py
+++ b/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.
 

diff  --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py
index 4bfe1b040fbb4..9c530d8e7cbeb 100644
--- a/mlir/test/lit.cfg.py
+++ b/mlir/test/lit.cfg.py
@@ -66,7 +66,9 @@
     'mlir-cpu-runner',
     'mlir-linalg-ods-yaml-gen',
     'mlir-reduce',
+    'mlir-spirv-cpu-runner',
     'mlir-pdll',
+    'not',
 ]
 
 # The following tools are optional


        


More information about the llvm-commits mailing list