Minor updates to test runner

This commit is contained in:
Mattia Giambirtone 2023-07-05 14:43:15 +02:00
parent 88073194f2
commit c1f765332b
Signed by: nocturn9x
GPG Key ID: 8270F9F467971E59
1 changed files with 6 additions and 2 deletions

View File

@ -1,8 +1,9 @@
import sys import sys
from tqdm import tqdm
import shlex import shlex
import subprocess import subprocess
from pathlib import Path from pathlib import Path
from tqdm import tqdm
from timeit import default_timer
NIM_FLAGS = "-d:debug" NIM_FLAGS = "-d:debug"
PEON_FLAGS = "-n --showMismatches" PEON_FLAGS = "-n --showMismatches"
@ -15,6 +16,8 @@ def main() -> int:
failed: set[Path] = set() failed: set[Path] = set()
# We consume the generator now because I want tqdm to show the progress bar! # We consume the generator now because I want tqdm to show the progress bar!
test_files = list((Path.cwd() / "tests").resolve(strict=True).glob("*.pn")) test_files = list((Path.cwd() / "tests").resolve(strict=True).glob("*.pn"))
print(f"Collected {len(test_files)} tests (before filtering)")
start = default_timer()
for test_file in tqdm(test_files): for test_file in tqdm(test_files):
tests.add(test_file) tests.add(test_file)
if test_file.name in EXCLUDE: if test_file.name in EXCLUDE:
@ -29,9 +32,10 @@ def main() -> int:
continue continue
if not all(map(lambda s: s == b"true", out.stdout.splitlines())): if not all(map(lambda s: s == b"true", out.stdout.splitlines())):
failed.add(test_file) failed.add(test_file)
time_taken = default_timer() - start
total = len(tests) total = len(tests)
successful = len(tests - failed - skipped) successful = len(tests - failed - skipped)
print(f"Collected {total} tests ({successful}/{total}) passed, {len(failed)}/{total} failed, {len(skipped)}/{total} skipped)") print(f"Test suite ran in {time_taken:.2f} seconds ({successful}/{total}) passed, {len(failed)}/{total} failed, {len(skipped)}/{total} skipped)")
return len(failed) == 0 return len(failed) == 0