This commit is contained in:
Loic Guegan 2022-09-02 10:01:16 +02:00
parent f6fc8a4c86
commit c73ebc1fbc
2 changed files with 11 additions and 11 deletions

View file

@ -1,12 +1,12 @@
#!/usr/bin/env python
import os, subprocess, time,sys
import os,subprocess,time,sys
##### Setup Variables
##### Setup variables
tests_timeout=20 # Max duration of a test
tests_path = os.path.dirname(os.path.realpath(__file__))
##### Run All Tests
##### 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):
@ -15,7 +15,7 @@ for file in os.listdir(tests_path):
print("- %-40s%s " % (file,"=>"),end='')
try:
start_at=time.time()
out=subprocess.check_output([sys.executable, simulator_path], stderr=subprocess.STDOUT,timeout=tests_timeout,encoding="utf-8")
out=subprocess.check_output([sys.executable, simulator_path],stderr=subprocess.STDOUT,timeout=tests_timeout,encoding="utf-8")
out_expected=open(out_path).read()
end_at=time.time()
if out_expected != out:
@ -28,12 +28,12 @@ for file in os.listdir(tests_path):
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) -------------")
print("------------- Test duration expired (timeout="+str(tests_timeout)+"s) -------------")
print(err.output,end="")
exit(1)
except subprocess.CalledProcessError as err:
print("failed :(")
print("------------- Non test has a non-zero exit code -------------")
print("------------- Test has a non-zero exit code -------------")
print(err.output,end="")
exit(2)
except Exception as err: