Skip to content

Commit 855d8ab

Browse files
committed
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) <[email protected]>
1 parent f986900 commit 855d8ab

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tools/testing/ktest/ktest.pl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,18 +1499,21 @@ sub dodie {
14991499
my $log_file;
15001500

15011501
if (defined($opt{"LOG_FILE"})) {
1502-
my $size = 0;
1502+
my $whence = 0; # beginning of file
1503+
my $pos = $test_log_start;
1504+
15031505
if (defined($mail_max_size)) {
15041506
my $log_size = tell LOG;
15051507
$log_size -= $test_log_start;
15061508
if ($log_size > $mail_max_size) {
1507-
$size = $log_size - $mail_max_size;
1509+
$whence = 2; # end of file
1510+
$pos = - $mail_max_size;
15081511
}
15091512
}
15101513
$log_file = "$tmpdir/log";
15111514
open (L, "$opt{LOG_FILE}") or die "Can't open $opt{LOG_FILE} to read)";
15121515
open (O, "> $tmpdir/log") or die "Can't open $tmpdir/log\n";
1513-
seek(L, $test_log_start + $size, 0);
1516+
seek(L, $pos, $whence);
15141517
while (<L>) {
15151518
print O;
15161519
}

0 commit comments

Comments
 (0)