[Lldb-commits] [PATCH] D47265: WIP: lit: Run each test separately

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 5 04:28:05 PDT 2018


labath updated this revision to Diff 149936.
labath added a comment.

No real change in functionality, just updating the diff to remove the unrelated
changes.


https://reviews.llvm.org/D47265

Files:
  lit/Suite/lldbtest.py


Index: lit/Suite/lldbtest.py
===================================================================
--- lit/Suite/lldbtest.py
+++ lit/Suite/lldbtest.py
@@ -13,38 +13,41 @@
 class LLDBTest(TestFormat):
     def __init__(self, dotest_cmd):
         self.dotest_cmd = dotest_cmd
+        self.tests = None
+
+    def getTests(self, bin_dir):
+        if self.tests:
+            return self.tests
+        dumper = os.path.join(os.path.dirname(__file__), "lldbtestdumper.py")
+        lldb_path = os.path.join(bin_dir, "lldb")
+        output = subprocess.check_output([sys.executable, dumper, lldb_path])
+        self.tests = [line.split() for line in output.splitlines()]
+        return self.tests
+
 
     def getTestsInDirectory(self, testSuite, path_in_suite, litConfig,
                             localConfig):
-        source_path = testSuite.getSourcePath(path_in_suite)
-        for filename in os.listdir(source_path):
-            # Ignore dot files and excluded tests.
-            if (filename.startswith('.') or filename in localConfig.excludes):
-                continue
-
-            # Ignore files that don't start with 'Test'.
-            if not filename.startswith('Test'):
+        for test in self.getTests(testSuite.config.llvm_tools_dir):
+            if test[0:-3] != list(path_in_suite):
                 continue
-
-            filepath = os.path.join(source_path, filename)
-            if not os.path.isdir(filepath):
-                base, ext = os.path.splitext(filename)
-                if ext in localConfig.suffixes:
-                    yield lit.Test.Test(testSuite, path_in_suite +
-                                        (filename, ), localConfig)
+            yield lit.Test.Test(testSuite, test, localConfig)
 
     def execute(self, test, litConfig):
         if litConfig.noExecute:
             return lit.Test.PASS, ''
 
         if test.config.unsupported:
             return (lit.Test.UNSUPPORTED, 'Test is unsupported')
 
-        testPath, testFile = os.path.split(test.getSourcePath())
+        testDir = test.getSourcePath()
+        testDir, testMethod = os.path.split(testDir)
+        testDir, testClass = os.path.split(testDir)
+        testDir, testFile = os.path.split(testDir)
+
         # On Windows, the system does not always correctly interpret shebang lines.
         # To make sure we can execute the tests, add python exe as the first parameter
         # of the command.
-        cmd = [sys.executable] + self.dotest_cmd + [testPath, '-p', testFile]
+        cmd = [sys.executable] + self.dotest_cmd + [testDir, '-p', testFile, '-f', testClass+"."+testMethod]
 
         try:
             out, err, exitCode = lit.util.executeCommand(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47265.149936.patch
Type: text/x-patch
Size: 2703 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180605/436e12d4/attachment-0001.bin>


More information about the lldb-commits mailing list