This commit is contained in:
Eldar Akchurin 2015-10-30 09:48:36 +00:00
Родитель 581d6a4186
Коммит 3c1902415a
2 изменённых файлов: 10 добавлений и 11 удалений

Просмотреть файл

@ -21,10 +21,10 @@ def collectCoverageSingle(test, outputDir, toolDir, config):
collectCoverage([os.path.basename(test)], os.path.dirname(test), outputDir, toolDir, config)
def collectCoverageMulti(testDir, outputDir, toolDir, config):
tests = [ f for f in os.listdir(testDir) if os.path.isfile(os.path.join(testDir, f)) and f.lower().endswith("tests.exe") ]
tests = [ f for f in os.listdir(testDir) if os.path.isfile(os.path.join(testDir, f)) and f.lower().endswith(".exe") ]
collectCoverage(tests, testDir, outputDir, toolDir, config)
def main():
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Collects coverage for the executable or directory with test executables")
parser.add_argument('--test', help='Path to the executable or directory that has to be analyzed', required=True)
parser.add_argument('--outputdir', help='Output directory for coverage results', required=True)
@ -41,6 +41,4 @@ def main():
elif os.path.isdir(args.test):
collectCoverageMulti(args.test, args.outputdir, args.tooldir, args.config)
else:
print('Please specify correct executable or test directory where the coverage should be collected.')
main()
print('Please specify correct executable or test directory where the coverage should be collected.')

Просмотреть файл

@ -15,12 +15,12 @@ def runBoostUnitTests(testDir, outputDir):
continue
# running the test with correct suffix
if test.lower().endswith("tests.exe") or test.lower().endswith("tests"):
if test.lower().endswith(".exe"):
outputFile = os.path.join(outputDir, test + ".xml")
print "Running test executable %s with result in %s" % (test, outputFile)
subprocess.check_call([os.path.join(testDir, test), "--log_format=XML", "--log_sink=%s" % outputFile, "--log_level=all", "--report_level=no"])
def main():
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Runs all boost unit tests in the directory")
parser.add_argument('--testdir', help='Test directory where all tests reside', required=True)
parser.add_argument('--outputdir', help='Output directory for test results', required=True)
@ -28,7 +28,8 @@ def main():
if not os.path.exists(args.outputdir):
os.makedirs(args.outputdir)
runBoostUnitTests(args.testdir, args.outputdir)
main()
if not os.path.exists(args.testdir):
print('Test directory is missing, no tests have been run.')
else:
runBoostUnitTests(args.testdir, args.outputdir)