|
@@ -337,8 +337,8 @@ def get_expectation_checks(expected_values):
|
|
|
|
|
|
def run_correctness_test(files, parameters, expected, optimization_level):
|
|
|
"""Compiles the given sequence of files, feeds them the given input in the given mode,
|
|
|
- and then compares the output with the expected output. The return value is the total
|
|
|
- run-time of the test."""
|
|
|
+ and then compares the output with the expected output. The return value is a dictionary
|
|
|
+ of measured quantities."""
|
|
|
checks = iter(list(get_expectation_checks(expected)))
|
|
|
next_check = [next(checks)]
|
|
|
def handle_output(output):
|
|
@@ -353,13 +353,23 @@ def run_correctness_test(files, parameters, expected, optimization_level):
|
|
|
except StopIteration:
|
|
|
return False
|
|
|
|
|
|
+ timing_log = tempfile.mktemp()
|
|
|
start_time = time.time()
|
|
|
try:
|
|
|
- run_file(files, parameters, 'CO', handle_output, optimization_level)
|
|
|
+ run_file(files, parameters, 'CO', handle_output, optimization_level, timing_log)
|
|
|
+ with open(timing_log, 'r') as log_file:
|
|
|
+ parsed_times = parse_jit_timing_log(log_file)
|
|
|
+
|
|
|
+ compile_time = sum([data for _, data in parsed_times])
|
|
|
except ModelverseTerminated:
|
|
|
return
|
|
|
+ finally:
|
|
|
+ os.remove(timing_log)
|
|
|
end_time = time.time()
|
|
|
- return end_time - start_time
|
|
|
+ return {
|
|
|
+ TOTAL_TIME_QUANTITY: end_time - start_time,
|
|
|
+ COMPILE_TIME_QUANTITY: compile_time
|
|
|
+ }
|
|
|
|
|
|
def format_output(output):
|
|
|
"""Formats the output of `run_file_to_completion` as a string."""
|