Commit d441734d authored by Steven Rostedt's avatar Steven Rostedt
Browse files

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/<20240819172028.3a7fae09@gandalf.local.home

>
Acked-by: default avatarJohn 'Warthog9' Hawley (Tenstorrent) <warthog9@eaglescrag.net>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 47ac09b9
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -222,6 +222,8 @@ my $install_time;
my $reboot_time;
my $test_time;

my $warning_found = 0;

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

@@ -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 {
@@ -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
@@ -2482,21 +2489,24 @@ 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}) {
		$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;
		}
	    }
	}
    }
    $no_reboot = $save_no_reboot;
    close(IN);
}