summaryrefslogtreecommitdiffstats
path: root/llvm/utils
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-01-30 07:27:45 +0000
committerAlexey Samsonov <samsonov@google.com>2013-01-30 07:27:45 +0000
commitc865abe747aa72192f02ebfdcabe730f2553e42f (patch)
treede04e18276e155c0027dea5424be38dae4de964f /llvm/utils
parent396e4c0b139456e5b53908b6f87c5260436e4aab (diff)
downloadbcm5719-llvm-c865abe747aa72192f02ebfdcabe730f2553e42f.tar.gz
bcm5719-llvm-c865abe747aa72192f02ebfdcabe730f2553e42f.zip
[lit] Make GoogleTest test runner correctly discover tests in the source root
llvm-svn: 173907
Diffstat (limited to 'llvm/utils')
-rw-r--r--llvm/utils/lit/lit/TestFormats.py38
1 files changed, 23 insertions, 15 deletions
diff --git a/llvm/utils/lit/lit/TestFormats.py b/llvm/utils/lit/lit/TestFormats.py
index bc0af25df50..b0fa0a26874 100644
--- a/llvm/utils/lit/lit/TestFormats.py
+++ b/llvm/utils/lit/lit/TestFormats.py
@@ -54,28 +54,36 @@ class GoogleTest(object):
else:
yield ''.join(nested_tests) + ln
+ def getTestsInExecutable(self, testSuite, path_in_suite, execpath,
+ litConfig, localConfig):
+ if not execpath.endswith(self.test_suffix):
+ return
+ (dirname, basename) = os.path.split(execpath)
+ # Discover the tests in this executable.
+ for testname in self.getGTestTests(execpath, litConfig, localConfig):
+ testPath = path_in_suite + (dirname, basename, testname)
+ yield Test.Test(testSuite, testPath, localConfig)
+
def getTestsInDirectory(self, testSuite, path_in_suite,
litConfig, localConfig):
source_path = testSuite.getSourcePath(path_in_suite)
for filename in os.listdir(source_path):
- # Check for the one subdirectory (build directory) tests will be in.
- if not '.' in self.test_sub_dir:
+ filepath = os.path.join(source_path, filename)
+ if os.path.isdir(filepath):
+ # Iterate over executables in a directory.
if not os.path.normcase(filename) in self.test_sub_dir:
continue
-
- filepath = os.path.join(source_path, filename)
- if not os.path.isdir(filepath):
- continue
-
- for subfilename in os.listdir(filepath):
- if subfilename.endswith(self.test_suffix):
+ for subfilename in os.listdir(filepath):
execpath = os.path.join(filepath, subfilename)
-
- # Discover the tests in this executable.
- for name in self.getGTestTests(execpath, litConfig,
- localConfig):
- testPath = path_in_suite + (filename, subfilename, name)
- yield Test.Test(testSuite, testPath, localConfig)
+ for test in self.getTestsInExecutable(
+ testSuite, path_in_suite, execpath,
+ litConfig, localConfig):
+ yield test
+ elif ('.' in self.test_sub_dir):
+ for test in self.getTestsInExecutable(
+ testSuite, path_in_suite, filepath,
+ litConfig, localConfig):
+ yield test
def execute(self, test, litConfig):
testPath,testName = os.path.split(test.getSourcePath())
OpenPOWER on IntegriCloud