From 2381379d1d2a3a4ac447e82906bc989369865ad4 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Fri, 9 Apr 2010 02:15:10 +0000 Subject: lit: Add support to OneCommandPerFileTest format to take input directory from input path. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100846 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/lit/lit/TestFormats.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'utils/lit') diff --git a/utils/lit/lit/TestFormats.py b/utils/lit/lit/TestFormats.py index 7ab9bb6e45..5e1a811e6c 100644 --- a/utils/lit/lit/TestFormats.py +++ b/utils/lit/lit/TestFormats.py @@ -129,14 +129,20 @@ class OneCommandPerFileTest: self.command = [command] else: self.command = list(command) - self.dir = str(dir) + if dir is not None: + dir = str(dir) + self.dir = dir self.recursive = bool(recursive) self.pattern = re.compile(pattern) self.useTempInput = useTempInput def getTestsInDirectory(self, testSuite, path_in_suite, litConfig, localConfig): - for dirname,subdirs,filenames in os.walk(self.dir): + dir = self.dir + if dir is None: + dir = testSuite.getSourcePath(path_in_suite) + + for dirname,subdirs,filenames in os.walk(dir): if not self.recursive: subdirs[:] = [] @@ -151,7 +157,7 @@ class OneCommandPerFileTest: continue path = os.path.join(dirname,filename) - suffix = path[len(self.dir):] + suffix = path[len(dir):] if suffix.startswith(os.sep): suffix = suffix[1:] test = Test.Test(testSuite, -- cgit v1.2.3