diff --git a/fluster/fluster.py b/fluster/fluster.py index 2f2ff96..95a2ef1 100644 --- a/fluster/fluster.py +++ b/fluster/fluster.py @@ -382,6 +382,8 @@ def _parse_suite_results( ]: jcase.result = _parse_vector_errors(vector) + jcase.time = vector.test_time + jsuite.add_testcase(jcase) if vector.test_result is TestVectorResult.TIMEOUT and ctx.jobs == 1: diff --git a/fluster/test.py b/fluster/test.py index fcc2625..bae6784 100644 --- a/fluster/test.py +++ b/fluster/test.py @@ -19,6 +19,7 @@ from subprocess import TimeoutExpired import unittest from typing import Any +from time import perf_counter from fluster.decoder import Decoder from fluster.test_vector import TestVector, TestVectorResult @@ -75,6 +76,7 @@ def _test(self) -> None: input_filepath = normalize_path(input_filepath) try: + start = perf_counter() result = self.decoder.decode( input_filepath, output_filepath, @@ -83,15 +85,24 @@ def _test(self) -> None: self.verbose, self.keep_files, ) + self.test_suite.test_vectors[self.test_vector.name].test_time = ( + perf_counter() - start + ) except TimeoutExpired: self.test_suite.test_vectors[ self.test_vector.name ].test_result = TestVectorResult.TIMEOUT + self.test_suite.test_vectors[self.test_vector.name].test_time = ( + perf_counter() - start + ) raise except Exception: self.test_suite.test_vectors[ self.test_vector.name ].test_result = TestVectorResult.ERROR + self.test_suite.test_vectors[self.test_vector.name].test_time = ( + perf_counter() - start + ) raise if ( diff --git a/fluster/test_vector.py b/fluster/test_vector.py index 925c97b..e81b0d8 100644 --- a/fluster/test_vector.py +++ b/fluster/test_vector.py @@ -60,6 +60,7 @@ def __init__( # Not included in JSON self.test_result = TestVectorResult.NOT_RUN + self.test_time = 0.0 self.errors: List[List[str]] = [] @classmethod @@ -76,6 +77,7 @@ def data_to_serialize(self) -> Dict[str, object]: data = self.__dict__.copy() data.pop("test_result") data.pop("errors") + data.pop("test_time") data["output_format"] = str(self.output_format.value) return data