Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

junitxml: Add each vector test time #146

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions fluster/fluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 11 additions & 0 deletions fluster/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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 (
Expand Down
2 changes: 2 additions & 0 deletions fluster/test_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
Loading