mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-04 18:38:05 +00:00
[lit] Make GoogleTest test runner correctly discover tests in the source root
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173907 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
254aed5e22
commit
f68cd7543d
@ -54,28 +54,36 @@ class GoogleTest(object):
|
|||||||
else:
|
else:
|
||||||
yield ''.join(nested_tests) + ln
|
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,
|
def getTestsInDirectory(self, testSuite, path_in_suite,
|
||||||
litConfig, localConfig):
|
litConfig, localConfig):
|
||||||
source_path = testSuite.getSourcePath(path_in_suite)
|
source_path = testSuite.getSourcePath(path_in_suite)
|
||||||
for filename in os.listdir(source_path):
|
for filename in os.listdir(source_path):
|
||||||
# Check for the one subdirectory (build directory) tests will be in.
|
filepath = os.path.join(source_path, filename)
|
||||||
if not '.' in self.test_sub_dir:
|
if os.path.isdir(filepath):
|
||||||
|
# Iterate over executables in a directory.
|
||||||
if not os.path.normcase(filename) in self.test_sub_dir:
|
if not os.path.normcase(filename) in self.test_sub_dir:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
filepath = os.path.join(source_path, filename)
|
|
||||||
if not os.path.isdir(filepath):
|
|
||||||
continue
|
|
||||||
|
|
||||||
for subfilename in os.listdir(filepath):
|
for subfilename in os.listdir(filepath):
|
||||||
if subfilename.endswith(self.test_suffix):
|
|
||||||
execpath = os.path.join(filepath, subfilename)
|
execpath = os.path.join(filepath, subfilename)
|
||||||
|
for test in self.getTestsInExecutable(
|
||||||
# Discover the tests in this executable.
|
testSuite, path_in_suite, execpath,
|
||||||
for name in self.getGTestTests(execpath, litConfig,
|
litConfig, localConfig):
|
||||||
localConfig):
|
yield test
|
||||||
testPath = path_in_suite + (filename, subfilename, name)
|
elif ('.' in self.test_sub_dir):
|
||||||
yield Test.Test(testSuite, testPath, localConfig)
|
for test in self.getTestsInExecutable(
|
||||||
|
testSuite, path_in_suite, filepath,
|
||||||
|
litConfig, localConfig):
|
||||||
|
yield test
|
||||||
|
|
||||||
def execute(self, test, litConfig):
|
def execute(self, test, litConfig):
|
||||||
testPath,testName = os.path.split(test.getSourcePath())
|
testPath,testName = os.path.split(test.getSourcePath())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user