if a test runs a long time, run it with verbose
This commit is contained in:
parent
dd4732c007
commit
229f654eb5
4 changed files with 23 additions and 13 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -3,3 +3,6 @@ bin/
|
|||
|
||||
.build-all.db
|
||||
|
||||
uf50-218
|
||||
|
||||
uf100-430
|
||||
|
|
|
|||
BIN
.test.db
BIN
.test.db
Binary file not shown.
30
test.py
30
test.py
|
|
@ -17,21 +17,22 @@ args = parser.parse_args(sys.argv[1:]);
|
|||
|
||||
try:
|
||||
with open(".test.db", "rb") as stream:
|
||||
ftimes = pickle.load(stream);
|
||||
failtimes, runtimes = pickle.load(stream);
|
||||
except:
|
||||
ftimes = dict();
|
||||
failtimes = dict();
|
||||
runtimes = dict();
|
||||
|
||||
def write_ftimes():
|
||||
def write_failtimes():
|
||||
with open(".test.db", "wb") as stream:
|
||||
pickle.dump(ftimes, stream);
|
||||
pickle.dump((failtimes, runtimes), stream);
|
||||
|
||||
atexit.register(write_ftimes);
|
||||
atexit.register(write_failtimes);
|
||||
|
||||
all_tests = list(glob.glob("tests/**/*.cnf", recursive = True));
|
||||
|
||||
for test in all_tests:
|
||||
if test not in ftimes:
|
||||
ftimes[test] = time.time();
|
||||
if test not in failtimes:
|
||||
failtimes[test] = time.time();
|
||||
|
||||
def printgreen(text):
|
||||
if args.color:
|
||||
|
|
@ -41,17 +42,26 @@ def printgreen(text):
|
|||
|
||||
n = len(all_tests);
|
||||
|
||||
for i, test in enumerate(sorted(all_tests, key = lambda x: -ftimes[x])):
|
||||
command = [args.executable, "-i", test, "-vV"];
|
||||
for i, test in enumerate(sorted(all_tests, key = lambda x: -failtimes[x])):
|
||||
command = [args.executable, "-i", test, "-V"];
|
||||
|
||||
# if we don't know how long this test will take, or if we know that it will
|
||||
# take a long time (more than 5 seconds): add the verbose option.
|
||||
if test not in runtimes or runtimes[test] > 10:
|
||||
command += ['-v'];
|
||||
|
||||
prettycommand = f"[{i}/{n}]: {test} ...";
|
||||
|
||||
printgreen(prettycommand);
|
||||
|
||||
before = time.time();
|
||||
res = subprocess.run(command);
|
||||
after = time.time();
|
||||
|
||||
runtimes[test] = after - before;
|
||||
|
||||
if res.returncode:
|
||||
ftimes[test] = time.time();
|
||||
failtimes[test] = time.time();
|
||||
exit(1);
|
||||
|
||||
printgreen("All tests pass!");
|
||||
|
|
|
|||
3
tests/satlib/.gitignore
vendored
3
tests/satlib/.gitignore
vendored
|
|
@ -1,3 +0,0 @@
|
|||
|
||||
uf100-430/
|
||||
|
||||
Loading…
Reference in a new issue