提交 855d8abd 编写于 作者: S Steven Rostedt (VMware)

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: NSteven Rostedt (VMware) <rostedt@goodmis.org>
上级 f9869002
...@@ -1499,18 +1499,21 @@ sub dodie { ...@@ -1499,18 +1499,21 @@ sub dodie {
my $log_file; my $log_file;
if (defined($opt{"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)) { if (defined($mail_max_size)) {
my $log_size = tell LOG; my $log_size = tell LOG;
$log_size -= $test_log_start; $log_size -= $test_log_start;
if ($log_size > $mail_max_size) { 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"; $log_file = "$tmpdir/log";
open (L, "$opt{LOG_FILE}") or die "Can't open $opt{LOG_FILE} to read)"; 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"; 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>) { while (<L>) {
print O; print O;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册