1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

support multiple error codes for a test case since some things just vary

between platforms
This commit is contained in:
Daniel Stenberg 2005-03-17 08:17:48 +00:00
parent 8f646eef45
commit 67f04d2d5f
3 changed files with 23 additions and 7 deletions

View File

@ -165,7 +165,9 @@ Pass this given data on stdin to the tool.
<verify> <verify>
<errorcode> <errorcode>
numerical error code curl is supposed to return numerical error code curl is supposed to return. Specify a list of accepted
error codes by separating multiple numbers with comma. See test 237 for an
example.
</errorcode> </errorcode>
<strip> <strip>
One regex per line that is removed from the protocol dumps before the One regex per line that is removed from the protocol dumps before the

View File

@ -22,8 +22,11 @@ REPLY PASV 227 Entering Passiv Mode (1218,91,256,127,127,127)
<verify> <verify>
# curl: (15) Can't resolve new host 1218.91.256.127:32639 # curl: (15) Can't resolve new host 1218.91.256.127:32639
# 15 => CURLE_FTP_CANT_GET_HOST # 15 => CURLE_FTP_CANT_GET_HOST
# some systems just don't fail on the illegal host name/address but instead
# moves on and attempt to connect to... yes, to what?
# 7= CURLE_COULDNT_CONNECT
<errorcode> <errorcode>
15 15, 7
</errorcode> </errorcode>
<protocol> <protocol>
USER anonymous USER anonymous

View File

@ -1246,7 +1246,7 @@ sub singletest {
} }
my @err = getpart("verify", "errorcode"); my @err = getpart("verify", "errorcode");
my $errorcode = $err[0]; my $errorcode = $err[0] || "0";
my $res; my $res;
if (@validstdout) { if (@validstdout) {
@ -1376,10 +1376,21 @@ sub singletest {
} }
} }
if($errorcode == $cmdres) { # accept multiple comma-separated error codes
$errorcode =~ s/\n//; my @splerr = split(/ *, */, $errorcode);
my $errok;
my $e;
foreach $e (@splerr) {
if($e == $cmdres) {
# a fine error code
$errok = 1;
last;
}
}
if($errok) {
if($verbose) { if($verbose) {
print " received exitcode $errorcode OK"; print " received exitcode $cmdres OK";
} }
elsif(!$short) { elsif(!$short) {
print " exit OK"; print " exit OK";
@ -1387,7 +1398,7 @@ sub singletest {
} }
else { else {
if(!$short) { if(!$short) {
print "\ncurl returned $cmdres, ".(0+$errorcode)." was expected\n"; printf "\ncurl returned $cmdres, %s was expected\n", $errorcode;
} }
print " exit FAILED\n"; print " exit FAILED\n";
return 1; return 1;