Index: llvm/utils/lit/lit/cl_arguments.py =================================================================== --- llvm/utils/lit/lit/cl_arguments.py +++ llvm/utils/lit/lit/cl_arguments.py @@ -130,6 +130,10 @@ execution_group.add_argument("--allow-empty-runs", help="Do not fail the run if all tests are filtered out", action="store_true") + execution_group.add_argument("--ignore-fail", + dest="ignoreFail", + action="store_true", + help="Exit with status zero even if some tests fail") execution_group.add_argument("--no-indirectly-run-check", dest="indirectlyRunCheck", help="Do not error if a test would not be run if the user had " Index: llvm/utils/lit/lit/main.py =================================================================== --- llvm/utils/lit/lit/main.py +++ llvm/utils/lit/lit/main.py @@ -118,8 +118,11 @@ has_failure = any(t.isFailure() for t in discovered_tests) if has_failure: - sys.exit(1) - + if opts.ignoreFail: + sys.stderr.write("\nExiting with status 0 instead of 1 because " + "'--ignore-fail' was specified.\n") + else: + sys.exit(1) def create_params(builtin_params, user_params): def parse(p): Index: llvm/utils/lit/tests/Inputs/ignore-fail/fail.txt =================================================================== --- /dev/null +++ llvm/utils/lit/tests/Inputs/ignore-fail/fail.txt @@ -0,0 +1 @@ +RUN: false Index: llvm/utils/lit/tests/Inputs/ignore-fail/lit.cfg =================================================================== --- /dev/null +++ llvm/utils/lit/tests/Inputs/ignore-fail/lit.cfg @@ -0,0 +1,6 @@ +import lit.formats +config.name = 'ignore-fail' +config.suffixes = ['.txt'] +config.test_format = lit.formats.ShTest() +config.test_source_root = None +config.test_exec_root = None Index: llvm/utils/lit/tests/Inputs/ignore-fail/xfail.txt =================================================================== --- /dev/null +++ llvm/utils/lit/tests/Inputs/ignore-fail/xfail.txt @@ -0,0 +1,2 @@ +RUN: false +XFAIL: * Index: llvm/utils/lit/tests/Inputs/ignore-fail/xpass.txt =================================================================== --- /dev/null +++ llvm/utils/lit/tests/Inputs/ignore-fail/xpass.txt @@ -0,0 +1,2 @@ +RUN: true +XFAIL: * Index: llvm/utils/lit/tests/ignore-fail.py =================================================================== --- /dev/null +++ llvm/utils/lit/tests/ignore-fail.py @@ -0,0 +1,19 @@ +# Check that --ignore-fail produces exit status 0 despite various kinds of +# test failures but doesn't otherwise suppress those failures. + +# RUN: not %{lit} -j 1 %{inputs}/ignore-fail | FileCheck %s +# RUN: %{lit} -j 1 --ignore-fail %{inputs}/ignore-fail | FileCheck %s + +# END. + +# CHECK: FAIL: ignore-fail :: fail.txt +# CHECK: UNRESOLVED: ignore-fail :: unresolved.txt +# CHECK: XFAIL: ignore-fail :: xfail.txt +# CHECK: XPASS: ignore-fail :: xpass.txt + +# CHECK: Testing Time: +# CHECK-NEXT: Expectedly Failed : 1 +# CHECK-NEXT: Unresolved : 1 +# CHECK-NEXT: Failed : 1 +# CHECK-NEXT: Unexpectedly Passed: 1 +# CHECK-NOT: {{.}}