Commit 00dd4572 authored by Yang Tse's avatar Yang Tse
Browse files

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.
parent 54d484e1
Loading
Loading
Loading
Loading
+41 −39
Original line number Diff line number Diff line
@@ -3496,14 +3496,17 @@ sub singletest {
        $ok .= "-"; # protocol not checked
    }

    my @outfile=getpart("verify", "file");
    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");
            my %hash = getpartattr("verify", "file".$partsuffix);

            my $filename=$hash{'name'};
            if(!$filename) {
            logmsg "ERROR: section verify=>file has no name attribute\n";
                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);
@@ -3512,7 +3515,7 @@ sub singletest {
            my @generated=loadarray($filename);

            # what parts to cut off from the file
        my @stripfile = getpart("verify", "stripfile");
            my @stripfile = getpart("verify", "stripfile".$partsuffix);

            my $filemode=$hash{'mode'};
            if($filemode && ($filemode eq "text") && $has_textaware) {
@@ -3531,18 +3534,17 @@ sub singletest {

            @outfile = fixarray(@outfile);

        $res = compare("output", \@generated, \@outfile);
            $res = compare("output ($filename)", \@generated, \@outfile);
            if($res) {
                # timestamp test result verification end
                $timevrfyend{$testnum} = Time::HiRes::time() if($timestats);
                return 1;
            }

        $ok .= "o";
            $outputok = 1; # output checked
        }
    else {
        $ok .= "-"; # output not checked
    }
    $ok .= ($outputok) ? "o" : "-"; # output checked or not

    # accept multiple comma-separated error codes
    my @splerr = split(/ *, */, $errorcode);