Index: lit/Suite/lldbtest.py =================================================================== --- lit/Suite/lldbtest.py +++ lit/Suite/lldbtest.py @@ -13,25 +13,24 @@ 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: @@ -40,11 +39,15 @@ 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(