mirror of
https://gitlab.com/manzerbredes/esds.git
synced 2025-04-07 02:26:28 +02:00
Add test duration
This commit is contained in:
parent
47e7d3a9da
commit
d908a5f832
1 changed files with 5 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import os, subprocess
|
import os, subprocess, time
|
||||||
|
|
||||||
##### Setup Variables
|
##### Setup Variables
|
||||||
tests_timeout=20 # Max duration of a test
|
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):
|
if os.path.isdir(current_test_path):
|
||||||
simulator_path=os.path.join(current_test_path,"simulator.py")
|
simulator_path=os.path.join(current_test_path,"simulator.py")
|
||||||
out_path=os.path.join(current_test_path,"out")
|
out_path=os.path.join(current_test_path,"out")
|
||||||
print("- %-50s%s " % (file,"=>"),end='')
|
print("- %-40s%s " % (file,"=>"),end='')
|
||||||
try:
|
try:
|
||||||
|
start_at=time.time()
|
||||||
out=subprocess.check_output(simulator_path, stderr=subprocess.STDOUT,timeout=tests_timeout).decode("utf-8")
|
out=subprocess.check_output(simulator_path, stderr=subprocess.STDOUT,timeout=tests_timeout).decode("utf-8")
|
||||||
out_expected=open(out_path).read()
|
out_expected=open(out_path).read()
|
||||||
|
end_at=time.time()
|
||||||
if out_expected != out:
|
if out_expected != out:
|
||||||
print("failed :(")
|
print("failed :(")
|
||||||
print("------------- Expected -------------")
|
print("------------- Expected -------------")
|
||||||
|
@ -23,7 +25,7 @@ for file in os.listdir(tests_path):
|
||||||
print("------------- Got -------------")
|
print("------------- Got -------------")
|
||||||
print(out,end="")
|
print(out,end="")
|
||||||
else:
|
else:
|
||||||
print("passed")
|
print("passed (%0.1fs)"%(end_at-start_at))
|
||||||
except subprocess.TimeoutExpired as err:
|
except subprocess.TimeoutExpired as err:
|
||||||
print("failed :(")
|
print("failed :(")
|
||||||
print("------------- Test timeout (should not exceed "+str(tests_timeout)+"s) -------------")
|
print("------------- Test timeout (should not exceed "+str(tests_timeout)+"s) -------------")
|
||||||
|
|
Loading…
Add table
Reference in a new issue