diff --git a/llvm/docs/CommandGuide/lit.rst b/llvm/docs/CommandGuide/lit.rst index 70daae46170cd..613a9b5629ebf 100644 --- a/llvm/docs/CommandGuide/lit.rst +++ b/llvm/docs/CommandGuide/lit.rst @@ -346,6 +346,10 @@ The timing data is stored in the `test_exec_root` in a file named LIT_XFAIL="affinity/kmp-hw-subset.c;libomptarget :: x86_64-pc-linux-gnu :: offloading/memory_manager.cpp" +.. option:: --xfail-from-file PATH + + Read a line separated list of tests from a file to be used by :option:`--xfail`. + .. option:: --xfail-not LIST Do not treat the specified tests as ``XFAIL``. The environment variable @@ -356,6 +360,10 @@ The timing data is stored in the `test_exec_root` in a file named primary purpose is to suppress an ``XPASS`` result without modifying a test case that uses the ``XFAIL`` directive. +.. option:: --xfail-not-from-file PATH + + Read a line separated list of tests from a file to be used by :option:`--xfail-not`. + .. option:: --exclude-xfail ``XFAIL`` tests won't be run, unless they are listed in the ``--xfail-not`` diff --git a/llvm/utils/lit/lit/cl_arguments.py b/llvm/utils/lit/lit/cl_arguments.py index 8238bc42395af..28d7611896e98 100644 --- a/llvm/utils/lit/lit/cl_arguments.py +++ b/llvm/utils/lit/lit/cl_arguments.py @@ -309,6 +309,12 @@ def parse_args(): help="XFAIL tests with paths in the semicolon separated list", default=os.environ.get("LIT_XFAIL", ""), ) + selection_group.add_argument( + "--xfail-from-file", + metavar="PATH", + help="XFAIL tests with paths in the line separated list contained in " + "the specified file", + ) selection_group.add_argument( "--xfail-not", metavar="LIST", @@ -316,6 +322,12 @@ def parse_args(): help="do not XFAIL tests with paths in the semicolon separated list", default=os.environ.get("LIT_XFAIL_NOT", ""), ) + selection_group.add_argument( + "--xfail-not-from-file", + metavar="PATH", + help="do not XFAIL tests with paths in the line separated list " + "contained in the specified file", + ) selection_group.add_argument( "--exclude-xfail", help="exclude XFAIL tests (unless they are in the --xfail-not list). " @@ -396,6 +408,13 @@ def parse_args(): for report in opts.reports: report.use_unique_output_file_name = opts.use_unique_output_file_name + if opts.xfail_from_file: + with open(opts.xfail_from_file, "r", encoding="utf-8") as f: + opts.xfail.extend(f.read().splitlines()) + if opts.xfail_not_from_file: + with open(opts.xfail_not_from_file, "r", encoding="utf-8") as f: + opts.xfail_not.extend(f.read().splitlines()) + return opts diff --git a/llvm/utils/lit/tests/Inputs/xfail-cl/xfail-not.list b/llvm/utils/lit/tests/Inputs/xfail-cl/xfail-not.list new file mode 100644 index 0000000000000..24b776b870893 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/xfail-cl/xfail-not.list @@ -0,0 +1,2 @@ +true-xfail.txt +top-level-suite :: a :: test-xfail.txt diff --git a/llvm/utils/lit/tests/Inputs/xfail-cl/xfail.list b/llvm/utils/lit/tests/Inputs/xfail-cl/xfail.list new file mode 100644 index 0000000000000..251f6cdf9d3bd --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/xfail-cl/xfail.list @@ -0,0 +1,3 @@ +false.txt +false2.txt +top-level-suite :: b :: test.txt diff --git a/llvm/utils/lit/tests/xfail-cl.py b/llvm/utils/lit/tests/xfail-cl.py index f1e0e335e396f..9d7102bc2ec9b 100644 --- a/llvm/utils/lit/tests/xfail-cl.py +++ b/llvm/utils/lit/tests/xfail-cl.py @@ -16,6 +16,10 @@ # RUN: %{inputs}/xfail-cl \ # RUN: | FileCheck --check-prefixes=CHECK-EXCLUDED,CHECK-EXCLUDED-OVERRIDE %s +# RUN: %{lit} --xfail-from-file %{inputs}/xfail-cl/xfail.list \ +# RUN: --xfail-not-from-file %{inputs}/xfail-cl/xfail-not.list \ +# 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_XFAIL_NOT='true-xfail.txt;top-level-suite :: a :: test-xfail.txt' \