summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2005-03-17 08:17:48 +0000
committerDaniel Stenberg <daniel@haxx.se>2005-03-17 08:17:48 +0000
commit67f04d2d5f85d737c58fe0cc765507f713666ce1 (patch)
treedc269a02c5af92f6226442864454f3793bfd5f19 /tests
parent8f646eef450b16da1303c4183c77ca8bf2a9e3e7 (diff)
downloadcurl-67f04d2d5f85d737c58fe0cc765507f713666ce1.tar.gz
support multiple error codes for a test case since some things just vary
between platforms
Diffstat (limited to 'tests')
-rw-r--r--tests/FILEFORMAT4
-rw-r--r--tests/data/test2375
-rwxr-xr-xtests/runtests.pl21
3 files changed, 23 insertions, 7 deletions
diff --git a/tests/FILEFORMAT b/tests/FILEFORMAT
index d41a05205..30f539b8f 100644
--- a/tests/FILEFORMAT
+++ b/tests/FILEFORMAT
@@ -165,7 +165,9 @@ Pass this given data on stdin to the tool.
<verify>
<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>
<strip>
One regex per line that is removed from the protocol dumps before the
diff --git a/tests/data/test237 b/tests/data/test237
index 1a5f0e275..be7dfd58e 100644
--- a/tests/data/test237
+++ b/tests/data/test237
@@ -22,8 +22,11 @@ REPLY PASV 227 Entering Passiv Mode (1218,91,256,127,127,127)
<verify>
# curl: (15) Can't resolve new host 1218.91.256.127:32639
# 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>
-15
+15, 7
</errorcode>
<protocol>
USER anonymous
diff --git a/tests/runtests.pl b/tests/runtests.pl
index e1b9bd7b7..1f92de9ff 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -1246,7 +1246,7 @@ sub singletest {
}
my @err = getpart("verify", "errorcode");
- my $errorcode = $err[0];
+ my $errorcode = $err[0] || "0";
my $res;
if (@validstdout) {
@@ -1376,10 +1376,21 @@ sub singletest {
}
}
- if($errorcode == $cmdres) {
- $errorcode =~ s/\n//;
+ # accept multiple comma-separated error codes
+ 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) {
- print " received exitcode $errorcode OK";
+ print " received exitcode $cmdres OK";
}
elsif(!$short) {
print " exit OK";
@@ -1387,7 +1398,7 @@ sub singletest {
}
else {
if(!$short) {
- print "\ncurl returned $cmdres, ".(0+$errorcode)." was expected\n";
+ printf "\ncurl returned $cmdres, %s was expected\n", $errorcode;
}
print " exit FAILED\n";
return 1;