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) sys.exit(1)
# Run the tests. # Run the tests.
results = run_tests(tests, config) results = run_tests(tests, config, verbose=args.verbose)
# Report the test results. # 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) sys.exit(1 if failed else 0)
if __name__ == '__main__': if __name__ == '__main__':

View File

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