mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ktest.pl: Always warn on build warnings
@ 2024-08-19 21:20 Steven Rostedt
  2024-08-19 22:42 ` John 'Warthog9' Hawley
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2024-08-19 21:20 UTC (permalink / raw)
  To: LKML; +Cc: John 'Warthog9' Hawley

From: Steven Rostedt <rostedt@goodmis.org>

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.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 tools/testing/ktest/ktest.pl | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index eb31cd9c977b..c82b8d55dddb 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -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,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;
+		}
 	    }
 	}
     }
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ktest.pl: Always warn on build warnings
  2024-08-19 21:20 [PATCH] ktest.pl: Always warn on build warnings Steven Rostedt
@ 2024-08-19 22:42 ` John 'Warthog9' Hawley
  0 siblings, 0 replies; 2+ messages in thread
From: John 'Warthog9' Hawley @ 2024-08-19 22:42 UTC (permalink / raw)
  To: Steven Rostedt, LKML

Acked-by: John 'Warthog9' Hawley (Tenstorrent) <warthog9@eaglescrag.net>

On 8/19/2024 2:20 PM, Steven Rostedt wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
> 
> 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.
> 
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
>   tools/testing/ktest/ktest.pl | 26 ++++++++++++++++++--------
>   1 file changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
> index eb31cd9c977b..c82b8d55dddb 100755
> --- a/tools/testing/ktest/ktest.pl
> +++ b/tools/testing/ktest/ktest.pl
> @@ -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,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;
> +		}
>   	    }
>   	}
>       }


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-19 22:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-19 21:20 [PATCH] ktest.pl: Always warn on build warnings Steven Rostedt
2024-08-19 22:42 ` John 'Warthog9' Hawley

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®