mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
runtests.pl: simplify the datacheck read section
Also, document that numbered datacheck sections are possible.
This commit is contained in:
parent
6dc3422d48
commit
ba5fa1c7a8
@ -86,11 +86,18 @@ The connect section is used instead of the 'data' for all CONNECT
|
|||||||
requests. The remainder of the rules for the data section then apply but with
|
requests. The remainder of the rules for the data section then apply but with
|
||||||
a connect prefix.
|
a connect prefix.
|
||||||
</connect>
|
</connect>
|
||||||
<datacheck [nonewline="yes"]>
|
<datacheck [mode="text"] [nonewline="yes"]>
|
||||||
if the data is sent but this is what should be checked afterwards. If
|
if the data is sent but this is what should be checked afterwards. If
|
||||||
'nonewline' is set, we will cut off the trailing newline of this given data
|
'nonewline' is set, we will cut off the trailing newline of this given data
|
||||||
before comparing with the one actually received by the client
|
before comparing with the one actually received by the client.
|
||||||
|
|
||||||
|
Use the mode="text" attribute if the output is in text mode on platforms that
|
||||||
|
have a text/binary difference.
|
||||||
</datacheck>
|
</datacheck>
|
||||||
|
<datacheckNUM [nonewline="yes"] [mode="text"]>
|
||||||
|
The contents of numbered datacheck sections are appended to the non-numbered
|
||||||
|
one.
|
||||||
|
</datacheckNUM>
|
||||||
<size>
|
<size>
|
||||||
number to return on a ftp SIZE command (set to -1 to make this command fail)
|
number to return on a ftp SIZE command (set to -1 to make this command fail)
|
||||||
</size>
|
</size>
|
||||||
@ -176,6 +183,7 @@ ftp-ipv6
|
|||||||
ftps
|
ftps
|
||||||
http
|
http
|
||||||
http-ipv6
|
http-ipv6
|
||||||
|
http-pipe
|
||||||
http-proxy
|
http-proxy
|
||||||
http-unix
|
http-unix
|
||||||
https
|
https
|
||||||
|
@ -3333,31 +3333,12 @@ sub singletest {
|
|||||||
}
|
}
|
||||||
logmsg sprintf("test %04d...", $testnum) if(!$automakestyle);
|
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 %replyattr = getpartattr("reply", "data");
|
||||||
my %replycheckattr = getpartattr("reply", "datacheck");
|
my @reply;
|
||||||
|
if (partexists("reply", "datacheck")) {
|
||||||
if (@replycheck) {
|
for my $partsuffix (('', '1', '2', '3', '4')) {
|
||||||
# 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 @replycheckpart = getpart("reply", "datacheck".$partsuffix);
|
my @replycheckpart = getpart("reply", "datacheck".$partsuffix);
|
||||||
if(@replycheckpart || partexists("reply", "datacheck".$partsuffix) ) {
|
if(@replycheckpart) {
|
||||||
my %replycheckpartattr = getpartattr("reply", "datacheck".$partsuffix);
|
my %replycheckpartattr = getpartattr("reply", "datacheck".$partsuffix);
|
||||||
# get the mode attribute
|
# get the mode attribute
|
||||||
my $filemode=$replycheckpartattr{'mode'};
|
my $filemode=$replycheckpartattr{'mode'};
|
||||||
@ -3371,13 +3352,13 @@ sub singletest {
|
|||||||
# of the datacheck
|
# of the datacheck
|
||||||
chomp($replycheckpart[$#replycheckpart]);
|
chomp($replycheckpart[$#replycheckpart]);
|
||||||
}
|
}
|
||||||
push(@replycheck, @replycheckpart);
|
push(@reply, @replycheckpart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@reply=@replycheck;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
# check against the data section
|
||||||
|
@reply = getpart("reply", "data");
|
||||||
# get the mode attribute
|
# get the mode attribute
|
||||||
my $filemode=$replyattr{'mode'};
|
my $filemode=$replyattr{'mode'};
|
||||||
if($filemode && ($filemode eq "text") && $has_textaware) {
|
if($filemode && ($filemode eq "text") && $has_textaware) {
|
||||||
|
Loading…
Reference in New Issue
Block a user