public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: "chris.larson via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: Cedric Hombourger <cedric.hombourger@siemens.com>,
	Christopher Larson <chris.larson@siemens.com>
Subject: [PATCH 3/3] testsuite: add 'customizations' test
Date: Tue, 11 Mar 2025 14:09:38 -0700	[thread overview]
Message-ID: <20250311210939.4090-4-chris.larson@siemens.com> (raw)
In-Reply-To: <20250311210939.4090-1-chris.larson@siemens.com>

From: Christopher Larson <chris.larson@siemens.com>

This test builds isar-image-ci with the hostname customization enabled, and
verifies that the customization applied correctly.

Signed-off-by: Christopher Larson <chris.larson@siemens.com>
---
 testsuite/cibuilder.py |  9 +++++++++
 testsuite/citest.py    | 21 +++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index b5b6a093..1746171e 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -109,6 +109,7 @@ def configure(
         source_date_epoch=None,
         use_apt_snapshot=False,
         image_install=None,
+        customizations=None,
         **kwargs,
     ):
         # write configuration file and set bitbake_args
@@ -155,6 +156,7 @@ def configure(
             f"  sstate_dir = {sstate_dir}\n"
             f"  ccache_dir = {ccache_dir}\n"
             f"  image_install = {image_install}\n"
+            f"  customizations = {customizations}\n"
             f"==================================================="
         )
 
@@ -216,6 +218,13 @@ def configure(
                 f.write('IMAGE_INSTALL = "%s"\n' % image_install)
             if fail_on_cleanup == '1':
                 f.write('ISAR_FAIL_ON_CLEANUP = "1"\n')
+            if customizations is not None:
+                if not isinstance(customizations, str):
+                    customizations = ' '.join(customizations)
+                f.write('CUSTOMIZATIONS = "%s"\n' % customizations)
+                f.write('CUSTOMIZATION_VARS:append = " ${IMAGE}"\n')
+                f.write('CUSTOMIZATION_FOR_IMAGES:append = " isar-image-ci"\n')
+                f.write('HOSTNAME:isar-image-ci = "isar-ci"\n')
 
         # include ci_build.conf in local.conf
         with open(self.build_dir + '/conf/local.conf', 'r+') as f:
diff --git a/testsuite/citest.py b/testsuite/citest.py
index 47f49263..66b39334 100755
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -345,6 +345,27 @@ def test_container_sdk(self):
         )
 
 
+class CustomizationsTest(CIBaseTest):
+    """
+    Test image customizations using the hostname-customizations package.
+
+    :avocado: tags=customizations,single,full
+    """
+
+    def test_single_customization(self):
+        self.init()
+        machine = self.params.get("machine", default="qemuamd64")
+        distro = self.params.get("distro", default="bullseye")
+
+        self.perform_build_test("mc:%s-%s:%s" % (machine, distro, "isar-image-ci"), customizations="hostname", image_install="")
+        self.vm_start(
+            machine.removeprefix('qemu'),
+            distro,
+            image="isar-image-ci",
+            cmd="hostname | grep isar-ci"
+        )
+
+
 class SignatureTest(CIBaseTest):
 
     """
-- 
2.47.2

-- 
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/20250311210939.4090-4-chris.larson%40siemens.com.

  parent reply	other threads:[~2025-03-11 21:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-11 21:09 [PATCH 0/3] Add 'customization' package support chris.larson via isar-users
2025-03-11 21:09 ` [PATCH 1/3] classes: add " chris.larson via isar-users
2025-03-11 21:09 ` [PATCH 2/3] hostname-customization: add initial customization package chris.larson via isar-users
2025-03-11 21:09 ` chris.larson via isar-users [this message]
2025-03-25 16:55 ` [PATCH 0/3] Add 'customization' package support Uladzimir Bely

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=20250311210939.4090-4-chris.larson@siemens.com \
    --to=isar-users@googlegroups.com \
    --cc=cedric.hombourger@siemens.com \
    --cc=chris.larson@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