changing run_tests to support skipping tests and time

This commit is contained in:
Ilia Filippov
2013-06-13 19:25:34 +04:00
parent 6fb70c307d
commit 8642b4d89f

View File

@@ -228,6 +228,7 @@ def add_prefix(path):
else: else:
input_prefix = "" input_prefix = ""
path = input_prefix + path path = input_prefix + path
path = os.path.normpath(path)
return path return path
@@ -271,8 +272,8 @@ def run_test(testname):
# testname is a path to the test from the root of ispc dir # testname is a path to the test from the root of ispc dir
# filename is a path to the test from the current dir # filename is a path to the test from the current dir
# ispc_exe_rel is a relative path to ispc # ispc_exe_rel is a relative path to ispc
filename = os.path.normpath(add_prefix(testname)) filename = add_prefix(testname)
ispc_exe_rel = os.path.normpath(add_prefix(ispc_exe)) ispc_exe_rel = add_prefix(ispc_exe)
# is this a test to make sure an error is issued? # is this a test to make sure an error is issued?
want_error = (filename.find("tests_errors") != -1) want_error = (filename.find("tests_errors") != -1)
@@ -370,7 +371,7 @@ def run_test(testname):
if options.no_opt: if options.no_opt:
ispc_cmd += " -O0" ispc_cmd += " -O0"
if is_generic_target: if is_generic_target:
ispc_cmd += " --emit-c++ --c++-include-file=%s" % os.path.normpath(add_prefix(options.include_file)) ispc_cmd += " --emit-c++ --c++-include-file=%s" % add_prefix(options.include_file)
# compile the ispc code, make the executable, and run it... # compile the ispc code, make the executable, and run it...
(compile_error, run_error) = run_cmds([ispc_cmd, cc_cmd], (compile_error, run_error) = run_cmds([ispc_cmd, cc_cmd],
@@ -484,7 +485,7 @@ if __name__ == '__main__':
elapsed_time = time.time() - start_time elapsed_time = time.time() - start_time
if options.time: if options.time:
sys.stdout.write("elapsed time: %d s\n" % elapsed_time) sys.stdout.write("Elapsed time: %d s\n" % elapsed_time)
while not qret.empty(): while not qret.empty():
(c, r) = qret.get() (c, r) = qret.get()