[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241205144807.6962b57a@gandalf.local.home>
Date: Thu, 5 Dec 2024 14:48:07 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: "Ricardo B. Marliere" <rbm@...e.com>
Cc: John Hawley <warthog9@...lescrag.net>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ktest: Check kernelrelease return in get_version
On Thu, 05 Dec 2024 16:20:50 -0300
"Ricardo B. Marliere" <rbm@...e.com> wrote:
> In the case of a test that uses the special option ${KERNEL_VERSION} in one
> of its settings but has no configuration available in ${OUTPUT_DIR}, for
> example if it's a new empty directory, then the `make kernelrelease` call
> will fail and the subroutine will chomp an empty string, silently. Fix that
> by adding an empty configuration and retrying.
>
> Signed-off-by: Ricardo B. Marliere <rbm@...e.com>
> ---
> Hi! I'm not sure if this is the best fix, but here's the gist of the
> problem:
>
> If the test has something like:
> POST_BUILD = echo ${KERNEL_VERSION}
>
> Then the option will be evaluated in __eval_option which calls get_version
> before there's any configuration within ${OUTPUT_DIR}. Like if the
> following happened:
>
> 16:08:09 rbmarliere@...nsuse ~/src/linux/kernel/master master
> $ git clean -fdx
> Removing build/
> 16:08:13 rbmarliere@...nsuse ~/src/linux/kernel/master master
> $ make O=build/ kernelrelease
> make[1]: Entering directory '~/src/linux/kernel/master/build'
> ~/src/linux/kernel/master/Makefile:777: include/config/auto.conf: No such file or directory
> make[1]: *** [~/src/linux/kernel/master/Makefile:251: __sub-make] Error 2
> make[1]: Leaving directory '~/src/linux/kernel/master/build'
> make: *** [Makefile:251: __sub-make] Error 2
> ---
> tools/testing/ktest/ktest.pl | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
> index dacad94e2be42a86f9680fcb50b65d1f3a78afb5..a57b6cb9d817e2a3351a64de96092bd47733f5e3 100755
> --- a/tools/testing/ktest/ktest.pl
> +++ b/tools/testing/ktest/ktest.pl
> @@ -2419,6 +2419,11 @@ sub get_version {
> return if ($have_version);
> doprint "$make kernelrelease ... ";
> $version = `$make -s kernelrelease | tail -1`;
> + if (!$version) {
That should probably instead be:
if (!length($version)) {
[..]
-- Steve
> + run_command "$make allnoconfig" or return 0;
> + doprint "$make kernelrelease ... ";
> + $version = `$make -s kernelrelease | tail -1`;
> + }
> chomp($version);
> doprint "$version\n";
> $have_version = 1;
>
> ---
> base-commit: 9d6a414ad31e8eb296cd6f2c1834b2c6994960a0
> change-id: 20241205-ktest_kver_fallback-d42e62fb8d88
>
> Best regards,
Powered by blists - more mailing lists