All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: "John Warthog9 Hawley" <warthog9@kernel.org>
Subject: [for-linus][PATCH 1/2] ktest.pl: Change the logic to control the size of the log file emailed
Date: Mon, 10 Aug 2020 14:28:37 -0400	[thread overview]
Message-ID: <20200810182901.020100850@goodmis.org> (raw)
In-Reply-To: 20200810182836.746909615@goodmis.org

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

If the log file for a given test is larger than the max size given then use
set the seek from the end of the log file instead of from the start of the
test.

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

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index 36db5b0b3647..9363a5b27339 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -1499,18 +1499,21 @@ sub dodie {
 	my $log_file;
 
 	if (defined($opt{"LOG_FILE"})) {
-	    my $size = 0;
+	    my $whence = 0; # beginning of file
+	    my $pos = $test_log_start;
+
 	    if (defined($mail_max_size)) {
 		my $log_size = tell LOG;
 		$log_size -= $test_log_start;
 		if ($log_size > $mail_max_size) {
-		    $size = $log_size - $mail_max_size;
+		    $whence = 2; # end of file
+		    $pos = - $mail_max_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";
-	    seek(L, $test_log_start + $size, 0);
+	    seek(L, $pos, $whence);
 	    while (<L>) {
 		print O;
 	    }
-- 
2.28.0



  reply	other threads:[~2020-08-10 18:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-10 18:28 [for-linus][PATCH 0/2] ktest: A couple more updates before asking for a pull request Steven Rostedt
2020-08-10 18:28 ` Steven Rostedt [this message]
2020-08-10 18:28 ` [for-linus][PATCH 2/2] ktest.pl: Fix spelling mistake "Cant" -> "Cant" Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200810182901.020100850@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=warthog9@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.