]> granicus.if.org Git - curl/commitdiff
runtests: make stripfile work on stdout as well
authorDaniel Stenberg <daniel@haxx.se>
Fri, 3 Jun 2016 21:54:06 +0000 (23:54 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 6 Jun 2016 21:51:49 +0000 (23:51 +0200)
... and have test 1700 use that to strip out the nghttpx server: headers

tests/FILEFORMAT
tests/data/test1700
tests/http2-server.pl
tests/runtests.pl

index a8e74b31e4fda1ff392a3ab0a885b0ab29e339a3..d8beb99f764daf90b42c905cce4f7f78e3b91cba 100644 (file)
@@ -426,8 +426,9 @@ have a text/binary difference.
 Variables are substituted as in the <command> section.
 </file>
 <stripfile>
-One perl op per line that operates on the file before being compared. This is
-pretty advanced. Example: "s/^EPRT .*/EPRT stripped/"
+One perl op per line that operates on the output file or stdout before being
+compared with what is stored in the test file. This is pretty
+advanced. Example: "s/^EPRT .*/EPRT stripped/"
 </stripfile>
 <upload>
 the contents of the upload data curl should have sent
index 1c581dad0e2e4363a2f5b28b97421f63e2e77754..1549cb9144e97b97f52708e2e20c962d34983a69 100644 (file)
@@ -46,7 +46,7 @@ http2
 HTTP/2 GET with Upgrade:
  </name>
  <command>
-http://%HOSTIP:9015/1700 --http2 http://%HOSTIP:9015/17000001
+http://%HOSTIP:%HTTP2PORT/1700 --http2 http://%HOSTIP:%HTTP2PORT/17000001
 </command>
 </client>
 
@@ -60,11 +60,11 @@ http://%HOSTIP:9015/1700 --http2 http://%HOSTIP:9015/17000001
 </strip>
 <protocol>
 GET /1700 HTTP/1.1\r
-Host: %HOSTIP:9015\r
+Host: %HOSTIP:%HTTP2PORT\r
 Accept: */*\r
 \r
 GET /17000001 HTTP/1.1\r
-Host: %HOSTIP:9015\r
+Host: %HOSTIP:%HTTP2PORT\r
 Accept: */*\r
 \r
 </protocol>
@@ -81,7 +81,7 @@ accept-ranges: bytes
 content-length: 6\r
 content-type: text/html\r
 funny-head: yesyes\r
-server: nghttpx nghttp2/1.12.0-DEV\r
+server: cut-out\r
 via: 1.1 nghttpx\r
 \r
 -foo-
@@ -89,10 +89,13 @@ HTTP/2 200
 date: Thu, 09 Nov 2010 14:49:00 GMT\r
 content-length: 6\r
 content-type: text/html\r
-server: nghttpx nghttp2/1.12.0-DEV\r
+server: cut-out\r
 via: 1.1 nghttpx\r
 \r
 -maa-
 </stdout>
+<stripfile>
+s/^server:.*/server: cut-out\r/
+</stripfile>
 </verify>
 </testcase>
index 56b7ccec8be6ceba6784bcfcf8e60f00c6c71a88..72ed12e85a431008513a80aa746ff15746f601b6 100755 (executable)
@@ -72,4 +72,4 @@ my $cmdline="$nghttpx --backend=127.0.0.1,8990 ".
     "--pid-file=$pidfile ".
     "--errorlog-file=$logfile";
 print "RUN: $cmdline\n" if($verbose);
-system("$cmdline");
+system("$cmdline 2>/dev/null");
index 42d791097e82c8d055b98b759b3452419f376f4f..7c7dc8d013ebffd446a5eef4944f831416edae8d 100755 (executable)
@@ -3841,6 +3841,23 @@ sub singletest {
         # verify redirected stdout
         my @actual = loadarray($STDOUT);
 
+        # what parts to cut off from stdout
+        my @stripfile = getpart("verify", "stripfile");
+
+        foreach my $strip (@stripfile) {
+            chomp $strip;
+            my @newgen;
+            for(@actual) {
+                eval $strip;
+                if($_) {
+                    push @newgen, $_;
+                }
+            }
+            # this is to get rid of array entries that vanished (zero
+            # length) because of replacements
+            @actual = @newgen;
+        }
+
         # variable-replace in the stdout we have from the test case file
         @validstdout = fixarray(@validstdout);