lit: Add support to OneCommandPerFileTest format to take input directory from input...
authorDaniel Dunbar <daniel@zuster.org>
Fri, 9 Apr 2010 02:15:10 +0000 (02:15 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 9 Apr 2010 02:15:10 +0000 (02:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100846 91177308-0d34-0410-b5e6-96231b3b80d8

utils/lit/lit/TestFormats.py

index 7ab9bb6e452eb7e481bc9274efc9a2f0fd722565..5e1a811e6c7728b2da2ec34bfe5679df473b813a 100644 (file)
@@ -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,