From: Petr Mladek <pmladek@suse.com>
To: Siddharth Menon <simeddon@gmail.com>
Cc: shuah@kernel.org, mbenes@suse.cz,
Shuah Khan <skhan@linuxfoundation.org>,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 2/3] selftests/lib.mk: Introduce check to validate required configs
Date: Tue, 10 Dec 2024 15:56:41 +0100 [thread overview]
Message-ID: <Z1hWqUMmr6pcadqD@pathway.suse.cz> (raw)
In-Reply-To: <20241205114757.5916-3-simeddon@gmail.com>
On Thu 2024-12-05 17:17:56, Siddharth Menon wrote:
> Currently, kselftests does not have a generalised mechanism to skip compilation
> and run tests when required kernel configuration flags are missing.
>
> This patch introduces a check to validate the presence of required config flags
> specified in the selftest makefile. In case scripts/config is not found,
> this check is skipped.
>
> Use TEST_CONFIG_DEPS to check for specific config options before compiling,
> example usage:
> ```
> TEST_CONFIG_DEPS := CONFIG_LIVEPATCH CONFIG_DYNAMIC_DEBUG
What is the reason to add another set of dependencies, please?
Both CONFIG_LIVEPATCH CONFIG_DYNAMIC_DEBUG are already mentioned in
tools/testing/selftests/livepatch/config
IMHO, the new check should read the dependencies
from the existing tools/testing/selftests/<test>/config file.
> --- a/tools/testing/selftests/lib.mk
> +++ b/tools/testing/selftests/lib.mk
> @@ -97,7 +97,21 @@ TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS))
> TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED))
> TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
>
> -all: $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) \
> +KDIR ?= /lib/modules/$(shell uname -r)/build
> +
> +define CHECK_CONFIG_DEPS
> + $(if $(wildcard $(KDIR)/scripts/config),
> + $(eval MISSING_FLAGS := $(filter-out 1,$(foreach cfg,$(TEST_CONFIG_DEPS),\
> + $(shell cd $(KDIR) && scripts/config --state $(cfg) | grep -q '^\(y\|m\)$$' && echo 1 || echo $(cfg))))),
> + $(info Skipping CHECK_GEN_REQ: $(KDIR)/scripts/config not found)
> + )
> + $(if $(MISSING_FLAGS),$(error Missing required config flags: $(MISSING_FLAGS)))
> +endef
It somehow does not work here. I get:
tools/testing/selftests/livepatch # make run_tests
grep: .config: No such file or directory
grep: .config: No such file or directory
grep: .config: No such file or directory
grep: .config: No such file or directory
../lib.mk:112: *** Missing required config flags: CONFIG_LIVEPATCH CONFIG_DYNAMIC_DEBUG. Stop.
I run the livepatch tests the following way.
1. On my workstation, I build the kernel RPMs using
make rpm-pkg
2. In qemu test system, I mount the build directory from the
workstation and install both kernel and kernel-devel packages:
rpm -ivh rpmbuild/RPMS/x86_64/kernel-6.12.0_default+-35.x86_64.rpm
rpm -ivh rpmbuild/RPMS/x86_64/kernel-devel-6.12.0_default+-35.x86_64.rpm
and reboot
3. In rebooted qemu test system, I mount once again the build
directory from the workstation and run the tests:
cd tools/testing/selftests/livepatch
make run_tests
The "grep" errors come from the "scripts/config" command. For example:
tools/testing/selftests/livepatch # /lib/modules/6.12.0-default+/build/scripts/config -s CONFIG_LIVEPATCH
grep: .config: No such file or directory
grep: .config: No such file or directory
undef
It helps to define patch to the config file installed by the devel
package:
tools/testing/selftests/livepatch # /lib/modules/6.12.0-default+/build/scripts/config --file /lib/modules/6.12.0-default+/config -s CONFIG_LIVEPATCH
y
But I am not sure if this works when people run the "make" in the
original build directory on the workstation.
Best Regards,
Petr
next prev parent reply other threads:[~2024-12-10 14:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 11:47 [PATCH 0/3] kselftest framework to introduce TEST_CONFIG_DEPS Siddharth Menon
2024-12-05 11:47 ` [PATCH 1/3] docs/kselftests: Explain the usage of TEST_CONFIG_DEPS Siddharth Menon
2024-12-10 14:30 ` Petr Mladek
2024-12-05 11:47 ` [PATCH 2/3] selftests/lib.mk: Introduce check to validate required configs Siddharth Menon
2024-12-05 15:35 ` Mark Brown
2024-12-06 19:20 ` BiscuitBobby
2024-12-06 19:50 ` Mark Brown
2024-12-06 20:12 ` BiscuitBobby
2024-12-10 14:56 ` Petr Mladek [this message]
2024-12-10 17:10 ` BiscuitBobby
2024-12-12 9:02 ` Petr Mladek
2024-12-05 11:47 ` [PATCH 3/3] selftests/livepatch: Check if required config options are enabled Siddharth Menon
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=Z1hWqUMmr6pcadqD@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=linux-kselftest@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=shuah@kernel.org \
--cc=simeddon@gmail.com \
--cc=skhan@linuxfoundation.org \
/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.