Skip to content

Commit 1abb4b8

Browse files
kartbennashif
andcommitted
twister: Add --keep-artifacts option
Introduce a new command-line option `--keep-artifacts` in twister that allows users to specify which artifacts should be preserved during test cleanup in addition to the default set. Signed-off-by: Benjamin Cabé <[email protected]> Co-authored-by: Anas Nashif <[email protected]>
1 parent d1beb70 commit 1abb4b8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

scripts/pylib/twister/twisterlib/environment.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,11 @@ def add_parse_arguments(parser = None) -> argparse.ArgumentParser:
578578
which only removes artifacts of passing tests. If you wish to
579579
remove all artificats including those of failed tests, use 'all'.""")
580580

581+
parser.add_argument(
582+
"--keep-artifacts", action="append", default=[],
583+
help="""Keep specified artifacts when cleaning up at runtime. Multiple invocations
584+
are possible."""
585+
)
581586
test_xor_generator.add_argument(
582587
"-N", "--ninja", action="store_true",
583588
default=not any(a in sys.argv for a in ("-k", "--make")),

scripts/pylib/twister/twisterlib/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,7 @@ def process(self, pipeline, done, message, lock, results):
12071207
mode == "passed"
12081208
or (mode == "all" and self.instance.reason != "CMake build failure")
12091209
):
1210-
self.cleanup_artifacts()
1210+
self.cleanup_artifacts(self.options.keep_artifacts)
12111211
except StatusAttributeError as sae:
12121212
logger.error(str(sae))
12131213
self.instance.status = TwisterStatus.ERROR

0 commit comments

Comments
 (0)