[llvm] 21b40f0 - [lit][gtest] Support SKIPPED tests
Igor Kudrin via llvm-commits
llvm-commits at lists.llvm.org
Thu May 20 23:40:20 PDT 2021
Author: Igor Kudrin
Date: 2021-05-21T13:39:52+07:00
New Revision: 21b40f02d253be1b4b1e89c316c80ba6b6a7aa44
URL: https://github.com/llvm/llvm-project/commit/21b40f02d253be1b4b1e89c316c80ba6b6a7aa44
DIFF: https://github.com/llvm/llvm-project/commit/21b40f02d253be1b4b1e89c316c80ba6b6a7aa44.diff
LOG: [lit][gtest] Support SKIPPED tests
This updates the googletest format to support tests that use GTEST_SKIP(),
which is now available with the updated googletest framework.
Differential Revision: https://reviews.llvm.org/D102694
Added:
Modified:
llvm/utils/lit/lit/formats/googletest.py
llvm/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest.py
llvm/utils/lit/tests/googletest-format.py
Removed:
################################################################################
diff --git a/llvm/utils/lit/lit/formats/googletest.py b/llvm/utils/lit/lit/formats/googletest.py
index 0fe8a5148e57d..7651ab4a10b9c 100644
--- a/llvm/utils/lit/lit/formats/googletest.py
+++ b/llvm/utils/lit/lit/formats/googletest.py
@@ -135,6 +135,9 @@ def execute(self, test, litConfig):
if exitCode:
return lit.Test.FAIL, out + err
+ if '[ SKIPPED ] 1 test,' in out:
+ return lit.Test.SKIPPED, ''
+
passing_test_line = '[ PASSED ] 1 test.'
if passing_test_line not in out:
msg = ('Unable to find %r in gtest output:\n\n%s%s' %
diff --git a/llvm/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest.py b/llvm/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest.py
index dd49f025b1f2e..50d54567826bc 100644
--- a/llvm/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest.py
+++ b/llvm/utils/lit/tests/Inputs/googletest-format/DummySubDir/OneTest.py
@@ -10,6 +10,7 @@
FirstTest.
subTestA
subTestB
+ subTestC
ParameterizedTest/0.
subTest
ParameterizedTest/1.
@@ -27,6 +28,12 @@
print('I am subTest B, I FAIL')
print('And I have two lines of output')
sys.exit(1)
+elif test_name == 'FirstTest.subTestC':
+ print('I am subTest C, I am SKIPPED')
+ print('[ PASSED ] 0 tests.')
+ print('[ SKIPPED ] 1 test, listed below:')
+ print('[ SKIPPED ] FirstTest.subTestC')
+ sys.exit(0)
elif test_name in ('ParameterizedTest/0.subTest',
'ParameterizedTest/1.subTest'):
print('I am a parameterized test, I also PASS')
diff --git a/llvm/utils/lit/tests/googletest-format.py b/llvm/utils/lit/tests/googletest-format.py
index 09aa9dedabc3c..9740e498e2106 100644
--- a/llvm/utils/lit/tests/googletest-format.py
+++ b/llvm/utils/lit/tests/googletest-format.py
@@ -18,9 +18,10 @@
# CHECK-NEXT: I am subTest B, I FAIL
# CHECK-NEXT: And I have two lines of output
# CHECK: ***
+# CHECK: SKIPPED: googletest-format :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/FirstTest.subTestC
# CHECK: PASS: googletest-format :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/ParameterizedTest/0.subTest
# CHECK: PASS: googletest-format :: {{[Dd]ummy[Ss]ub[Dd]ir}}/OneTest.py/ParameterizedTest/1.subTest
# CHECK: Failed Tests (1)
-# CHECK: Passed: 3
-# CHECK: Failed: 1
-
+# CHECK: Skipped: 1
+# CHECK: Passed : 3
+# CHECK: Failed : 1
More information about the llvm-commits
mailing list