diff --git a/llvm/docs/CommandGuide/lit.rst b/llvm/docs/CommandGuide/lit.rst --- a/llvm/docs/CommandGuide/lit.rst +++ b/llvm/docs/CommandGuide/lit.rst @@ -239,6 +239,31 @@ this option, which is especially useful in environments where the call to ``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 ------------------ diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py --- a/llvm/utils/lit/lit/main.py +++ b/llvm/utils/lit/lit/main.py @@ -193,7 +193,9 @@ def mark_xfail(selected_tests, opts): 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 += '*' def mark_excluded(discovered_tests, selected_tests): diff --git a/llvm/utils/lit/tests/Inputs/xfail-cl/a/false.txt b/llvm/utils/lit/tests/Inputs/xfail-cl/a/false.txt new file mode 100644 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/xfail-cl/a/false.txt @@ -0,0 +1 @@ +# RUN: false diff --git a/llvm/utils/lit/tests/Inputs/xfail-cl/a/lit.cfg b/llvm/utils/lit/tests/Inputs/xfail-cl/a/lit.cfg new file mode 100644 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/xfail-cl/a/lit.cfg @@ -0,0 +1,4 @@ +import lit.formats +config.name = 'top-level-suite :: a' +config.suffixes = ['.txt'] +config.test_format = lit.formats.ShTest() diff --git a/llvm/utils/lit/tests/Inputs/xfail-cl/a/test.txt b/llvm/utils/lit/tests/Inputs/xfail-cl/a/test.txt new file mode 100644 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/xfail-cl/a/test.txt @@ -0,0 +1 @@ +# RUN: true diff --git a/llvm/utils/lit/tests/Inputs/xfail-cl/b/false.txt b/llvm/utils/lit/tests/Inputs/xfail-cl/b/false.txt new file mode 100644 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/xfail-cl/b/false.txt @@ -0,0 +1 @@ +# RUN: false diff --git a/llvm/utils/lit/tests/Inputs/xfail-cl/b/lit.cfg b/llvm/utils/lit/tests/Inputs/xfail-cl/b/lit.cfg new file mode 100644 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/xfail-cl/b/lit.cfg @@ -0,0 +1,4 @@ +import lit.formats +config.name = 'top-level-suite :: b' +config.suffixes = ['.txt'] +config.test_format = lit.formats.ShTest() diff --git a/llvm/utils/lit/tests/Inputs/xfail-cl/b/test.txt b/llvm/utils/lit/tests/Inputs/xfail-cl/b/test.txt new file mode 100644 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/xfail-cl/b/test.txt @@ -0,0 +1 @@ +# RUN: false diff --git a/llvm/utils/lit/tests/xfail-cl.py b/llvm/utils/lit/tests/xfail-cl.py --- a/llvm/utils/lit/tests/xfail-cl.py +++ b/llvm/utils/lit/tests/xfail-cl.py @@ -1,9 +1,20 @@ -# Check that regex-XFAILing works and can be configured via env var. -# -# RUN: %{lit} --xfail 'false.txt;false2.txt' %{inputs}/xfail-cl | FileCheck --check-prefix=CHECK-FILTER %s -# RUN: env LIT_XFAIL='false.txt;false2.txt' %{lit} %{inputs}/xfail-cl | FileCheck --check-prefix=CHECK-FILTER %s +# Check that XFAILing works via command line or env var. + +# RUN: %{lit} --xfail 'false.txt;false2.txt;top-level-suite :: b :: test.txt' \ +# 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. -# CHECK-FILTER: Testing: 3 tests, {{[1-3]}} workers -# 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 + +# CHECK-FILTER: Testing: 7 tests, {{[1-7]}} workers +# CHECK-FILTER-DAG: {{^}}PASS: top-level-suite :: a :: test.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