[for-next][PATCH 1/9] ktest: Avoid undef warning when WARNINGS_FILE is unset

From: Steven Rostedt

Date: Mon Mar 16 2026 - 14:42:00 EST


From: =?UTF-8?q?Ricardo=20B=2E=20Marli=C3=A8re?= <rbm@xxxxxxxx>

check_buildlog() probes $warnings_file with -f even when WARNINGS_FILE is
not configured. Perl warns about the uninitialized value and adds noise to
the test log, which can hide the output we actually care about.

Check that WARNINGS_FILE is defined before testing whether the file exists.

Cc: John Hawley <warthog9@xxxxxxxxxxxxxx>
Cc: Andrea Righi <arighi@xxxxxxxxxx>
Cc: Marcos Paulo de Souza <mpdesouza@xxxxxxxx>
Cc: Matthieu Baerts <matttbe@xxxxxxxxxx>
Cc: Fernando Fernandez Mancera <fmancera@xxxxxxx>
Cc: Pedro Falcato <pfalcato@xxxxxxx>
Link: https://patch.msgid.link/20260307-ktest-fixes-v1-1-565d412f4925@xxxxxxxx
Fixes: 4283b169abfb ("ktest: Add make_warnings_file and process full warnings")
Signed-off-by: Ricardo B. Marlière <rbm@xxxxxxxx>
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
tools/testing/ktest/ktest.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 001c4df9f7df..f48ee64c69da 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -2508,7 +2508,7 @@ sub check_buildlog {
my $save_no_reboot = $no_reboot;
$no_reboot = 1;

- if (-f $warnings_file) {
+ if (defined($warnings_file) && -f $warnings_file) {
open(IN, $warnings_file) or
dodie "Error opening $warnings_file";

--
2.51.0