aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/ktest/ktest.pl
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2020-07-02 09:56:15 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2020-08-10 14:21:09 -0400
commit855d8abd2e8ff6d17c0b0a76be52fcd80bb6d886 (patch)
treec8fc7a4b66e212bf3c13dcce5f8dc6625aa852e7 /tools/testing/ktest/ktest.pl
parentktest.pl: Add MAIL_MAX_SIZE to limit the amount of log emailed (diff)
downloadlinux-dev-855d8abd2e8ff6d17c0b0a76be52fcd80bb6d886.tar.xz
linux-dev-855d8abd2e8ff6d17c0b0a76be52fcd80bb6d886.zip
ktest.pl: Change the logic to control the size of the log file emailed
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>
Diffstat (limited to 'tools/testing/ktest/ktest.pl')
-rwxr-xr-xtools/testing/ktest/ktest.pl9
1 files 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;
}