diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2013-10-18 22:04:07 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2013-10-18 22:04:07 +0300 |
commit | 11cfb3ce22dfbe189969575832d51a925abc8fee (patch) | |
tree | 6ae67dd7b4ff9e26d9ff49d03bb329b978a99670 /meson_test.py | |
parent | ae06ca2afc58901d9d72f13f662701cf12281b51 (diff) | |
download | meson-11cfb3ce22dfbe189969575832d51a925abc8fee.zip meson-11cfb3ce22dfbe189969575832d51a925abc8fee.tar.gz meson-11cfb3ce22dfbe189969575832d51a925abc8fee.tar.bz2 |
Can set test cmd arguments and environment variables.
Diffstat (limited to 'meson_test.py')
-rwxr-xr-x | meson_test.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/meson_test.py b/meson_test.py index 4a9925c..3bba960 100755 --- a/meson_test.py +++ b/meson_test.py @@ -39,26 +39,27 @@ def write_log(logfile, test_name, result_str, stdo, stde): logfile.write(stde) logfile.write('\n-------\n\n') -def run_single_test(wrap, fname, is_cross, exe_runner): +def run_single_test(wrap, test): global tests_failed - if is_cross: - if exe_runner is None: + if test.is_cross: + if test.exe_runner is None: # 'Can not run test on cross compiled executable # because there is no execute wrapper. cmd = None else: - cmd = [exe_runner, fname] + cmd = [exe_runner, test.fname] else: - cmd = [fname] + cmd = [test.fname] if cmd is None: res = 'SKIP' duration = 0.0 stdo = 'Not run because can not execute cross compiled binaries.' stde = '' else: - cmd = wrap + cmd + cmd = wrap + cmd + test.cmd_args starttime = time.time() - p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, + env=test.env) (stdo, stde) = p.communicate() endtime = time.time() duration = endtime - starttime @@ -113,11 +114,10 @@ def run_tests(options, datafilename): if not test.is_parallel: drain_futures(futures) futures = [] - res = run_single_test(wrap, test.fname, test.is_cross, test.exe_runner) + res = run_single_test(wrap, t) print_stats(numlen, tests, test.name, res, i, logfile) else: - f = executor.submit(run_single_test, wrap, test.fname, - test.is_cross, test.exe_runner) + f = executor.submit(run_single_test, wrap, test) futures.append((f, numlen, tests, test.name, i, logfile)) drain_futures(futures) print('\nFull log written to %s.' % logfilename) |