Make verbose testing also report compile/trace/run messages.

Helped with #287.
pull/289/head
Stella Laurenzo 2021-08-22 20:26:03 -07:00 committed by Yi Zhang
parent 4148f88576
commit d8db41b3b6
2 changed files with 11 additions and 3 deletions

View File

@ -104,10 +104,11 @@ def main():
sys.exit(1)
# Run the tests.
results = run_tests(tests, config)
results = run_tests(tests, config, verbose=args.verbose)
# Report the test results.
failed = report_results(results, XFAIL_SETS[args.config], args.verbose)
failed = report_results(
results, XFAIL_SETS[args.config], verbose=args.verbose)
sys.exit(1 if failed else 0)
if __name__ == '__main__':

View File

@ -284,13 +284,16 @@ def generate_golden_trace(test: Test) -> Trace:
return trace
def run_tests(tests: List[Test], config: TestConfig) -> List[TestResult]:
def run_tests(tests: List[Test], config: TestConfig,
verbose=False) -> List[TestResult]:
"""Invoke the given `Test`'s with the provided `TestConfig`."""
results = []
for test in tests:
# TODO: Precompile everything in parallel.
try:
print(f"GENERATE TRACE: {test}")
golden_trace = generate_golden_trace(test)
print(f"COMPILE: {test}")
compiled = config.compile(test.program_factory())
except Exception as e:
# Useful for debugging:
@ -307,7 +310,11 @@ def run_tests(tests: List[Test], config: TestConfig) -> List[TestResult]:
golden_trace=None))
continue
# TODO: Run in parallel.
if verbose:
print(f"RUN: {test}")
trace = config.run(compiled, golden_trace)
if verbose:
print(f"FINISHED: {test}")
results.append(
TestResult(unique_name=test.unique_name,
compilation_error=None,