Skip to content

Commit

Permalink
Merge tag 'ktest-v6.12' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/rostedt/linux-ktest

Pull ktest updates from Steven Rostedt:

 - Add notification of build warnings for all tests

   Currently, the build will only fail on warnings if the ktest config
   file states that it should fail or if the compile is done with
   '-Werror'. This has allowed warnings to sneak in if it doesn't fail.

   Add a notification at the end of the test that will state that
   warnings were found in the build so that the developer will be aware
   of it.

 - Fix the grub2 parser to not return the wrong kernel index

   ktest.pl can read the grub.cfg file to know what kernel to boot to
   via grub-reboot. This requires knowing the index that the kernel is
   referenced by in the grub.cfg file. Some distros have logic to
   determine the menuentry that can cause the ktest.pl to come up with
   the wrong index and boot the wrong kernel.

* tag 'ktest-v6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest:
  ktest.pl: Avoid false positives with grub2 skip regex
  ktest.pl: Always warn on build warnings
  • Loading branch information
Linus Torvalds committed Sep 22, 2024
2 parents 891e8ab + 2351e8c commit dd609b8
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions tools/testing/ktest/ktest.pl
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@
my $reboot_time;
my $test_time;

my $warning_found = 0;

my $pwd;
my $dirname = $FindBin::Bin;

Expand Down Expand Up @@ -729,11 +731,18 @@ sub print_times {
show_time($test_time);
doprint "\n";
}
if ($warning_found) {
doprint "\n*** WARNING";
doprint "S" if ($warning_found > 1);
doprint " found in build: $warning_found ***\n\n";
}

# reset for iterations like bisect
$build_time = 0;
$install_time = 0;
$reboot_time = 0;
$test_time = 0;
$warning_found = 0;
}

sub get_mandatory_configs {
Expand Down Expand Up @@ -2047,7 +2056,7 @@ sub get_grub_index {
} elsif ($reboot_type eq "grub2") {
$command = "cat $grub_file";
$target = '^\s*menuentry.*' . $grub_menu_qt;
$skip = '^\s*menuentry';
$skip = '^\s*menuentry\s';
$submenu = '^\s*submenu\s';
} elsif ($reboot_type eq "grub2bls") {
$command = $grub_bls_get;
Expand Down Expand Up @@ -2460,8 +2469,6 @@ sub process_warning_line {
# Returns 1 if OK
# 0 otherwise
sub check_buildlog {
return 1 if (!defined $warnings_file);

my %warnings_list;

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

# If warnings file didn't exist, and WARNINGS_FILE exist,
# then we fail on any warning!

open(IN, $buildlog) or dodie "Can't open $buildlog";
while (<IN>) {
if (/$check_build_re/) {
my $warning = process_warning_line $_;

if (!defined $warnings_list{$warning}) {
fail "New warning found (not in $warnings_file)\n$_\n";
$no_reboot = $save_no_reboot;
return 0;
$warning_found++;

# If warnings file didn't exist, and WARNINGS_FILE exist,
# then we fail on any warning!
if (defined $warnings_file) {
fail "New warning found (not in $warnings_file)\n$_\n";
$no_reboot = $save_no_reboot;
return 0;
}
}
}
}
Expand Down

0 comments on commit dd609b8

Please sign in to comment.