public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Felix Moessbauer <felix.moessbauer@siemens.com>
To: isar-users@googlegroups.com
Cc: henning.schild@siemens.com, adriaan.schmidt@siemens.com,
	jan.kiszka@siemens.com, ibr@ilbers.de, amikan@ilbers.de,
	Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH v5 4/5] add test for wic partition deploy logic
Date: Mon, 19 Sep 2022 13:20:34 +0200	[thread overview]
Message-ID: <20220919112035.830233-5-felix.moessbauer@siemens.com> (raw)
In-Reply-To: <20220919112035.830233-1-felix.moessbauer@siemens.com>

This patch adds tests to check if the wic partition files
are copied to the deploydir if requested.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 testsuite/cibase.py    | 10 ++++++++++
 testsuite/cibuilder.py |  5 ++++-
 testsuite/citest.py    | 23 +++++++++++++++++++++++
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/testsuite/cibase.py b/testsuite/cibase.py
index 722d7bd2..6239b4de 100755
--- a/testsuite/cibase.py
+++ b/testsuite/cibase.py
@@ -17,6 +17,16 @@ class CIBaseTest(CIBuilder):
 
         self.bitbake(targets, **kwargs)
 
+    def perform_wic_partition_test(self, targets, wic_deploy_parts, **kwargs):
+        self.configure(wic_deploy_parts=wic_deploy_parts, **kwargs)
+        self.bitbake(targets, **kwargs)
+
+        partition_files = set(glob.glob(f'{self.build_dir}/tmp/deploy/images/*/*.wic.p1'))
+        if wic_deploy_parts and len(partition_files) == 0:
+            self.fail('Found raw wic partitions in DEPLOY_DIR')
+        if not wic_deploy_parts and len(partition_files) != 0:
+            self.fail('Did not find raw wic partitions in DEPLOY_DIR')
+
     def perform_repro_test(self, targets, signed=False, **kwargs):
         gpg_pub_key = os.path.dirname(__file__) + '/keys/base-apt/test_pub.key'
         gpg_priv_key = os.path.dirname(__file__) + '/keys/base-apt/test_priv.key'
diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index dfb0a376..d5c83b22 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -54,7 +54,7 @@ class CIBuilder(Test):
 
     def configure(self, compat_arch=True, cross=None, debsrc_cache=False,
                   container=False, ccache=False, sstate=False, offline=False,
-                  gpg_pub_key=None, **kwargs):
+                  gpg_pub_key=None, wic_deploy_parts=False, **kwargs):
         # write configuration file and set bitbake_args
         # can run multiple times per test case
         self.check_init()
@@ -77,6 +77,7 @@ class CIBuilder(Test):
                       f'  ccache = {ccache}\n'
                       f'  sstate = {sstate}\n'
                       f'  gpg_pub_key = {gpg_pub_key}\n'
+                      f'  wic_deploy_parts = {wic_deploy_parts}\n'
                       f'===================================================')
 
         # determine bitbake_args
@@ -105,6 +106,8 @@ class CIBuilder(Test):
                 f.write('IMAGE_INSTALL_remove = "example-module-${KERNEL_NAME} enable-fsck"\n')
             if gpg_pub_key:
                 f.write('BASE_REPO_KEY="file://' + gpg_pub_key + '"\n')
+            if wic_deploy_parts:
+                f.write('WIC_DEPLOY_PARTITIONS = "1"\n')
             if distro_apt_premir:
                 f.write('DISTRO_APT_PREMIRRORS = "%s"\n' % distro_apt_premir)
             if ccache:
diff --git a/testsuite/citest.py b/testsuite/citest.py
index 6c8eb26e..8381f21c 100755
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -223,6 +223,29 @@ class RebuildTest(CIBaseTest):
         finally:
             self.restorefile(dpkgbase_file)
 
+class WicTest(CIBaseTest):
+
+    """
+    Test creation of wic images
+
+    :avocado: tags=wic,full
+    """
+    def test_wic_nodeploy_partitions(self):
+        targets = ['mc:qemuarm64-bookworm:isar-image-base']
+
+        self.init()
+        self.delete_from_build_dir('tmp')
+        self.perform_wic_partition_test(targets,
+            wic_deploy_parts=False, debsrc_cache=True, compat_arch=False)
+
+    def test_wic_deploy_partitions(self):
+        targets = ['mc:qemuarm64-bookworm:isar-image-base']
+
+        self.init()
+        # reuse artifacts
+        self.perform_wic_partition_test(targets,
+            wic_deploy_parts=True, debsrc_cache=True, compat_arch=False)
+
 class ContainerImageTest(CIBaseTest):
 
     """
-- 
2.30.2


  parent reply	other threads:[~2022-09-19 11:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-19 11:20 [PATCH v5 0/5] use xz and gzip on host (outside chroot) Felix Moessbauer
2022-09-19 11:20 ` [PATCH v5 1/5] do not crossbuild SDK for host-arch eq dist-arch Felix Moessbauer
2022-09-19 11:20 ` [PATCH v5 2/5] run imager in buildchroot-host on cross Felix Moessbauer
2022-09-19 11:20 ` [PATCH v5 3/5] add option to control deploy of raw wic partitions Felix Moessbauer
2022-09-19 12:03   ` Henning Schild
2022-09-19 12:22     ` Moessbauer, Felix
2022-09-20  7:55   ` Henning Schild
2022-09-20  8:39     ` Jan Kiszka
2022-09-20 12:23       ` Henning Schild
2022-09-20 10:49     ` Henning Schild
2022-09-19 11:20 ` Felix Moessbauer [this message]
2022-09-19 11:20 ` [PATCH v5 5/5] add wic.xz image to qemuarm64-bookworm Felix Moessbauer

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=20220919112035.830233-5-felix.moessbauer@siemens.com \
    --to=felix.moessbauer@siemens.com \
    --cc=adriaan.schmidt@siemens.com \
    --cc=amikan@ilbers.de \
    --cc=henning.schild@siemens.com \
    --cc=ibr@ilbers.de \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@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