mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ricardo B. Marliere" <rbm@suse.com>
To: Steven Rostedt <rostedt@goodmis.org>,
	 John Hawley <warthog9@eaglescrag.net>
Cc: linux-kernel@vger.kernel.org, "Ricardo B. Marliere" <rbm@suse.com>
Subject: [PATCH v2] ktest: Check kernelrelease return in get_version
Date: Thu, 05 Dec 2024 17:50:35 -0300	[thread overview]
Message-ID: <20241205-ktest_kver_fallback-v2-1-869dae4c7777@suse.com> (raw)

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>


                 reply	other threads:[~2024-12-05 20:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20241205-ktest_kver_fallback-v2-1-869dae4c7777@suse.com \
    --to=rbm@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=warthog9@eaglescrag.net \
    /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 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®