[lit] Extend --xfail/LIT_XFAIL to take full test name

The new documentation entry gives an example use case from
libomptarget.

Reviewed By: yln, jhenderson, davezarzycki

Differential Revision: https://reviews.llvm.org/D105208
This commit is contained in:
Joel E. Denny 2021-07-01 15:42:33 -04:00
parent 0516f49c08
commit 355bf7c1f0
9 changed files with 59 additions and 9 deletions

View File

@ -239,6 +239,31 @@ The timing data is stored in the `test_exec_root` in a file named
this option, which is especially useful in environments where the call to this option, which is especially useful in environments where the call to
``lit`` is issued indirectly. ``lit`` is issued indirectly.
A test name can specified as a file name relative to the test suite directory.
For example:
.. code-block:: none
LIT_XFAIL="affinity/kmp-hw-subset.c;offloading/memory_manager.cpp"
In this case, all of the following tests are treated as ``XFAIL``:
.. code-block:: none
libomp :: affinity/kmp-hw-subset.c
libomptarget :: nvptx64-nvidia-cuda :: offloading/memory_manager.cpp
libomptarget :: x86_64-pc-linux-gnu :: offloading/memory_manager.cpp
Alternatively, a test name can be specified as the full test name
reported in LIT output. For example, we can adjust the previous
example not to treat the ``nvptx64-nvidia-cuda`` version of
``offloading/memory_manager.cpp`` as XFAIL:
.. code-block:: none
LIT_XFAIL="affinity/kmp-hw-subset.c;libomptarget :: x86_64-pc-linux-gnu :: offloading/memory_manager.cpp"
ADDITIONAL OPTIONS ADDITIONAL OPTIONS
------------------ ------------------

View File

@ -193,7 +193,9 @@ def filter_by_shard(tests, run, shards, lit_config):
def mark_xfail(selected_tests, opts): def mark_xfail(selected_tests, opts):
for t in selected_tests: for t in selected_tests:
if os.sep.join(t.path_in_suite) in opts.xfail: test_file = os.sep.join(t.path_in_suite)
test_full_name = t.getFullName()
if test_file in opts.xfail or test_full_name in opts.xfail:
t.xfails += '*' t.xfails += '*'
def mark_excluded(discovered_tests, selected_tests): def mark_excluded(discovered_tests, selected_tests):

View File

@ -0,0 +1 @@
# RUN: false

View File

@ -0,0 +1,4 @@
import lit.formats
config.name = 'top-level-suite :: a'
config.suffixes = ['.txt']
config.test_format = lit.formats.ShTest()

View File

@ -0,0 +1 @@
# RUN: true

View File

@ -0,0 +1 @@
# RUN: false

View File

@ -0,0 +1,4 @@
import lit.formats
config.name = 'top-level-suite :: b'
config.suffixes = ['.txt']
config.test_format = lit.formats.ShTest()

View File

@ -0,0 +1 @@
# RUN: false

View File

@ -1,9 +1,20 @@
# Check that regex-XFAILing works and can be configured via env var. # Check that XFAILing works via command line or env var.
#
# RUN: %{lit} --xfail 'false.txt;false2.txt' %{inputs}/xfail-cl | FileCheck --check-prefix=CHECK-FILTER %s # RUN: %{lit} --xfail 'false.txt;false2.txt;top-level-suite :: b :: test.txt' \
# RUN: env LIT_XFAIL='false.txt;false2.txt' %{lit} %{inputs}/xfail-cl | FileCheck --check-prefix=CHECK-FILTER %s # RUN: %{inputs}/xfail-cl \
# RUN: | FileCheck --check-prefix=CHECK-FILTER %s
# RUN: env LIT_XFAIL='false.txt;false2.txt;top-level-suite :: b :: test.txt' \
# RUN: %{lit} %{inputs}/xfail-cl \
# RUN: | FileCheck --check-prefix=CHECK-FILTER %s
# END. # END.
# CHECK-FILTER: Testing: 3 tests, {{[1-3]}} workers
# CHECK-FILTER-DAG: XFAIL: top-level-suite :: false.txt # CHECK-FILTER: Testing: 7 tests, {{[1-7]}} workers
# CHECK-FILTER-DAG: XFAIL: top-level-suite :: false2.txt # CHECK-FILTER-DAG: {{^}}PASS: top-level-suite :: a :: test.txt
# CHECK-FILTER-DAG: PASS: top-level-suite :: true.txt # CHECK-FILTER-DAG: {{^}}XFAIL: top-level-suite :: b :: test.txt
# CHECK-FILTER-DAG: {{^}}XFAIL: top-level-suite :: a :: false.txt
# CHECK-FILTER-DAG: {{^}}XFAIL: top-level-suite :: b :: false.txt
# CHECK-FILTER-DAG: {{^}}XFAIL: top-level-suite :: false.txt
# CHECK-FILTER-DAG: {{^}}XFAIL: top-level-suite :: false2.txt
# CHECK-FILTER-DAG: {{^}}PASS: top-level-suite :: true.txt