Skip to content

Commit

Permalink
twister: normalize platform name when storing files/data
Browse files Browse the repository at this point in the history
Convert slashes into underscores to allow saving of data related to
platforms on disk.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
  • Loading branch information
nashif committed Feb 22, 2024
1 parent 11d3f4c commit 5fb02a1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions scripts/pylib/twister/twisterlib/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def load(self, platform_file):
data = scp.data

self.name = data['identifier']
self.normalized_name = self.name.replace("/", "_")
self.twister = data.get("twister", True)
# if no RAM size is specified by the board, take a default of 128K
self.ram = data.get("ram", 128)
Expand Down
14 changes: 7 additions & 7 deletions scripts/pylib/twister/twisterlib/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,13 +545,13 @@ def save_reports(self, name, suffix, report_dir, no_update, platform_reports):


def target_report(self, json_file, outdir, suffix):
platforms = {inst.platform.name for _, inst in self.instances.items()}
platforms = {inst.platform for _, inst in self.instances.items()}
for platform in platforms:
if suffix:
filename = os.path.join(outdir,"{}_{}.xml".format(platform, suffix))
json_platform_file = os.path.join(outdir,"{}_{}.json".format(platform, suffix))
filename = os.path.join(outdir,"{}_{}.xml".format(platform.normalized_name, suffix))
json_platform_file = os.path.join(outdir,"{}_{}.json".format(platform.normalized_name, suffix))
else:
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.json_report(json_platform_file, version=self.env.version, platform=platform)
filename = os.path.join(outdir,"{}.xml".format(platform.normalized_name))
json_platform_file = os.path.join(outdir,"{}.json".format(platform.normalized_name))
self.xunit_report(json_file, filename, platform.name, full_report=True)
self.json_report(json_platform_file, version=self.env.version, platform=platform.name)
7 changes: 3 additions & 4 deletions scripts/pylib/twister/twisterlib/testinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@ def __init__(self, testsuite, platform, outdir):

self.name = os.path.join(platform.name, testsuite.name)
self.dut = None
clean_platform_name = platform.name.replace("/", "_")

if testsuite.detailed_test_id:
self.build_dir = os.path.join(outdir, clean_platform_name, testsuite.name)
self.build_dir = os.path.join(outdir, platform.normalized_name, testsuite.name)
else:
# if suite is not in zephyr, keep only the part after ".." in reconstructed dir structure
source_dir_rel = testsuite.source_dir_rel.rsplit(os.pardir+os.path.sep, 1)[-1]
self.build_dir = os.path.join(outdir, clean_platform_name, source_dir_rel, testsuite.name)

self.build_dir = os.path.join(outdir, platform.normalized_name, source_dir_rel, testsuite.name)
self.run_id = self._get_run_id()
self.domains = None

Expand Down

0 comments on commit 5fb02a1

Please sign in to comment.