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

twister: reporting: fix gcov_tool path on Windows #84334

Merged
merged 1 commit into from
Jan 23, 2025
Merged
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
15 changes: 9 additions & 6 deletions scripts/pylib/twister/twisterlib/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import xml.etree.ElementTree as ET
from datetime import datetime
from enum import Enum
from pathlib import Path, PosixPath
from pathlib import Path

from colorama import Fore
from twisterlib.statuses import TwisterStatus
Expand All @@ -29,6 +29,13 @@ def __str__(self):
SKIP = 'skipped'


class ReportingJSONEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, Path):
return str(obj)
return super().default(obj)


class Reporting:

json_filters = {
Expand Down Expand Up @@ -294,10 +301,6 @@ def json_report(self, filename, version="NA", platform=None, filters=None):
else:
report_options = self.env.non_default_options()

# Resolve known JSON serialization problems.
for k,v in report_options.items():
report_options[k] = str(v) if type(v) in [PosixPath] else v

report = {}
report["environment"] = {"os": os.name,
"zephyr_version": version,
Expand Down Expand Up @@ -483,7 +486,7 @@ def json_report(self, filename, version="NA", platform=None, filters=None):

report["testsuites"] = suites
with open(filename, 'w') as json_file:
json.dump(report, json_file, indent=4, separators=(',',':'))
json.dump(report, json_file, indent=4, separators=(',',':'), cls=ReportingJSONEncoder)


def compare_metrics(self, filename):
Expand Down
Loading