Skip to content

Commit ec47912

Browse files
committed
twister: generate json report on demand
Do not generate json report by default. Use --json-report to generate the file. Signed-off-by: Anas Nashif <[email protected]>
1 parent b9d492e commit ec47912

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

scripts/pylib/twister/twisterlib.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,7 +2734,7 @@ def summary(self, results, unrecognized_sections):
27342734
logger.info(f"{Fore.GREEN}{run}{Fore.RESET} test configurations executed on platforms, \
27352735
{Fore.RED}{results.total - run - results.skipped_configs}{Fore.RESET} test configurations were only built.")
27362736

2737-
def save_reports(self, name, suffix, report_dir, no_update, release, only_failed, platform_reports):
2737+
def save_reports(self, name, suffix, report_dir, no_update, release, only_failed, platform_reports, json_report):
27382738
if not self.instances:
27392739
return
27402740

@@ -2761,7 +2761,9 @@ def save_reports(self, name, suffix, report_dir, no_update, release, only_failed
27612761
self.xunit_report(filename + "_report.xml", full_report=True,
27622762
append=only_failed, version=self.version)
27632763
self.csv_report(filename + ".csv")
2764-
self.json_report(filename + ".json", append=only_failed, version=self.version)
2764+
2765+
if json_report:
2766+
self.json_report(filename + ".json", append=only_failed, version=self.version)
27652767

27662768
if platform_reports:
27672769
self.target_report(outdir, suffix, append=only_failed)

scripts/twister

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,10 @@ Artificially long but functional example:
337337
The output will be both in CSV and JUNIT format
338338
(twister.csv and twister.xml).
339339
""")
340-
340+
parser.add_argument(
341+
"--json-report", action="store_true",
342+
help="""Generate a JSON file with all test results. [Experimental]
343+
""")
341344
parser.add_argument(
342345
"--platform-reports", action="store_true",
343346
help="""Create individual reports for each platform.
@@ -1254,6 +1257,7 @@ def main():
12541257
options.release,
12551258
options.only_failed,
12561259
options.platform_reports,
1260+
options.json_report
12571261
)
12581262

12591263
# FIXME: remove later

0 commit comments

Comments
 (0)