[v3,13/20] testsuite: make SignatureTest idempotent

Message ID 20260123082501.240751-14-wzh@ilbers.de
State Under Review
Headers show
Series Various improvements to the testsuite | expand

Commit Message

Zhihang Wei Jan. 23, 2026, 8:24 a.m. UTC
From: "MOESSBAUER, Felix" <felix.moessbauer@siemens.com>

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):