aboutsummaryrefslogtreecommitdiff
path: root/tests/runtests.pl
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2012-06-01 05:37:00 +0200
committerYang Tse <yangsita@gmail.com>2012-06-01 05:37:00 +0200
commit00dd45720e64f29d06de249ca5cd70e93c6a6b68 (patch)
treed8fed42aa926831b53863f372a7bfda366daf692 /tests/runtests.pl
parent54d484e136d43b50934cc906804662e780adc3fa (diff)
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.
Diffstat (limited to 'tests/runtests.pl')
-rwxr-xr-xtests/runtests.pl80
1 files changed, 41 insertions, 39 deletions
diff --git a/tests/runtests.pl b/tests/runtests.pl
index a984e8cce..65dd9610b 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -3496,53 +3496,55 @@ sub singletest {
$ok .= "-"; # protocol not checked
}
- my @outfile=getpart("verify", "file");
- if(@outfile) {
- # we're supposed to verify a dynamically generated file!
- my %hash = getpartattr("verify", "file");
-
- my $filename=$hash{'name'};
- if(!$filename) {
- logmsg "ERROR: section verify=>file has no name attribute\n";
- stopservers($verbose);
- # timestamp test result verification end
- $timevrfyend{$testnum} = Time::HiRes::time() if($timestats);
- return -1;
- }
- my @generated=loadarray($filename);
+ my $outputok;
+ for my $partsuffix (('', '1', '2', '3', '4')) {
+ my @outfile=getpart("verify", "file".$partsuffix);
+ if(@outfile) {
+ # we're supposed to verify a dynamically generated file!
+ my %hash = getpartattr("verify", "file".$partsuffix);
+
+ my $filename=$hash{'name'};
+ if(!$filename) {
+ logmsg "ERROR: section verify=>file$partsuffix ".
+ "has no name attribute\n";
+ stopservers($verbose);
+ # timestamp test result verification end
+ $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");
+ # 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 $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 $strip;
+ for $strip (@stripfile) {
+ chomp $strip;
+ for(@generated) {
+ eval $strip;
+ }
}
- }
- @outfile = fixarray(@outfile);
+ @outfile = fixarray(@outfile);
- $res = compare("output", \@generated, \@outfile);
- if($res) {
- # timestamp test result verification end
- $timevrfyend{$testnum} = Time::HiRes::time() if($timestats);
- return 1;
- }
+ $res = compare("output ($filename)", \@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
+ $outputok = 1; # output checked
+ }
}
+ $ok .= ($outputok) ? "o" : "-"; # output checked or not
# accept multiple comma-separated error codes
my @splerr = split(/ *, */, $errorcode);