mirror of
https://github.com/moparisthebest/curl
synced 2025-02-28 09:21:50 -05:00
tests: support test definitions with up to 5 file checks in <verify> section
This is done introducing tags <file1> to <file4> besides existing <file> one, as well as corresponding <stripfile1> to <stripfile4> ones, that can be used in the <verify> section in the same way as the non-numbered ones.
This commit is contained in:
parent
54d484e136
commit
00dd45720e
@ -3496,53 +3496,55 @@ sub singletest {
|
|||||||
$ok .= "-"; # protocol not checked
|
$ok .= "-"; # protocol not checked
|
||||||
}
|
}
|
||||||
|
|
||||||
my @outfile=getpart("verify", "file");
|
my $outputok;
|
||||||
if(@outfile) {
|
for my $partsuffix (('', '1', '2', '3', '4')) {
|
||||||
# we're supposed to verify a dynamically generated file!
|
my @outfile=getpart("verify", "file".$partsuffix);
|
||||||
my %hash = getpartattr("verify", "file");
|
if(@outfile) {
|
||||||
|
# we're supposed to verify a dynamically generated file!
|
||||||
|
my %hash = getpartattr("verify", "file".$partsuffix);
|
||||||
|
|
||||||
my $filename=$hash{'name'};
|
my $filename=$hash{'name'};
|
||||||
if(!$filename) {
|
if(!$filename) {
|
||||||
logmsg "ERROR: section verify=>file has no name attribute\n";
|
logmsg "ERROR: section verify=>file$partsuffix ".
|
||||||
stopservers($verbose);
|
"has no name attribute\n";
|
||||||
# timestamp test result verification end
|
stopservers($verbose);
|
||||||
$timevrfyend{$testnum} = Time::HiRes::time() if($timestats);
|
# timestamp test result verification end
|
||||||
return -1;
|
$timevrfyend{$testnum} = Time::HiRes::time() if($timestats);
|
||||||
}
|
return -1;
|
||||||
my @generated=loadarray($filename);
|
|
||||||
|
|
||||||
# what parts to cut off from the file
|
|
||||||
my @stripfile = getpart("verify", "stripfile");
|
|
||||||
|
|
||||||
my $filemode=$hash{'mode'};
|
|
||||||
if($filemode && ($filemode eq "text") && $has_textaware) {
|
|
||||||
# text mode when running on windows means adding an extra
|
|
||||||
# strip expression
|
|
||||||
push @stripfile, "s/\r\n/\n/";
|
|
||||||
}
|
|
||||||
|
|
||||||
my $strip;
|
|
||||||
for $strip (@stripfile) {
|
|
||||||
chomp $strip;
|
|
||||||
for(@generated) {
|
|
||||||
eval $strip;
|
|
||||||
}
|
}
|
||||||
|
my @generated=loadarray($filename);
|
||||||
|
|
||||||
|
# what parts to cut off from the file
|
||||||
|
my @stripfile = getpart("verify", "stripfile".$partsuffix);
|
||||||
|
|
||||||
|
my $filemode=$hash{'mode'};
|
||||||
|
if($filemode && ($filemode eq "text") && $has_textaware) {
|
||||||
|
# text mode when running on windows means adding an extra
|
||||||
|
# strip expression
|
||||||
|
push @stripfile, "s/\r\n/\n/";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $strip;
|
||||||
|
for $strip (@stripfile) {
|
||||||
|
chomp $strip;
|
||||||
|
for(@generated) {
|
||||||
|
eval $strip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@outfile = fixarray(@outfile);
|
||||||
|
|
||||||
|
$res = compare("output ($filename)", \@generated, \@outfile);
|
||||||
|
if($res) {
|
||||||
|
# timestamp test result verification end
|
||||||
|
$timevrfyend{$testnum} = Time::HiRes::time() if($timestats);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$outputok = 1; # output checked
|
||||||
}
|
}
|
||||||
|
|
||||||
@outfile = fixarray(@outfile);
|
|
||||||
|
|
||||||
$res = compare("output", \@generated, \@outfile);
|
|
||||||
if($res) {
|
|
||||||
# timestamp test result verification end
|
|
||||||
$timevrfyend{$testnum} = Time::HiRes::time() if($timestats);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ok .= "o";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$ok .= "-"; # output not checked
|
|
||||||
}
|
}
|
||||||
|
$ok .= ($outputok) ? "o" : "-"; # output checked or not
|
||||||
|
|
||||||
# accept multiple comma-separated error codes
|
# accept multiple comma-separated error codes
|
||||||
my @splerr = split(/ *, */, $errorcode);
|
my @splerr = split(/ *, */, $errorcode);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user