[3/4] testsuite: add 'extra_lines' argument to configure

Message ID 20250411200852.51967-4-chris.larson@siemens.com
State New
Headers show
Series Add support for per-kernel recipe variants | expand

Commit Message

chris.larson April 11, 2025, 8:08 p.m. UTC
From: Christopher Larson <chris.larson@siemens.com>

This allows us to add extra lines to the configuration file, which is generally
useful, and will ease future creation of tests by avoiding the need to add new
arguments to the configure function for each configuration needed.

Signed-off-by: Christopher Larson <chris.larson@siemens.com>
---
 testsuite/cibuilder.py | 5 +++++
 1 file changed, 5 insertions(+)

Patch

diff --git a/testsuite/cibuilder.py b/testsuite/cibuilder.py
index e726ba87..f47d6a77 100755
--- a/testsuite/cibuilder.py
+++ b/testsuite/cibuilder.py
@@ -114,6 +114,7 @@  def configure(
         installer_distro=None,
         installer_device=None,
         customizations=None,
+        lines=None,
         **kwargs,
     ):
         # write configuration file and set bitbake_args
@@ -142,6 +143,7 @@  def configure(
         distro_apt_premir = os.getenv('DISTRO_APT_PREMIRRORS')
         fail_on_cleanup = os.getenv('ISAR_FAIL_ON_CLEANUP')
 
+        strlines = None if lines is None else '\\n'.join(lines)
         self.log.info(
             f"===================================================\n"
             f"Configuring build_dir {self.build_dir}\n"
@@ -162,6 +164,7 @@  def configure(
             f"  image_install = {image_install}\n"
             f"  installer_image = {installer_image}\n"
             f"  customizations = {customizations}\n"
+            f"  lines = {strlines}\n"
             f"==================================================="
         )
 
@@ -248,6 +251,8 @@  def configure(
                 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')
+            if lines is not None:
+                f.writelines((line + '\n' if not line.endswith('\n') else line) for line in lines)
 
         # include ci_build.conf in local.conf
         with open(self.build_dir + '/conf/local.conf', 'r+') as f: