my $resolver; # name of the resolver backend (for human presentation)
-my $has_textaware; # set if running on a system that has a text mode concept
- # on files. Windows for example
-
my %skipped; # skipped{reason}=counter, reasons for skip
my @teststat; # teststat[testnum]=reason, reasons for skip
my %disabled_keywords; # key words of tests to skip
# This is a Windows MinGW build or native build, we need to use
# Windows-style path.
$pwd = sys_native_current_path();
- $has_textaware = 1;
$feature{"win32"} = 1;
# set if built with MinGW (as opposed to MinGW-w64)
$feature{"MinGW"} = 1 if ($curl =~ /-pc-mingw32/);
return 0;
}
+# Make sure all line endings in the array are the same: CRLF
+sub normalize_text {
+ my ($ref) = @_;
+ s/\r\n/\n/g for @$ref;
+ s/\n/\r\n/g for @$ref;
+}
#######################################################################
# Verify test succeeded
# get the mode attribute
my $filemode=$hash{'mode'};
- if($filemode && ($filemode eq "text") && $has_textaware) {
- # text mode when running on Windows: fix line endings
- s/\r\n/\n/g for @validstdout;
- s/\n/\r\n/g for @validstdout;
- s/\r\n/\n/g for @actual;
- s/\n/\r\n/g for @actual;
+ if($filemode && ($filemode eq "text")) {
+ normalize_text(\@validstdout);
+ normalize_text(\@actual);
}
if($hash{'nonewline'}) {
# text mode check in hyper-mode. Sometimes necessary if the stderr
# data *looks* like HTTP and thus has gotten CRLF newlines
# mistakenly
- s/\r\n/\n/g for @validstderr;
+ normalize_text(\@validstderr);
}
- if($filemode && ($filemode eq "text") && $has_textaware) {
- # text mode when running on Windows: fix line endings
- s/\r\n/\n/g for @validstderr;
- s/\n/\r\n/g for @validstderr;
+ if($filemode && ($filemode eq "text")) {
+ normalize_text(\@validstderr);
+ normalize_text(\@actual);
}
if($hash{'nonewline'}) {
my %replycheckpartattr = getpartattr("reply", "datacheck".$partsuffix);
# get the mode attribute
my $filemode=$replycheckpartattr{'mode'};
- if($filemode && ($filemode eq "text") && $has_textaware) {
- # text mode when running on Windows: fix line endings
- s/\r\n/\n/g for @replycheckpart;
- s/\n/\r\n/g for @replycheckpart;
+ if($filemode && ($filemode eq "text")) {
+ normalize_text(\@replycheckpart);
}
if($replycheckpartattr{'nonewline'}) {
# Yes, we must cut off the final newline from the final line
}
# get the mode attribute
my $filemode=$replyattr{'mode'};
- if($filemode && ($filemode eq "text") && $has_textaware) {
- # text mode when running on Windows: fix line endings
- s/\r\n/\n/g for @reply;
- s/\n/\r\n/g for @reply;
+ if($filemode && ($filemode eq "text")) {
+ normalize_text(\@reply);
}
if($replyattr{'crlf'} ||
($feature{"hyper"} && ($keywords{"HTTP"}
if(!$replyattr{'nocheck'} && (@reply || $replyattr{'sendzero'})) {
# verify the received data
my @out = loadarray($CURLOUT);
+
+ # get the mode attribute
+ my $filemode=$replyattr{'mode'};
+ if($filemode && ($filemode eq "text")) {
+ normalize_text(\@out);
+ }
$res = compare($runnerid, $testnum, $testname, "data", \@out, \@reply);
if ($res) {
return -1;
my @stripfilepar = getpart("verify", "stripfile".$partsuffix);
my $filemode=$hash{'mode'};
- if($filemode && ($filemode eq "text") && $has_textaware) {
- # text mode when running on Windows: fix line endings
- s/\r\n/\n/g for @outfile;
- s/\n/\r\n/g for @outfile;
+ if($filemode && ($filemode eq "text")) {
+ normalize_text(\@outfile);
+ normalize_text(\@generated);
}
if($hash{'crlf'} ||
($feature{"hyper"} && ($keywords{"HTTP"}