From: "'Felix Moessbauer' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: cedric.hombourger@siemens.com, jan.kiszka@siemens.com,
Felix Moessbauer <felix.moessbauer@siemens.com>
Subject: [PATCH 1/1] testsuite: add parameter to create kas config for current test
Date: Wed, 26 Aug 2026 15:03:02 +0200 [thread overview]
Message-ID: <20260826130302.1435152-1-felix.moessbauer@siemens.com> (raw)
Manually debugging a failed test is often a tedious operation, requiring
changes to the test definition itself. To make it easier, we provide a
parameter "kasconfig", which when set emits a kas config file for the
current test. This can be used in kas to interactively work with the
test configuration and set of targets.
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
testsuite/README.md | 4 +++
testsuite/cibase.py | 66 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+)
diff --git a/testsuite/README.md b/testsuite/README.md
index e65a5279..bd9e998a 100644
--- a/testsuite/README.md
+++ b/testsuite/README.md
@@ -32,6 +32,10 @@ $ avocado run ../testsuite/citest.py -t single --max-parallel-tasks=1 -p machine
$ avocado run ../testsuite/citest.py -t single --max-parallel-tasks=1 -p machine=qemuamd64 -p distro=bullseye -p depgraph=1
```
+To generate a kas configuration for manual debugging, add `-p kasconfig=1`.
+The configuration is written when the test starts to
+`{build_dir}/kas-{testname}.yaml`.
+
## Fast build test
```
diff --git a/testsuite/cibase.py b/testsuite/cibase.py
index 033b3b19..c5bc06c3 100755
--- a/testsuite/cibase.py
+++ b/testsuite/cibase.py
@@ -20,6 +20,9 @@ class CIBaseTest(CIBuilder):
if bool(int(self.params.get('depgraph', default=0))):
self.generate_dependency_graph(targets, reconfigure=False, **kwargs)
+ if bool(int(self.params.get('kasconfig', default=0))):
+ self.generate_kas_config(targets, **kwargs)
+
self.log.info("Starting build...")
self.bitbake(targets, should_fail=should_fail, **kwargs)
@@ -49,6 +52,69 @@ class CIBaseTest(CIBuilder):
f"{self.build_dir}/task-depends-{name}.dot"
)
+ def generate_kas_config(self, targets, **kwargs):
+ """
+ Debug helper to generate a kas config file for the current test.
+ """
+ import yaml
+
+ def get_config(path):
+ skiptoken = ('#', 'include', 'ISAR_ROOTLESS', 'BBMULTICONFIG', 'DL_DIR',
+ 'SSTATE_DIR', 'BB_HASHSERVE_DB_DIR')
+ conf = open(path, 'r').readlines()
+ conf = [l.strip('\n') for l in conf if not l.startswith(skiptoken) and l.strip()]
+ return conf
+
+ testname = re.sub(r'[^\w.-]', '_', str(self.name))
+ config_filename = f"{self.build_dir}/kas-{testname}.yaml"
+ self.log.info("Generating kas config...")
+
+ build_system = 'isar-rootless' \
+ if bool(int(self.params.get('rootless', default=0))) \
+ else 'isar-privileged'
+
+ local_conf = get_config(f"{self.build_dir}/conf/local.conf")
+ ci_conf = get_config(f"{self.build_dir}/conf/ci_build.conf")
+
+ # parse distro and machine from local.conf
+ assignment = r'\s*(?:\?\??)?=\s*"([^"]+)"'
+ local_conf_text = '\n'.join(local_conf)
+ distro = re.search(r'DISTRO' + assignment, local_conf_text).group(1)
+ machine = re.search(r'MACHINE' + assignment, local_conf_text).group(1)
+ local_conf = [l for l in local_conf if not l.startswith(('DISTRO', 'MACHINE'))]
+
+ class LiteralStr(str):
+ pass
+
+ def literal_str_representer(dumper, data):
+ return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|')
+
+ yaml.add_representer(LiteralStr, literal_str_representer)
+
+ cfg = {
+ 'header': {'version': 23},
+ 'build_system': build_system,
+ 'repos': {
+ 'isar': {
+ 'layers': {
+ 'meta': {},
+ 'meta-isar': {},
+ 'meta-test': {},
+ }
+ }
+ },
+ 'target': targets,
+ 'distro': distro,
+ 'machine': machine,
+ 'local_conf_header': {
+ '10-local': LiteralStr('\n'.join(local_conf)),
+ '20-ci': LiteralStr('\n'.join(ci_conf)),
+ }
+ }
+
+ with open(config_filename, 'w') as f:
+ yaml.dump(cfg, f)
+
def perform_wic_partition_test(self, targets, wic_deploy_parts, **kwargs):
self.configure(targets=targets, wic_deploy_parts=wic_deploy_parts, **kwargs)
self.bitbake(targets, **kwargs)
--
2.55.0
--
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/20260826130302.1435152-1-felix.moessbauer%40siemens.com.
next reply other threads:[~2026-08-26 13:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 13:03 'Felix Moessbauer' via isar-users [this message]
2026-08-31 11:49 ` Zhihang Wei
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=20260826130302.1435152-1-felix.moessbauer@siemens.com \
--to=isar-users@googlegroups.com \
--cc=cedric.hombourger@siemens.com \
--cc=felix.moessbauer@siemens.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