forked from organicmaps/organicmaps
A solution whereby we run boost tests separately from non-boost tests.
This commit is contained in:
parent
8d3413ca17
commit
c0994f722d
1 changed files with 25 additions and 5 deletions
|
@ -61,21 +61,24 @@ class TestRunner:
|
|||
parser.add_option("-u", "--user_resource_path", dest="resource_path", help="Path to resources, styles and classificators (passed to the test executables as --user_resource_path=<value>)")
|
||||
parser.add_option("-i", "--include", dest="runlist", action="append", default=[], help="Include test into execution, comma separated list with no spaces or individual tests, or both. E.g.: -i one -i two -i three,four,five")
|
||||
parser.add_option("-e", "--exclude", dest="skiplist", action="append", default=[], help="Exclude test from execution, comma separated list with no spaces or individual tests, or both. E.g.: -i one -i two -i three,four,five")
|
||||
|
||||
parser.add_option("-b", "--boost_tests", dest="boost_tests", action="store_true", default=False, help="Treat all the tests as boost tests (their output is different and it must be processed differently.")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
self.skiplist = set()
|
||||
self.runlist = list()
|
||||
|
||||
|
||||
for tests in options.skiplist:
|
||||
for test in tests.split(","):
|
||||
self.skiplist.add(test)
|
||||
|
||||
for tests in options.runlist:
|
||||
self.runlist.extend(tests.split(","))
|
||||
|
||||
|
||||
self.boost_tests = options.boost_tests
|
||||
|
||||
if self.runlist:
|
||||
logging.warn("-i option found, the -e option will be ignored")
|
||||
logging.warn("-i or -b options found, the -e option will be ignored")
|
||||
|
||||
self.workspace_path = options.folder
|
||||
self.logfile = options.output
|
||||
|
@ -127,6 +130,18 @@ class TestRunner:
|
|||
return {TO_RUN:tests_to_run, SKIP:local_skiplist, NOT_FOUND:not_found, WITH_SERVER:tests_with_server}
|
||||
|
||||
|
||||
def test_file_with_keys(self, test_file):
|
||||
# omim-build-debug/out/debug/opening_hours_tests --report_format=xml --report_level=detailed --log_level=test_suite --log_format=xml 1> boostlog.xml 2> boosterr.xml
|
||||
|
||||
if self.boost_tests:
|
||||
return "{test_file} --report_format=xml --report_level=detailed --log_level=test_suite --log_format=xml {data}{resources}".format(test_file=test_file, data=self.data_path, resources=self.user_resource_path)
|
||||
|
||||
return "{test_file}{data}{resources}".format(test_file=test_file, data=self.data_path, resources=self.user_resource_path)
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def run_tests(self, tests_to_run):
|
||||
failed = list()
|
||||
passed = list()
|
||||
|
@ -135,7 +150,9 @@ class TestRunner:
|
|||
|
||||
self.log_exec_file(test_file)
|
||||
|
||||
test_file_with_keys = "{test_file}{data}{resources}".format(test_file=test_file, data=self.data_path, resources=self.user_resource_path)
|
||||
|
||||
|
||||
test_file_with_keys = self.test_file_with_keys(test_file)
|
||||
|
||||
logging.info(test_file_with_keys)
|
||||
process = subprocess.Popen("{tests_path}/{test_file} 2>> {logfile}".
|
||||
|
@ -156,6 +173,9 @@ class TestRunner:
|
|||
|
||||
|
||||
def log_exec_file(self, filename, result=None):
|
||||
if self.boost_tests:
|
||||
return
|
||||
|
||||
logstring = "BEGIN" if result is None else "END" #can be 0 or None. If we omit the explicit check for None, we get wrong result
|
||||
resstring = (" | result: {returncode}".format(returncode=result) if result is not None else "")
|
||||
with open(self.logfile, "a") as logf:
|
||||
|
|
Loading…
Add table
Reference in a new issue