Skip to content

Commit

Permalink
twister: do not create overlays/run_id for filtered cases
Browse files Browse the repository at this point in the history
Avoid creating directories and files for instances that are filtered.

Signed-off-by: Anas Nashif <[email protected]>
  • Loading branch information
nashif committed Nov 30, 2024
1 parent 092e559 commit be6822a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion scripts/pylib/twister/twisterlib/testinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self, testsuite, platform, outdir):
source_dir_rel,
testsuite.name
)
self.run_id = self._get_run_id()
self.run_id = None
self.domains = None
# Instance need to use sysbuild if a given suite or a platform requires it
self.sysbuild = testsuite.sysbuild or platform.sysbuild
Expand All @@ -90,6 +90,9 @@ def __init__(self, testsuite, platform, outdir):
self.filters = []
self.filter_type = None

def setup_run_id(self):
self.run_id = self._get_run_id()

def record(self, recording, fname_csv="recording.csv"):
if recording:
if self.recording is None:
Expand Down
5 changes: 5 additions & 0 deletions scripts/pylib/twister/twisterlib/testplan.py
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,11 @@ def apply_filters(self, **kwargs):
self.add_instances(instance_list)

for _, case in self.instances.items():
# Do not create files for filtered instances
if case.status == TwisterStatus.FILTER:
continue
# set run_id for each unfiltered instance
case.setup_run_id()
case.create_overlay(case.platform,
self.options.enable_asan,
self.options.enable_ubsan,
Expand Down
2 changes: 1 addition & 1 deletion scripts/tests/twister_blackbox/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def test_platform_reports(self, capfd, out_path, test_path, test_platforms, file
pytest.fail(f"Unsupported file type: '{path}'")

for f_platform in test_platforms:
platform_path = os.path.join(out_path, f_platform.replace("/", "_"))
platform_path = os.path.join(out_path, f_platform.replace("/", "_") + ".json", )
assert os.path.exists(platform_path), f'file not found {f_platform}'

assert str(sys_exit.value) == '0'
Expand Down

0 comments on commit be6822a

Please sign in to comment.