diff options
Diffstat (limited to 'test/run_test_suite.py')
-rwxr-xr-x | test/run_test_suite.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/run_test_suite.py b/test/run_test_suite.py index d25fb3a1..05dc81ca 100755 --- a/test/run_test_suite.py +++ b/test/run_test_suite.py @@ -208,6 +208,23 @@ def _file_equals(patha, pathb): return _show_diff(fa.readlines(), fb.readlines(), patha, pathb) +def _file_lines_equal(patha, pathb, subst_from="", subst_to=""): + import io + + for path in (patha, pathb): + if not os.access(path, os.F_OK): + sys.stderr.write("error: missing file %s" % path) + return False + + la = sorted(set(io.open(patha, encoding="utf-8").readlines())) + lb = sorted(set(io.open(pathb, encoding="utf-8").readlines())) + if la != lb: + _show_diff(la, lb, patha, pathb) + return False + + return True + + def test_suite( manifest_path, base_uri, @@ -306,6 +323,18 @@ def test_suite( command_prefix, ) + # Run model test for positive test (must succeed) + out_filename = os.path.join(out_test_dir, test_name + ".model.out") + + with open(out_filename, "w") as stdout: + proc = subprocess.run([command[0]] + ['-m'] + command[1:], + check=True, + stdout=stdout) + + if proc.returncode == 0 and ((mf + 'result') in model[test]): + if not _file_lines_equal(check_path, out_filename): + results.n_failures += 1 + else: # Negative test with open(out_filename, "w") as stdout: with tempfile.TemporaryFile() as stderr: |