From ba5fa1c7a825da75da6f0686ee89e2b64a9cb0f5 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Sat, 6 May 2017 09:04:00 +0200 Subject: runtests.pl: simplify the datacheck read section Also, document that numbered datacheck sections are possible. --- tests/runtests.pl | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) (limited to 'tests/runtests.pl') diff --git a/tests/runtests.pl b/tests/runtests.pl index 68ff3933e..48e26142f 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -3333,31 +3333,12 @@ sub singletest { } logmsg sprintf("test %04d...", $testnum) if(!$automakestyle); - # extract the reply data - my @reply = getpart("reply", "data"); - my @replycheck = getpart("reply", "datacheck"); - my %replyattr = getpartattr("reply", "data"); - my %replycheckattr = getpartattr("reply", "datacheck"); - - if (@replycheck) { - # we use this file instead to check the final output against - # get the mode attribute - my $filemode=$replycheckattr{'mode'}; - if($filemode && ($filemode eq "text") && $has_textaware) { - # text mode when running on windows: fix line endings - map s/\r\n/\n/g, @replycheck; - map s/\n/\r\n/g, @replycheck; - } - if($replycheckattr{'nonewline'}) { - # Yes, we must cut off the final newline from the final line - # of the datacheck - chomp($replycheck[$#replycheck]); - } - - for my $partsuffix (('1', '2', '3', '4')) { + my @reply; + if (partexists("reply", "datacheck")) { + for my $partsuffix (('', '1', '2', '3', '4')) { my @replycheckpart = getpart("reply", "datacheck".$partsuffix); - if(@replycheckpart || partexists("reply", "datacheck".$partsuffix) ) { + if(@replycheckpart) { my %replycheckpartattr = getpartattr("reply", "datacheck".$partsuffix); # get the mode attribute my $filemode=$replycheckpartattr{'mode'}; @@ -3371,13 +3352,13 @@ sub singletest { # of the datacheck chomp($replycheckpart[$#replycheckpart]); } - push(@replycheck, @replycheckpart); + push(@reply, @replycheckpart); } } - - @reply=@replycheck; } else { + # check against the data section + @reply = getpart("reply", "data"); # get the mode attribute my $filemode=$replyattr{'mode'}; if($filemode && ($filemode eq "text") && $has_textaware) { -- cgit v1.2.3