[PATCH] D100043: [lit] Fix compatibility with upstream gtest

Lukáš Zaoral via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 7 09:04:11 PDT 2021


lzaoral created this revision.
Herald added a subscriber: delcypher.
lzaoral requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Upstream gtest now prints 'Running main() from __FILE__' instead of
plain 'Running main() from gtest_main.cc'. Thus, all such tests
ended-up being mistakenly marked as UNRESOLVED.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100043

Files:
  llvm/utils/lit/lit/formats/googletest.py
  llvm/utils/lit/tests/Inputs/googletest-upstream-format/DummySubDir/OneTest.py


Index: llvm/utils/lit/tests/Inputs/googletest-upstream-format/DummySubDir/OneTest.py
===================================================================
--- llvm/utils/lit/tests/Inputs/googletest-upstream-format/DummySubDir/OneTest.py
+++ llvm/utils/lit/tests/Inputs/googletest-upstream-format/DummySubDir/OneTest.py
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
 
+import os
 import sys
 
 if len(sys.argv) != 2:
@@ -7,14 +8,14 @@
 
 if sys.argv[1] == "--gtest_list_tests":
     print("""\
-Running main() from gtest_main.cc
+Running main() from %s/gtest_main.cc
 FirstTest.
   subTestA
   subTestB
 ParameterizedTest/0.
   subTest
 ParameterizedTest/1.
-  subTest""")
+  subTest""" % os.getcwd())
     sys.exit(0)
 elif not sys.argv[1].startswith("--gtest_filter="):
     raise ValueError("unexpected argument: %r" % (sys.argv[1]))
Index: llvm/utils/lit/lit/formats/googletest.py
===================================================================
--- llvm/utils/lit/lit/formats/googletest.py
+++ llvm/utils/lit/lit/formats/googletest.py
@@ -55,7 +55,7 @@
         for ln in output.splitlines(False):  # Don't keep newlines.
             ln = lit.util.to_string(ln)
 
-            if 'Running main() from gtest_main.cc' in ln:
+            if 'Running main() from ' in ln:
                 # Upstream googletest prints this to stdout prior to running
                 # tests. LLVM removed that print statement in r61540, but we
                 # handle it here in case upstream googletest is being used.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100043.335831.patch
Type: text/x-patch
Size: 1501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210407/1285939a/attachment.bin>


More information about the llvm-commits mailing list