cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH 2/3] Allow multiple client/file and verify/file parts

From: Colin Hogben <curl_at_pythontech.co.uk>
Date: Wed, 18 Jan 2012 13:14:10 +0000

---
 tests/runtests.pl |   37 +++++++++++++++++++++----------------
 1 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/tests/runtests.pl b/tests/runtests.pl
index 7ee7d60..ee1b7eb 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -2979,16 +2979,20 @@ sub singletest {
         unlink($memdump);
     }
 
-    # create a (possibly-empty) file before starting the test
-    my @inputfile=getpart("client", "file");
-    my %fileattr = getpartattr("client", "file");
-    my $filename=$fileattr{'name'};
-    if(@inputfile || $filename) {
-        if(!$filename) {
-            logmsg "ERROR: section client=>file has no name attribute\n";
-            timestampskippedevents($testnum);
-            return -1;
-        }
+    my @inputfiles = getparts("client", "file");
+    foreach (@inputfiles) {
+	# create a (possibly-empty) file before starting the test
+	my($fileattr, @inputfile) = @$_;
+	my $filename = $fileattr->{'name'};
+	if(!$filename) {
+	    if(@inputfile) {
+		logmsg "ERROR: section client=>file has no name attribute\n";
+		timestampskippedevents($testnum);
+		return -1;
+	    }
+	    # Missing filename allowed if no content - just ignore
+	    next;
+	}
         my $fileContent = join('', @inputfile);
         subVariables \$fileContent;
 #        logmsg "DEBUG: writing file " . $filename . "\n";
@@ -3498,12 +3502,12 @@ sub singletest {
         $ok .= "-"; # protocol not checked
     }
 
-    my @outfile=getpart("verify", "file");
-    if(@outfile) {
+    my @outfiles = getparts("verify", "file");
+    foreach (@outfiles) {
         # we're supposed to verify a dynamically generated file!
-        my %hash = getpartattr("verify", "file");
+        my($hash, @outfile) = @$_;
 
-        my $filename=$hash{'name'};
+        my $filename=$hash->{'name'};
         if(!$filename) {
             logmsg "ERROR: section verify=>file has no name attribute\n";
             stopservers($verbose);
@@ -3516,7 +3520,7 @@ sub singletest {
         # what parts to cut off from the file
         my @stripfile = getpart("verify", "stripfile");
 
-        my $filemode=$hash{'mode'};
+        my $filemode=$hash->{'mode'};
         if($filemode && ($filemode eq "text") && $has_textaware) {
             # text mode when running on windows means adding an extra
             # strip expression
@@ -3539,7 +3543,8 @@ sub singletest {
             $timevrfyend{$testnum} = Time::HiRes::time() if($timestats);
             return 1;
         }
-
+    }
+    if(@outfiles) {
         $ok .= "o";
     }
     else {
-- 
1.6.5.6
--------------030205040005020403060202
Content-Type: text/plain;
 name="0003-Update-test1315-to-use-multiple-client-file-sections.patch"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename*0="0003-Update-test1315-to-use-multiple-client-file-sections.pa";
 filename*1="tch"
RnJvbSBmZmNmNWMyOWNiZjJjYzU4ZmUwY2ZmMGVhYzUwNTgwNGIyNWQxZTU4IE1vbiBTZXAg
MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBDb2xpbiBIb2diZW4gPGN1cmxAcHl0aG9udGVjaC5j
by51az4KRGF0ZTogU3VuLCAxMiBGZWIgMjAxMiAxMTowMzoxMCArMDAwMApTdWJqZWN0OiBb
UEFUQ0ggMy8zXSBVcGRhdGUgdGVzdDEzMTUgdG8gdXNlIG11bHRpcGxlIDxjbGllbnQ+PGZp
bGU+IHNlY3Rpb25zCgotLS0KIHRlc3RzL2RhdGEvdGVzdDEzMTUgfCAgIDIyICsrKysrKysr
KysrKysrLS0tLS0tLS0KIDEgZmlsZXMgY2hhbmdlZCwgMTQgaW5zZXJ0aW9ucygrKSwgOCBk
ZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS90ZXN0cy9kYXRhL3Rlc3QxMzE1IGIvdGVzdHMv
ZGF0YS90ZXN0MTMxNQppbmRleCBjMmYxNThhLi43MmQwMWMwIDEwMDY0NAotLS0gYS90ZXN0
cy9kYXRhL3Rlc3QxMzE1CisrKyBiL3Rlc3RzL2RhdGEvdGVzdDEzMTUKQEAgLTI5LDEyICsy
OSwxOCBAQCBodHRwCiBIVFRQIFJGQzE4NjctdHlwZSBmb3JtcG9zdGluZyAt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tLS0t
LS0tLS0tLS0tLS05ZWY4ZDYyMDU3NjMNCi1Db250ZW50LURpc3Bvc2l0aW9uOiBhdHRhY2ht
ZW50OyBmaWxlbmFtZT0idGVzdDEzMTUudHh0Ig0KK0NvbnRlbnQtRGlzcG9zaXRpb246IGF0
dGFjaG1lbnQ7IGZpbGVuYW1lPSJ0ZXN0MTMxNWMudHh0Ig0KIENvbnRlbnQtVHlwZTogdGV4
dC9wbGFpbg0KIA0KLWR1bW15IGRhdGEKK21vcmUgZHVtbXkgZGF0YQogDQogLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tYWFhYWFhYWFhYWFhLS0NCiAtLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS05ZWY4ZDYyMDU3NjMtLQ0KLS0gCjEuNi41LjYKCg==
--------------030205040005020403060202
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
--------------030205040005020403060202--
Received on 2001-09-17