diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2007-04-25 20:09:32 +0000 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2007-04-25 20:09:32 +0000 |
commit | 9bdb05b4d6aec79d5f6ef9a2627a746b368ec536 (patch) | |
tree | 129adb2a7a76752177ac447e7fd673052368ed03 | |
parent | 94b253fde793a7419f0eafe16b24f440d344a1c9 (diff) |
When displaying log files, truncate the really longs ones such as you
would get from a torture test.
-rwxr-xr-x | tests/runtests.pl | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/runtests.pl b/tests/runtests.pl index dd6490b44..b11438000 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -2446,10 +2446,15 @@ open(CMDLOG, ">$CURLLOG") || ####################################################################### +# Display the contents of the given file. Line endings are canonicalized +# and excessively long files are truncated sub displaylogcontent { my ($file)=@_; if(open(my $SINGLE, "<$file")) { my $lfcount; + my $linecount = 0; + my $truncate; + my @tail; while(my $string = <$SINGLE>) { $string =~ s/\r\n/\n/g; $string =~ s/[\r\f\032]/\n/g; @@ -2458,14 +2463,30 @@ sub displaylogcontent { if($lfcount == 1) { $string =~ s/\n//; $string =~ s/\s*\!$//; - logmsg " $string\n"; + $linecount++; + if ($truncate) { + push @tail, " $string\n"; + } else { + logmsg " $string\n"; + } } else { for my $line (split("\n", $string)) { $line =~ s/\s*\!$//; - logmsg " $line\n"; + $linecount++; + if ($truncate) { + push @tail, " $line\n"; + } else { + logmsg " $line\n"; + } } } + $truncate = $linecount > 1000; + } + if (@tail) { + logmsg "=== File too long: lines here were removed\n"; + # This won't work properly if time stamps are enabled in logmsg + logmsg join('',@tail[$#tail-200..$#tail]); } close($SINGLE); } |