diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-09-01 11:02:55 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-09-01 11:02:55 +0200 |
| commit | 47e7d3a9da2aafcf438c78ad1d74ac2288a77cd3 (patch) | |
| tree | 2bafc08234eec8f756b1eeefa7f59df5737f7710 /tests/run.py | |
| parent | 2b2cb091459f050f94c966a8e49fa70d8ccde395 (diff) | |
Switch to run.py
Diffstat (limited to 'tests/run.py')
| -rwxr-xr-x | tests/run.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/run.py b/tests/run.py index cb5d88d..634ac2e 100755 --- a/tests/run.py +++ b/tests/run.py @@ -2,29 +2,31 @@ import os, subprocess -teststimeout=20 # Max duration of a test -testspath = os.path.dirname(os.path.realpath(__file__)) +##### Setup Variables +tests_timeout=20 # Max duration of a test +tests_path = os.path.dirname(os.path.realpath(__file__)) -for file in os.listdir(testspath): - testpath=os.path.join(testspath,file) - if os.path.isdir(testpath): - simulatorpath=os.path.join(testpath,"simulator.py") - outpath=os.path.join(testpath,"out") +##### Run All Tests +for file in os.listdir(tests_path): + current_test_path=os.path.join(tests_path,file) + if os.path.isdir(current_test_path): + simulator_path=os.path.join(current_test_path,"simulator.py") + out_path=os.path.join(current_test_path,"out") print("- %-50s%s " % (file,"=>"),end='') try: - out=subprocess.check_output(simulatorpath, stderr=subprocess.STDOUT,timeout=teststimeout).decode("utf-8") - outexpected=open(outpath).read() - if outexpected != out: + out=subprocess.check_output(simulator_path, stderr=subprocess.STDOUT,timeout=tests_timeout).decode("utf-8") + out_expected=open(out_path).read() + if out_expected != out: print("failed :(") print("------------- Expected -------------") - print(outexpected,end="") + print(out_expected,end="") print("------------- Got -------------") print(out,end="") else: print("passed") except subprocess.TimeoutExpired as err: print("failed :(") - print("------------- Test timeout (should not exceed "+str(teststimeout)+"s) -------------") + print("------------- Test timeout (should not exceed "+str(tests_timeout)+"s) -------------") print(err.output.decode("utf-8"),end="") exit(1) except subprocess.CalledProcessError as err: |
