Changed the long logfile elision code in runtests.pl to properly handle

lines ending in \r.
This commit is contained in:
Dan Fandrich
2008-07-24 02:16:48 +00:00
parent 27c282a6ee
commit 932b589780
2 changed files with 20 additions and 25 deletions

View File

@@ -6,6 +6,14 @@
Changelog Changelog
Daniel Fandrich (23 Jul 2008)
- Changed the long logfile elision code in runtests.pl to properly handle
lines ending in \r.
- Changed references to TRUE and FALSE in the curl_easy_setopt man page to
1 and zero, respectively, since TRUE and FALSE aren't part of the
libcurl API.
Daniel Stenberg (23 Jul 2008) Daniel Stenberg (23 Jul 2008)
- I went over the curl_easy_setopt man page and replaced most references to - I went over the curl_easy_setopt man page and replaced most references to
non-zero with the fixed value of 1. We should strive at making options non-zero with the fixed value of 1. We should strive at making options

View File

@@ -2963,11 +2963,10 @@ open(CMDLOG, ">$CURLLOG") ||
####################################################################### #######################################################################
# Display the contents of the given file. Line endings are canonicalized # Display the contents of the given file. Line endings are canonicalized
# and excessively long files are truncated # and excessively long files are elided
sub displaylogcontent { sub displaylogcontent {
my ($file)=@_; my ($file)=@_;
if(open(SINGLE, "<$file")) { if(open(SINGLE, "<$file")) {
my $lfcount;
my $linecount = 0; my $linecount = 0;
my $truncate; my $truncate;
my @tail; my @tail;
@@ -2975,30 +2974,18 @@ sub displaylogcontent {
$string =~ s/\r\n/\n/g; $string =~ s/\r\n/\n/g;
$string =~ s/[\r\f\032]/\n/g; $string =~ s/[\r\f\032]/\n/g;
$string .= "\n" unless ($string =~ /\n$/); $string .= "\n" unless ($string =~ /\n$/);
$lfcount = $string =~ tr/\n//; $string =~ tr/\n//;
if($lfcount == 1) {
$string =~ s/\n//;
$string =~ s/\s*\!$//;
$linecount++;
if ($truncate) {
push @tail, " $string\n";
} else {
logmsg " $string\n";
}
}
else {
for my $line (split("\n", $string)) { for my $line (split("\n", $string)) {
$line =~ s/\s*\!$//; $line =~ s/\s*\!$//;
$linecount++;
if ($truncate) { if ($truncate) {
push @tail, " $line\n"; push @tail, " $line\n";
} else { } else {
logmsg " $line\n"; logmsg " $line\n";
} }
} $linecount++;
}
$truncate = $linecount > 1000; $truncate = $linecount > 1000;
} }
}
if (@tail) { if (@tail) {
logmsg "=== File too long: lines here were removed\n"; logmsg "=== File too long: lines here were removed\n";
# This won't work properly if time stamps are enabled in logmsg # This won't work properly if time stamps are enabled in logmsg