twister: Add target reports in json format
Using --platform-reports will also generate json reports with results from a single platform. Needed for on-target results publishing process. Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
This commit is contained in:
parent
b1532ce449
commit
690011498c
1 changed files with 6 additions and 1 deletions
|
@ -232,7 +232,7 @@ class Reporting:
|
||||||
with open(filename, 'wb') as report:
|
with open(filename, 'wb') as report:
|
||||||
report.write(result)
|
report.write(result)
|
||||||
|
|
||||||
def json_report(self, filename, version="NA"):
|
def json_report(self, filename, version="NA", platform=None):
|
||||||
logger.info(f"Writing JSON report {filename}")
|
logger.info(f"Writing JSON report {filename}")
|
||||||
report = {}
|
report = {}
|
||||||
report["environment"] = {"os": os.name,
|
report["environment"] = {"os": os.name,
|
||||||
|
@ -244,6 +244,8 @@ class Reporting:
|
||||||
suites = []
|
suites = []
|
||||||
|
|
||||||
for instance in self.instances.values():
|
for instance in self.instances.values():
|
||||||
|
if platform and platform != instance.platform.name:
|
||||||
|
continue
|
||||||
suite = {}
|
suite = {}
|
||||||
handler_log = os.path.join(instance.build_dir, "handler.log")
|
handler_log = os.path.join(instance.build_dir, "handler.log")
|
||||||
pytest_log = os.path.join(instance.build_dir, "twister_harness.log")
|
pytest_log = os.path.join(instance.build_dir, "twister_harness.log")
|
||||||
|
@ -543,6 +545,9 @@ class Reporting:
|
||||||
for platform in platforms:
|
for platform in platforms:
|
||||||
if suffix:
|
if suffix:
|
||||||
filename = os.path.join(outdir,"{}_{}.xml".format(platform, suffix))
|
filename = os.path.join(outdir,"{}_{}.xml".format(platform, suffix))
|
||||||
|
json_platform_file = os.path.join(outdir,"{}_{}.json".format(platform, suffix))
|
||||||
else:
|
else:
|
||||||
filename = os.path.join(outdir,"{}.xml".format(platform))
|
filename = os.path.join(outdir,"{}.xml".format(platform))
|
||||||
|
json_platform_file = os.path.join(outdir,"{}.json".format(platform))
|
||||||
self.xunit_report(json_file, filename, platform, full_report=True)
|
self.xunit_report(json_file, filename, platform, full_report=True)
|
||||||
|
self.json_report(json_platform_file, version=self.env.version, platform=platform)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue