1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

runtests: make stripfile work on stdout as well

... and have test 1700 use that to strip out the nghttpx server: headers
This commit is contained in:
Daniel Stenberg 2016-06-03 23:54:06 +02:00
parent bf05606ef1
commit d3b5c153af
4 changed files with 29 additions and 8 deletions

View File

@ -426,8 +426,9 @@ have a text/binary difference.
Variables are substituted as in the <command> section. Variables are substituted as in the <command> section.
</file> </file>
<stripfile> <stripfile>
One perl op per line that operates on the file before being compared. This is One perl op per line that operates on the output file or stdout before being
pretty advanced. Example: "s/^EPRT .*/EPRT stripped/" compared with what is stored in the test file. This is pretty
advanced. Example: "s/^EPRT .*/EPRT stripped/"
</stripfile> </stripfile>
<upload> <upload>
the contents of the upload data curl should have sent the contents of the upload data curl should have sent

View File

@ -46,7 +46,7 @@ http2
HTTP/2 GET with Upgrade: HTTP/2 GET with Upgrade:
</name> </name>
<command> <command>
http://%HOSTIP:9015/1700 --http2 http://%HOSTIP:9015/17000001 http://%HOSTIP:%HTTP2PORT/1700 --http2 http://%HOSTIP:%HTTP2PORT/17000001
</command> </command>
</client> </client>
@ -60,11 +60,11 @@ http://%HOSTIP:9015/1700 --http2 http://%HOSTIP:9015/17000001
</strip> </strip>
<protocol> <protocol>
GET /1700 HTTP/1.1 GET /1700 HTTP/1.1
Host: %HOSTIP:9015 Host: %HOSTIP:%HTTP2PORT
Accept: */* Accept: */*
GET /17000001 HTTP/1.1 GET /17000001 HTTP/1.1
Host: %HOSTIP:9015 Host: %HOSTIP:%HTTP2PORT
Accept: */* Accept: */*
</protocol> </protocol>
@ -81,7 +81,7 @@ accept-ranges: bytes
content-length: 6 content-length: 6
content-type: text/html content-type: text/html
funny-head: yesyes funny-head: yesyes
server: nghttpx nghttp2/1.12.0-DEV server: cut-out
via: 1.1 nghttpx via: 1.1 nghttpx
-foo- -foo-
@ -89,10 +89,13 @@ HTTP/2 200
date: Thu, 09 Nov 2010 14:49:00 GMT date: Thu, 09 Nov 2010 14:49:00 GMT
content-length: 6 content-length: 6
content-type: text/html content-type: text/html
server: nghttpx nghttp2/1.12.0-DEV server: cut-out
via: 1.1 nghttpx via: 1.1 nghttpx
-maa- -maa-
</stdout> </stdout>
<stripfile>
s/^server:.*/server: cut-out /
</stripfile>
</verify> </verify>
</testcase> </testcase>

View File

@ -72,4 +72,4 @@ my $cmdline="$nghttpx --backend=127.0.0.1,8990 ".
"--pid-file=$pidfile ". "--pid-file=$pidfile ".
"--errorlog-file=$logfile"; "--errorlog-file=$logfile";
print "RUN: $cmdline\n" if($verbose); print "RUN: $cmdline\n" if($verbose);
system("$cmdline"); system("$cmdline 2>/dev/null");

View File

@ -3841,6 +3841,23 @@ sub singletest {
# verify redirected stdout # verify redirected stdout
my @actual = loadarray($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 # variable-replace in the stdout we have from the test case file
@validstdout = fixarray(@validstdout); @validstdout = fixarray(@validstdout);