[llvm] [lldb][test] Mark gtest cases as XFAIL if the test is XFAIL (PR #102986)

Kendal Harland via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 17:05:28 PDT 2024


https://github.com/kendalharland created https://github.com/llvm/llvm-project/pull/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 make lit check whether each test case's parent test suite is XFAIL before setting the status to FAIL.

>From 81f68a7a8e6cda5f32817c2779a60045b28830f6 Mon Sep 17 00:00:00 2001
From: kendal <kendal at thebrowser.company>
Date: Mon, 12 Aug 2024 16:55:12 -0700
Subject: [PATCH] [lldb][test] Mark gtest cases as XFAIL if the test is XFAIL

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. This change checks whether
each test case's parent test suite is XFAIL before setting the status
to FAIL.
---
 llvm/utils/lit/lit/formats/googletest.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/utils/lit/lit/formats/googletest.py b/llvm/utils/lit/lit/formats/googletest.py
index 8037094a910678..6427354107daf5 100644
--- a/llvm/utils/lit/lit/formats/googletest.py
+++ b/llvm/utils/lit/lit/formats/googletest.py
@@ -334,7 +334,7 @@ def remove_gtest(tests):
                             returnCode = lit.Test.SKIPPED
                         elif "failures" in testinfo:
                             has_failure_in_shard = True
-                            returnCode = lit.Test.FAIL
+                            returnCode = lit.Test.XFAIL if test.isExpectedToFail() else lit.Test.FAIL
                             output = header
                             for fail in testinfo["failures"]:
                                 output += fail["failure"] + "\n"



More information about the llvm-commits mailing list