* [PATCH 1/1] testsuite: add parameter to create kas config for current test
@ 2026-08-26 13:03 'Felix Moessbauer' via isar-users
2026-08-31 11:49 ` Zhihang Wei
0 siblings, 1 reply; 2+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2026-08-26 13:03 UTC (permalink / raw)
To: isar-users; +Cc: cedric.hombourger, jan.kiszka, Felix Moessbauer
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.
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 1/1] testsuite: add parameter to create kas config for current test
2026-08-26 13:03 [PATCH 1/1] testsuite: add parameter to create kas config for current test 'Felix Moessbauer' via isar-users
@ 2026-08-31 11:49 ` Zhihang Wei
0 siblings, 0 replies; 2+ messages in thread
From: Zhihang Wei @ 2026-08-31 11:49 UTC (permalink / raw)
To: Felix Moessbauer, isar-users; +Cc: cedric.hombourger, jan.kiszka
Applied to next, thanks.
Zhihang
On 8/26/26 15:03, 'Felix Moessbauer' via isar-users wrote:
> 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)
--
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/1a6485e3-9e46-476f-9d39-5c4afbc7a98b%40ilbers.de.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-31 11:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-26 13:03 [PATCH 1/1] testsuite: add parameter to create kas config for current test 'Felix Moessbauer' via isar-users
2026-08-31 11:49 ` Zhihang Wei
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox