summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2022-09-01 13:33:18 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2022-09-01 13:33:18 +0200
commitd908a5f8328c5a16b8d60acb09583082f60f5a05 (patch)
treeb4d20f7b1b51171a24de2f1b2b95b18a574a9c26
parent47e7d3a9da2aafcf438c78ad1d74ac2288a77cd3 (diff)
Add test duration
-rwxr-xr-xtests/run.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/run.py b/tests/run.py
index 634ac2e..e05c5b4 100755
--- a/tests/run.py
+++ b/tests/run.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-import os, subprocess
+import os, subprocess, time
##### Setup Variables
tests_timeout=20 # Max duration of a test
@@ -12,10 +12,12 @@ for file in os.listdir(tests_path):
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='')
+ print("- %-40s%s " % (file,"=>"),end='')
try:
+ start_at=time.time()
out=subprocess.check_output(simulator_path, stderr=subprocess.STDOUT,timeout=tests_timeout).decode("utf-8")
out_expected=open(out_path).read()
+ end_at=time.time()
if out_expected != out:
print("failed :(")
print("------------- Expected -------------")
@@ -23,7 +25,7 @@ for file in os.listdir(tests_path):
print("------------- Got -------------")
print(out,end="")
else:
- print("passed")
+ print("passed (%0.1fs)"%(end_at-start_at))
except subprocess.TimeoutExpired as err:
print("failed :(")
print("------------- Test timeout (should not exceed "+str(tests_timeout)+"s) -------------")