Skip to content

Commit d441734

Browse files
committed
ktest.pl: Always warn on build warnings
If a warning happens at build, give a warning at the end: Build time: 1 minute 40 seconds Install time: 17 seconds Reboot time: 25 seconds *** WARNING found in build: 1 *** ******************************************* ******************************************* KTEST RESULT: TEST 1 SUCCESS!!!! ** ******************************************* ******************************************* This way, even if the test isn't made to fail on warnings during the build, a message is still displayed that warnings were found. Link: https://lore.kernel.org/<[email protected]> Acked-by: John 'Warthog9' Hawley (Tenstorrent) <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
1 parent 47ac09b commit d441734

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

tools/testing/ktest/ktest.pl

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@
222222
my $reboot_time;
223223
my $test_time;
224224

225+
my $warning_found = 0;
226+
225227
my $pwd;
226228
my $dirname = $FindBin::Bin;
227229

@@ -729,11 +731,18 @@ sub print_times {
729731
show_time($test_time);
730732
doprint "\n";
731733
}
734+
if ($warning_found) {
735+
doprint "\n*** WARNING";
736+
doprint "S" if ($warning_found > 1);
737+
doprint " found in build: $warning_found ***\n\n";
738+
}
739+
732740
# reset for iterations like bisect
733741
$build_time = 0;
734742
$install_time = 0;
735743
$reboot_time = 0;
736744
$test_time = 0;
745+
$warning_found = 0;
737746
}
738747

739748
sub get_mandatory_configs {
@@ -2460,8 +2469,6 @@ sub process_warning_line {
24602469
# Returns 1 if OK
24612470
# 0 otherwise
24622471
sub check_buildlog {
2463-
return 1 if (!defined $warnings_file);
2464-
24652472
my %warnings_list;
24662473

24672474
# Failed builds should not reboot the target
@@ -2482,18 +2489,21 @@ sub check_buildlog {
24822489
close(IN);
24832490
}
24842491

2485-
# If warnings file didn't exist, and WARNINGS_FILE exist,
2486-
# then we fail on any warning!
2487-
24882492
open(IN, $buildlog) or dodie "Can't open $buildlog";
24892493
while (<IN>) {
24902494
if (/$check_build_re/) {
24912495
my $warning = process_warning_line $_;
24922496

24932497
if (!defined $warnings_list{$warning}) {
2494-
fail "New warning found (not in $warnings_file)\n$_\n";
2495-
$no_reboot = $save_no_reboot;
2496-
return 0;
2498+
$warning_found++;
2499+
2500+
# If warnings file didn't exist, and WARNINGS_FILE exist,
2501+
# then we fail on any warning!
2502+
if (defined $warnings_file) {
2503+
fail "New warning found (not in $warnings_file)\n$_\n";
2504+
$no_reboot = $save_no_reboot;
2505+
return 0;
2506+
}
24972507
}
24982508
}
24992509
}

0 commit comments

Comments
 (0)