Support GoogleTest's "typed tests"
authorJeffrey Yasskin <jyasskin@google.com>
Sun, 18 Oct 2009 02:05:42 +0000 (02:05 +0000)
committerJeffrey Yasskin <jyasskin@google.com>
Sun, 18 Oct 2009 02:05:42 +0000 (02:05 +0000)
(http://code.google.com/p/googletest/wiki/GoogleTestAdvancedGuide#Typed_Tests)
in lit.py.  These tests have names like "ValueMapTest/0.Iteration", which broke
when lit.py os.path.join()ed them onto the path and then assumed it could
os.path.split() them back off.  This patch shifts path components from the
testPath to the testName until the testPath exists.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84387 91177308-0d34-0410-b5e6-96231b3b80d8

utils/lit/TestFormats.py

index 61bdb185355f48ea56941e0ceee9e08cbd0404ca..7e638b47f4d86c381209aa5b9a43b90ef9c4644e 100644 (file)
@@ -53,6 +53,10 @@ class GoogleTest(object):
 
     def execute(self, test, litConfig):
         testPath,testName = os.path.split(test.getSourcePath())
+        if not os.path.exists(testPath):
+            # Handle GTest typed tests, whose name includes a '/'.
+            testPath, namePrefix = os.path.split(testPath)
+            testName = os.path.join(namePrefix, testName)
 
         cmd = [testPath, '--gtest_filter=' + testName]
         out, err, exitCode = TestRunner.executeCommand(cmd)