Skip to content

Commit 9f89d31

Browse files
kendalharlandkendal
andauthored
[lldb][test] Mark gtest cases as XFAIL if the test suite is XFAIL (#102986)
When a test case inside of a gtest suite fails, we report a failure which causes the entire `ninja check-lldb` invocation to fail, even if the outer test case is marked as XFAIL - each test case result is reported as its own lit test run. This PR updates lit so it checks whether each test case's parent test suite is XFAIL before setting the status to FAIL. This is especially problematic because the failing tests can't manually be marked as XFAIL, due to #102264. Fixes #102265 ### Repro instructions 1. Modify any gtest test case to generate a failure. 2. Mark the outer lit test with XFAIL using either `--xfail-tests` flag or `LIT_XFAIL` env var. 3. Run the tests 4. Observe the lit test is XFAIL as expected, but the failed child test cases show up as separate failures. Co-authored-by: kendal <[email protected]>
1 parent b816977 commit 9f89d31

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

llvm/utils/lit/lit/formats/googletest.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,11 @@ def remove_gtest(tests):
334334
returnCode = lit.Test.SKIPPED
335335
elif "failures" in testinfo:
336336
has_failure_in_shard = True
337-
returnCode = lit.Test.FAIL
337+
returnCode = (
338+
lit.Test.XFAIL
339+
if test.isExpectedToFail()
340+
else lit.Test.FAIL
341+
)
338342
output = header
339343
for fail in testinfo["failures"]:
340344
output += fail["failure"] + "\n"

0 commit comments

Comments
 (0)