Runs each script in the tests directory and returns the results.
Parameters
----------
tests_dir: str
The path to the test dir, containing the test scripts (`*.sh`).
Returns
-------
dict: key = script path, value = (exit_code, elapsed_time, stdout, stderr)
Definition at line 106 of file run_tests.py.
108 """Runs each script in the tests directory and returns the results.
113 The path to the test dir, containing the test scripts (`*.sh`).
117 dict: key = script path, value = (exit_code, elapsed_time, stdout, stderr)
122 for subdir
in sorted(glob(
join(tests_dir,
'*'))):
123 component_group = basename(subdir)
124 print(
"\n{}{}\n{}{}".format(INFO, component_group,
125 len(component_group) *
'=', RST))
126 for test_script
in sorted(glob(
join(subdir,
'*.sh')) + glob(
join(subdir,
'*.csh'))):
127 print(
"+ {}".format(test_script), end=
' => ')
130 proc = Popen(test_script, stdout=PIPE, stderr=PIPE)
131 out, err = [
safe_str(t)
for t
in proc.communicate()]
132 exit_code = proc.wait()
133 delta_t = time() - start_time
134 test_results[test_script] = (exit_code, delta_t, out, err)
135 print(
" ({:.2f} s) ".format(delta_t), end=
'')
138 print(
"{}FAILED (exit code {}){}".format(FAIL, exit_code, RST))
141 print(
"{}OK{}".format(OK, RST))