[llvm-commits] [llvm] r91458 - /llvm/trunk/utils/lit/TestFormats.py

Daniel Dunbar daniel at zuster.org
Tue Dec 15 14:00:37 PST 2009


Author: ddunbar
Date: Tue Dec 15 16:00:37 2009
New Revision: 91458

URL: http://llvm.org/viewvc/llvm-project?rev=91458&view=rev
Log:
lit: Improve error when gtest discovery fails.

Modified:
    llvm/trunk/utils/lit/TestFormats.py

Modified: llvm/trunk/utils/lit/TestFormats.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/TestFormats.py?rev=91458&r1=91457&r2=91458&view=diff

==============================================================================
--- llvm/trunk/utils/lit/TestFormats.py (original)
+++ llvm/trunk/utils/lit/TestFormats.py Tue Dec 15 16:00:37 2009
@@ -9,12 +9,17 @@
         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 @@
                     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)
 





More information about the llvm-commits mailing list