All of lore.kernel.org
 help / color / mirror / Atom feed
* [for-linus][PATCH 0/2] ktest.pl: A couple of fixes for sending email results
@ 2020-12-18 16:44 Steven Rostedt
  2020-12-18 16:44 ` [for-linus][PATCH 1/2] ktest.pl: If size of log is too big to email, email error message Steven Rostedt
  2020-12-18 16:44 ` [for-linus][PATCH 2/2] ktest.pl: Fix the logic for truncating the size of the log file for email Steven Rostedt
  0 siblings, 2 replies; 3+ messages in thread
From: Steven Rostedt @ 2020-12-18 16:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: John Warthog9 Hawley


Steven Rostedt (VMware) (2):
      ktest.pl: If size of log is too big to email, email error message
      ktest.pl: Fix the logic for truncating the size of the log file for email

----
 tools/testing/ktest/ktest.pl | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

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

* [for-linus][PATCH 1/2] ktest.pl: If size of log is too big to email, email error message
  2020-12-18 16:44 [for-linus][PATCH 0/2] ktest.pl: A couple of fixes for sending email results Steven Rostedt
@ 2020-12-18 16:44 ` Steven Rostedt
  2020-12-18 16:44 ` [for-linus][PATCH 2/2] ktest.pl: Fix the logic for truncating the size of the log file for email Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2020-12-18 16:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: John Warthog9 Hawley, stable

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

If the size of the error log is too big to send via email, and the sending
fails, it wont email any result. This can be confusing for the user who is
waiting for an email on the completion of the tests.

If it fails to send email, then try again without the log file stating that
it failed to send an email. Obviously this will not be of use if the sending
of email failed for some other reasons, but it will at least give the user
some information when it fails for the most common reason.

Cc: stable@vger.kernel.org
Fixes: c2d84ddb338c8 ("ktest.pl: Add MAIL_COMMAND option to define how to send email")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tools/testing/ktest/ktest.pl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 54188ee16c48..54f7d008e840 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -4253,7 +4253,12 @@ sub do_send_mail {
     $mail_command =~ s/\$SUBJECT/$subject/g;
     $mail_command =~ s/\$MESSAGE/$message/g;
 
-    run_command $mail_command;
+    my $ret = run_command $mail_command;
+    if (!$ret && defined($file)) {
+	# try again without the file
+	$message .= "\n\n*** FAILED TO SEND LOG ***\n\n";
+	do_send_email($subject, $message);
+    }
 }
 
 sub send_email {
-- 
2.29.2



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

* [for-linus][PATCH 2/2] ktest.pl: Fix the logic for truncating the size of the log file for email
  2020-12-18 16:44 [for-linus][PATCH 0/2] ktest.pl: A couple of fixes for sending email results Steven Rostedt
  2020-12-18 16:44 ` [for-linus][PATCH 1/2] ktest.pl: If size of log is too big to email, email error message Steven Rostedt
@ 2020-12-18 16:44 ` Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2020-12-18 16:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: John Warthog9 Hawley, stable

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

The logic for truncating the log file for emailing based on the
MAIL_MAX_SIZE option is confusing and incorrect. Simplify it and have the
tail of the log file truncated to the max size specified in the config.

Cc: stable@vger.kernel.org
Fixes: 855d8abd2e8ff ("ktest.pl: Change the logic to control the size of the log file emailed")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tools/testing/ktest/ktest.pl | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 54f7d008e840..4e2450964517 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -1499,17 +1499,16 @@ sub dodie {
 	my $log_file;
 
 	if (defined($opt{"LOG_FILE"})) {
-	    my $whence = 0; # beginning of file
-	    my $pos = $test_log_start;
+	    my $whence = 2; # End of file
+	    my $log_size = tell LOG;
+	    my $size = $log_size - $test_log_start;
 
 	    if (defined($mail_max_size)) {
-		my $log_size = tell LOG;
-		$log_size -= $test_log_start;
-		if ($log_size > $mail_max_size) {
-		    $whence = 2; # end of file
-		    $pos = - $mail_max_size;
+		if ($size > $mail_max_size) {
+		    $size = $mail_max_size;
 		}
 	    }
+	    my $pos = - $size;
 	    $log_file = "$tmpdir/log";
 	    open (L, "$opt{LOG_FILE}") or die "Can't open $opt{LOG_FILE} to read)";
 	    open (O, "> $tmpdir/log") or die "Can't open $tmpdir/log\n";
-- 
2.29.2



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

end of thread, other threads:[~2020-12-18 16:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-18 16:44 [for-linus][PATCH 0/2] ktest.pl: A couple of fixes for sending email results Steven Rostedt
2020-12-18 16:44 ` [for-linus][PATCH 1/2] ktest.pl: If size of log is too big to email, email error message Steven Rostedt
2020-12-18 16:44 ` [for-linus][PATCH 2/2] ktest.pl: Fix the logic for truncating the size of the log file for email Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.