From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 v2 6/6] configs: check the User Mode Linux KUnit config at build time
Date: Mon, 26 Oct 2026 23:34:24 +0100 [thread overview]
Message-ID: <20261026-b4-prep-khorenko-vstor-143636-uml-config-v2-6-76c8329592af@virtuozzo.com> (raw)
In-Reply-To: <20261026-b4-prep-khorenko-vstor-143636-uml-config-v2-0-76c8329592af@virtuozzo.com>
process_configs.sh resolves the um variant with dummy tools, which
claim every compiler feature. The build resolves it again with the real
compiler, where an option the um layer sets can still drop out: a
toolchain without KASAN support takes CONFIG_KASAN away, and the KASAN
checks of every test go with it, on a green run.
A KUnit test whose prompt stays visible under KUNIT_ALL_TESTS keeps the
=m of the generic layers, and UML loads no modules. process_configs.sh
takes =m as a valid value, so a test that a RHEL import adds this way
silently never runs.
check_um_config.sh fails the build when the resolved config:
- lost a value the um layer sets, or has an option on that it turns off
- has a KUnit test, a symbol defaulting to KUNIT_ALL_TESTS, as a module
It fails as well when it finds no um layer or no KUnit test to check
against, rather than pass having checked nothing. kernel.spec runs it
after olddefconfig, before building the kernel.
https://virtuozzo.atlassian.net/browse/VSTOR-143636
https://virtuozzo.atlassian.net/browse/VSTOR-148112
Feature: KUnit tests on User Mode Linux
Suggested-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
redhat/configs/check_um_config.sh | 66 +++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/redhat/configs/check_um_config.sh b/redhat/configs/check_um_config.sh
new file mode 100755
index 0000000000000..190bd3e256f5f
--- /dev/null
+++ b/redhat/configs/check_um_config.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+#
+# Check the config of the User Mode Linux KUnit kernel, the "um" variant,
+# once the build has resolved it with olddefconfig:
+#
+# check_um_config.sh CONFIG
+#
+# process_configs.sh resolves the variant with dummy tools, the build with
+# the real compiler, which can still drop an option the um layer sets. And
+# UML loads no modules, so a KUnit test left a module never runs.
+
+config=$1
+if [ ! -f "$config" ]; then
+ echo "usage: $0 CONFIG" >&2
+ exit 2
+fi
+
+dir=$(dirname "$(readlink -f "$0")")
+layer=$dir/custom-overrides/generic/um
+
+die()
+{
+ echo "$0: $1" >&2
+ exit 2
+}
+
+ls "$layer"/CONFIG_* > /dev/null 2>&1 || die "no um layer in $layer"
+
+kunit_tests=$(find "$dir/../.." -name 'Kconfig*' -print0 |
+ xargs -0 awk '
+ /^(menu)?config / { name = $2 }
+ /^[ \t]+default KUNIT_ALL_TESTS/ { print "CONFIG_" name }' |
+ sort -u)
+[ -n "$kunit_tests" ] || die "no KUnit test in the Kconfig files under $dir/../.."
+
+layer_lost()
+{
+ local line sym
+
+ cat "$layer"/CONFIG_* | while read -r line; do
+ case "$line" in
+ CONFIG_*=*)
+ grep -qxF -- "$line" "$config" ||
+ echo "$line: lost"
+ ;;
+ "# CONFIG_"*" is not set")
+ sym=${line#\# }
+ sym=${sym%% *}
+ grep "^$sym=" "$config" | sed "s/\$/: set, the um layer has it off/"
+ ;;
+ esac
+ done
+}
+
+kunit_modules()
+{
+ echo "$kunit_tests" | sed 's/$/=m/' | grep -xFf - "$config" |
+ sed 's/$/: a KUnit test left a module/'
+}
+
+bad=$(layer_lost; kunit_modules)
+if [ -n "$bad" ]; then
+ echo "$config is not the um config the KUnit kernel needs:"
+ echo "$bad"
+ exit 1
+fi
--
2.43.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-10-26 22:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 22:34 [Devel] [PATCH hci-8.1 v2 0/6] configs: a User Mode Linux kernel for the KUnit tests Konstantin Khorenko
2026-10-26 22:34 ` [Devel] [PATCH hci-8.1 v2 1/6] configs: add a User Mode Linux config " Konstantin Khorenko
2026-10-26 22:34 ` [Devel] [PATCH hci-8.1 v2 2/6] kasan: let a config leave the KUnit test out under KUNIT_ALL_TESTS Konstantin Khorenko
2026-10-26 22:34 ` [Devel] [PATCH hci-8.1 v2 3/6] configs: build the User Mode Linux KUnit kernel with KASAN Konstantin Khorenko
2026-10-26 22:34 ` [Devel] [PATCH hci-8.1 v2 4/6] configs: build the User Mode Linux KUnit kernel without debug info Konstantin Khorenko
2026-10-26 22:34 ` [Devel] [PATCH hci-8.1 v2 5/6] configs: turn off module-only subsystems in the User Mode Linux config Konstantin Khorenko
2026-10-26 22:34 ` Konstantin Khorenko [this message]
[not found] ` <0429d3d2-4664-4afa-a088-993344b6140f@virtuozzo.com>
2026-10-27 10:42 ` [Devel] [PATCH hci-8.1 v2 0/6] configs: a User Mode Linux kernel for the KUnit tests Konstantin Khorenko
2026-10-27 10:51 ` Konstantin Khorenko
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=20261026-b4-prep-khorenko-vstor-143636-uml-config-v2-6-76c8329592af@virtuozzo.com \
--to=khorenko@virtuozzo.com \
--cc=devel@openvz.org \
--cc=eva.kurchatova@virtuozzo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.