mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] ktest: Check kernelrelease return in get_version
@ 2024-12-05 20:50 Ricardo B. Marliere
  0 siblings, 0 replies; only message in thread
From: Ricardo B. Marliere @ 2024-12-05 20:50 UTC (permalink / raw)
  To: Steven Rostedt, John Hawley; +Cc: linux-kernel, Ricardo B. Marliere

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@suse.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@suse.com>


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-12-05 20:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-05 20:50 [PATCH v2] ktest: Check kernelrelease return in get_version Ricardo B. Marliere

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®