[PATCH] D80096: [lit] GoogleTest framework should report failures if test binary crashes
Stephen Neuendorffer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 20 13:44:44 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGef2103182244: [lit] GoogleTest framework should report failures if test binary crashes (authored by stephenneuendorffer).
Changed prior to commit:
https://reviews.llvm.org/D80096?vs=265334&id=265338#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80096/new/
https://reviews.llvm.org/D80096
Files:
llvm/utils/lit/lit/formats/googletest.py
llvm/utils/lit/tests/Inputs/googletest-discovery-failed/lit.cfg
llvm/utils/lit/tests/Inputs/googletest-discovery-failed/subdir/OneTest.py
llvm/utils/lit/tests/googletest-discovery-failed.py
Index: llvm/utils/lit/tests/googletest-discovery-failed.py
===================================================================
--- /dev/null
+++ llvm/utils/lit/tests/googletest-discovery-failed.py
@@ -0,0 +1,10 @@
+# Check for correct error message when discovery of tests fails.
+#
+# RUN: not %{lit} -j 1 -v %{inputs}/googletest-discovery-failed > %t.cmd.out
+# RUN: FileCheck < %t.cmd.out %s
+
+
+# CHECK: -- Testing:
+# CHECK: Failing Tests (1):
+# CHECK: googletest-discovery-failed :: subdir/OneTest.py/failed_to_discover_tests_from_gtest
+# CHECK: Unexpected Failures: 1
Index: llvm/utils/lit/tests/Inputs/googletest-discovery-failed/subdir/OneTest.py
===================================================================
--- /dev/null
+++ llvm/utils/lit/tests/Inputs/googletest-discovery-failed/subdir/OneTest.py
@@ -0,0 +1,3 @@
+#!/usr/bin/env python
+
+raise SystemExit("We are not a valid gtest executable!")
Index: llvm/utils/lit/tests/Inputs/googletest-discovery-failed/lit.cfg
===================================================================
--- /dev/null
+++ llvm/utils/lit/tests/Inputs/googletest-discovery-failed/lit.cfg
@@ -0,0 +1,3 @@
+import lit.formats
+config.name = 'googletest-discovery-failed'
+config.test_format = lit.formats.GoogleTest('subdir', 'Test')
Index: llvm/utils/lit/lit/formats/googletest.py
===================================================================
--- llvm/utils/lit/lit/formats/googletest.py
+++ llvm/utils/lit/lit/formats/googletest.py
@@ -41,6 +41,14 @@
litConfig.warning(
"unable to discover google-tests in %r: %s. Process output: %s"
% (path, sys.exc_info()[1], exc.output))
+ # This doesn't look like a valid gtest file. This can
+ # have a number of causes, none of them good. For
+ # instance, we could have created a broken executable.
+ # Alternatively, someone has cruft in their test
+ # directory. If we don't return a test here, then no
+ # failures will get reported, so return a dummy test name
+ # so that the failure is reported later.
+ yield 'failed_to_discover_tests_from_gtest'
return
nested_tests = []
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80096.265338.patch
Type: text/x-patch
Size: 2241 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200520/e8ec83a8/attachment.bin>
More information about the llvm-commits
mailing list