lit: Improve error when gtest discovery fails.
authorDaniel Dunbar <daniel@zuster.org>
Tue, 15 Dec 2009 22:00:37 +0000 (22:00 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 15 Dec 2009 22:00:37 +0000 (22:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91458 91177308-0d34-0410-b5e6-96231b3b80d8

utils/lit/TestFormats.py

index 7305c794a2a2f7cc340ca13d2640833add25d9ed..5dfd54ac5ec06c06f2458624116cae05d5054cba 100644 (file)
@@ -9,12 +9,17 @@ class GoogleTest(object):
         self.test_sub_dir = str(test_sub_dir)
         self.test_suffix = str(test_suffix)
 
-    def getGTestTests(self, path):
+    def getGTestTests(self, path, litConfig):
         """getGTestTests(path) - [name]
         
         Return the tests available in gtest executable."""
 
-        lines = Util.capture([path, '--gtest_list_tests']).split('\n')
+        try:
+            lines = Util.capture([path, '--gtest_list_tests']).split('\n')
+        except:
+            litConfig.error("unable to discover google-tests in %r" % path)
+            raise StopIteration
+
         nested_tests = []
         for ln in lines:
             if not ln.strip():
@@ -47,7 +52,7 @@ class GoogleTest(object):
                     execpath = os.path.join(filepath, subfilename)
 
                     # Discover the tests in this executable.
-                    for name in self.getGTestTests(execpath):
+                    for name in self.getGTestTests(execpath, litConfig):
                         testPath = path_in_suite + (filename, subfilename, name)
                         yield Test.Test(testSuite, testPath, localConfig)