From: "'Felix Moessbauer' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH 2/2] testsuite: cleanup artifacts if not requested otherwise
Date: Tue, 17 Nov 2026 13:03:00 +0100 [thread overview]
Message-ID: <20261117120300.374231-3-felix.moessbauer@siemens.com> (raw)
In-Reply-To: <20261117120300.374231-1-felix.moessbauer@siemens.com>
In CI runs we often see issues that only appear if executing tests
individually instead of all in a row. This happens, because subsequent
builds do not start in a fresh environment. To improve this, we now
clean the build/tmp* dirs after executing a test class. As avocado test
does not natively support this, we add the cleanup as a last test. Due
to our test-internal dependencies, we still cannot cleanup after each
testcase.
If the cleanup is not desired (e.g. for manual analysis), setting
-p cleanup=0 skips it.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
testsuite/README.md | 2 ++
testsuite/cibase.py | 18 ++++++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/testsuite/README.md b/testsuite/README.md
index 07bcfaf2..461e8c53 100644
--- a/testsuite/README.md
+++ b/testsuite/README.md
@@ -36,6 +36,8 @@ To generate a kas configuration for manual debugging, add `-p kasconfig=1`.
The configuration is written when the test starts to
`{build_dir}/kas-{testname}.yaml`.
+Artifacts are removed after each test class unless you pass `-p cleanup=0`.
+
To build against a specific Debian snapshot date, add `-p sde=<SOURCE_DATE_EPOCH>`.
## Fast build test
diff --git a/testsuite/cibase.py b/testsuite/cibase.py
index 3f44e8ac..f824ae11 100755
--- a/testsuite/cibase.py
+++ b/testsuite/cibase.py
@@ -14,6 +14,24 @@ from avocado.utils import process
class CIBaseTest(CIBuilder):
+ def test_cleanup_artifacts(self):
+ """
+ Workaround for missing class teardown support: Cleanup
+ the build/tmp so that the next test class starts in
+ a clean environment. This test comes last, according
+ to the python class inheritance order.
+ """
+ if not bool(int(self.params.get('cleanup', default=1))):
+ return
+
+ self.init()
+ rootless = bool(int(self.params.get('rootless', default=0)))
+ clean_cmd = f"{isar_root}/scripts/isar-clean-builddir"
+ if rootless:
+ clean_cmd += " --rootless"
+ for tmp_dir in glob.glob(self.build_dir + '/' + 'tmp*'):
+ process.run(f"{clean_cmd} {tmp_dir}")
+
def perform_build_test(self, targets, should_fail=False, **kwargs):
self.configure(targets=targets, **kwargs)
--
2.55.0
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20261117120300.374231-3-felix.moessbauer%40siemens.com.
prev parent reply other threads:[~2026-11-17 12:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 12:02 [PATCH 0/2] Isolate test classes, make them reproducible 'Felix Moessbauer' via isar-users
2026-11-17 12:02 ` [PATCH 1/2] testsuite: add support to run testsuite against specific SDE 'Felix Moessbauer' via isar-users
2026-11-17 12:03 ` 'Felix Moessbauer' via isar-users [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261117120300.374231-3-felix.moessbauer@siemens.com \
--to=isar-users@googlegroups.com \
--cc=felix.moessbauer@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox