aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-06-03 23:54:06 +0200
committerDaniel Stenberg <daniel@haxx.se>2016-06-06 23:51:49 +0200
commitd3b5c153af6998e2fd64bfc2b3033b2b5526a8cf (patch)
tree68707b312b89e056835f0ceb7ce368aa35784c8e
parentbf05606ef1f7a982c821396c3ef9fddeb4a1b011 (diff)
runtests: make stripfile work on stdout as well
... and have test 1700 use that to strip out the nghttpx server: headers
-rw-r--r--tests/FILEFORMAT5
-rw-r--r--tests/data/test170013
-rwxr-xr-xtests/http2-server.pl2
-rwxr-xr-xtests/runtests.pl17
4 files changed, 29 insertions, 8 deletions
diff --git a/tests/FILEFORMAT b/tests/FILEFORMAT
index a8e74b31e..d8beb99f7 100644
--- a/tests/FILEFORMAT
+++ b/tests/FILEFORMAT
@@ -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
diff --git a/tests/data/test1700 b/tests/data/test1700
index 1c581dad0..1549cb914 100644
--- a/tests/data/test1700
+++ b/tests/data/test1700
@@ -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
-Host: %HOSTIP:9015
+Host: %HOSTIP:%HTTP2PORT
Accept: */*
GET /17000001 HTTP/1.1
-Host: %HOSTIP:9015
+Host: %HOSTIP:%HTTP2PORT
Accept: */*
</protocol>
@@ -81,7 +81,7 @@ accept-ranges: bytes
content-length: 6
content-type: text/html
funny-head: yesyes
-server: nghttpx nghttp2/1.12.0-DEV
+server: cut-out
via: 1.1 nghttpx
-foo-
@@ -89,10 +89,13 @@ HTTP/2 200
date: Thu, 09 Nov 2010 14:49:00 GMT
content-length: 6
content-type: text/html
-server: nghttpx nghttp2/1.12.0-DEV
+server: cut-out
via: 1.1 nghttpx
-maa-
</stdout>
+<stripfile>
+s/^server:.*/server: cut-out /
+</stripfile>
</verify>
</testcase>
diff --git a/tests/http2-server.pl b/tests/http2-server.pl
index 56b7ccec8..72ed12e85 100755
--- a/tests/http2-server.pl
+++ b/tests/http2-server.pl
@@ -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");
diff --git a/tests/runtests.pl b/tests/runtests.pl
index 42d791097..7c7dc8d01 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -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);