[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20241205-ktest_kver_fallback-v2-1-869dae4c7777@suse.com>
Date: Thu, 05 Dec 2024 17:50:35 -0300
From: "Ricardo B. Marliere" <rbm@...e.com>
To: Steven Rostedt <rostedt@...dmis.org>,
John Hawley <warthog9@...lescrag.net>
Cc: linux-kernel@...r.kernel.org, "Ricardo B. Marliere" <rbm@...e.com>
Subject: [PATCH v2] ktest: Check kernelrelease return in get_version
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>
---
Changes in v2:
- Fixed the if statement to use length()
- Link to v1: https://lore.kernel.org/r/20241205-ktest_kver_fallback-v1-1-8029b9189527@suse.com
---
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..171262915636b6287e6639e95be5420b5bc8e0df 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 (!length($version)) {
+ 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,
--
Ricardo B. Marliere <rbm@...e.com>
Powered by blists - more mailing lists