[v2,17/17] testsuite: skip VM tests if images are not available

Message ID 20251219131923.1504046-18-felix.moessbauer@siemens.com
State Under Review
Headers show
Series Various improvements to the testsuite | expand

Commit Message

Felix Moessbauer Dec. 19, 2025, 1:19 p.m. UTC
We currently fail the test if the image is not available. Instead, we
now skip it and report what is missing. By that, we stay semantically
correct by not failing tests when pre-conditions are not fulfilled.

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

Patch

diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index 614a3397..b64d808c 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -24,6 +24,7 @@  from utils import CIUtils
 from avocado import Test
 from avocado.utils import path
 from avocado.utils import process
+from avocado.core import exceptions
 
 sys.path.append(os.path.join(os.path.dirname(__file__), '../bitbake/lib'))
 
@@ -703,6 +704,7 @@  class CIBuilder(Test):
         keep=False,
     ):
         time_to_wait = self.params.get('time_to_wait', default=DEF_VM_TO_SEC)
+        self.skip_if_vm_image_missing(arch, distro, image)
 
         self.log.info("===================================================")
         self.log.info(f"Running Isar VM boot test for ({distro}-{arch})")
@@ -800,3 +802,20 @@  class CIBuilder(Test):
             self.vm_turn_off(vm)
 
         return stdout, stderr
+
+    def skip_if_vm_image_missing(self, arch, distro, image):
+        (
+            image_fstypes,
+            image_fullname,
+            deploy_dir_image,
+        ) = CIUtils.getVars(
+            'IMAGE_FSTYPES',
+            'IMAGE_FULLNAME',
+            'DEPLOY_DIR_IMAGE',
+            target=f"mc:qemu{arch}-{distro}:{image}",
+        )
+        image_type = image_fstypes.split()[0]
+        rootfs_image = f"{image_fullname}.{image_type}"
+        rootfs_image_path = os.path.join(deploy_dir_image, rootfs_image)
+        if not os.path.exists(rootfs_image_path):
+            raise exceptions.TestSkipError(f'VM image missing: {rootfs_image}')