[3/3] testsuite: make SignatureTest idempotent

Message ID 20251218102343.1074824-3-felix.moessbauer@siemens.com
State Under Review
Headers show
Series [1/3] testsuite: fix SignatureTest by avoiding absolute path in bblayers | expand

Commit Message

MOESSBAUER, Felix Dec. 18, 2025, 10:23 a.m. UTC
The SignatureTest copies the tmp dir for later comparison. However, this
currently fails in case the test was run before as the target dir then
already exists. We fix it by clearing the target dir upfront. We further
reduce the disk consumption by removing the tmp dir copy in case the
test was successfull. On error, we keep the copy for manual
analysis.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 testsuite/cibase.py | 4 ++++
 1 file changed, 4 insertions(+)

Patch

diff --git a/testsuite/cibase.py b/testsuite/cibase.py
index 5b0139de..5ef1a5b5 100755
--- a/testsuite/cibase.py
+++ b/testsuite/cibase.py
@@ -171,6 +171,7 @@  class CIBaseTest(CIBuilder):
         Generate signature data for target(s) and check for cacheability issues
         """
         self.configure(**kwargs)
+        self.delete_from_build_dir('tmp_before_sstate')
         self.move_in_build_dir('tmp', 'tmp_before_sstate')
         self.bitbake(targets, sig_handler='none')
 
@@ -190,6 +191,9 @@  class CIBaseTest(CIBuilder):
             for line in output.splitlines():
                 self.log.error(ansi_escape.sub('', line))
             self.fail("Detected cacheability issues")
+        else:
+            # on success, cleanup temporary copy (keep on failure to inspect)
+            self.delete_from_build_dir('tmp_before_sstate')
 
     def perform_sstate_test(self, image_target, package_target, **kwargs):
         def check_executed_tasks(target, expected):