Mercurial > hg > nginx-tests
changeset 837:68a6678abae2
Tests: improved logging for unbuffered request body tests.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 29 Jan 2016 16:12:42 +0300 |
parents | a9c4cebcfe69 |
children | ef6466f77e7c |
files | fastcgi_request_buffering.t fastcgi_request_buffering_chunked.t proxy_request_buffering.t proxy_request_buffering_chunked.t proxy_request_buffering_ssl.t |
diffstat | 5 files changed, 64 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/fastcgi_request_buffering.t +++ b/fastcgi_request_buffering.t @@ -241,6 +241,8 @@ EOF $client = $server->accept(); + log2c("(new connection $client)"); + alarm(0); }; alarm(0); @@ -250,6 +252,8 @@ EOF } $client->sysread(my $buf, 1024); + log2i($buf); + $body = ''; while (my $h = fastcgi_read_record(\$buf)) { @@ -271,8 +275,12 @@ EOF local $SIG{PIPE} = sub { die "sigpipe\n" }; alarm(5); + log_out($buf); $s->write($buf); + $client->sysread($buf, 1024); + log2i($buf); + $body = ''; while (my $h = fastcgi_read_record(\$buf)) { @@ -312,6 +320,7 @@ EOF alarm(5); $s->sysread($buf, 1024); + log_in($buf); alarm(0); }; @@ -326,6 +335,10 @@ EOF return $f; } +sub log2i { Test::Nginx::log_core('|| <<', @_); } +sub log2o { Test::Nginx::log_core('|| >>', @_); } +sub log2c { Test::Nginx::log_core('||', @_); } + ############################################################################### sub fastcgi_daemon {
--- a/fastcgi_request_buffering_chunked.t +++ b/fastcgi_request_buffering_chunked.t @@ -270,6 +270,8 @@ EOF $client = $server->accept(); + log2c("(new connection $client)"); + alarm(0); }; alarm(0); @@ -279,6 +281,8 @@ EOF } $client->sysread(my $buf, 1024); + log2i($buf); + $body = ''; while (my $h = fastcgi_read_record(\$buf)) { @@ -314,8 +318,12 @@ EOF local $SIG{PIPE} = sub { die "sigpipe\n" }; alarm(5); + log_out($buf); $s->write($buf); + $client->sysread($buf, 1024); + log2i($buf); + $body = ''; while (my $h = fastcgi_read_record(\$buf)) { @@ -355,6 +363,8 @@ EOF alarm(5); $s->sysread($buf, 1024); + log_in($buf); + $s->close(); alarm(0); @@ -370,6 +380,10 @@ EOF return $f; } +sub log2i { Test::Nginx::log_core('|| <<', @_); } +sub log2o { Test::Nginx::log_core('|| >>', @_); } +sub log2c { Test::Nginx::log_core('||', @_); } + ############################################################################### sub fastcgi_daemon {
--- a/proxy_request_buffering.t +++ b/proxy_request_buffering.t @@ -207,6 +207,8 @@ EOF $client = $server->accept(); + log2c("(new connection $client)"); + alarm(0); }; alarm(0); @@ -216,6 +218,8 @@ EOF } $client->sysread(my $buf, 1024); + log2i($buf); + $buf =~ s/.*?\x0d\x0a?\x0d\x0a?(.*)/$1/ms; my $f = { preread => $buf }; @@ -227,8 +231,11 @@ EOF local $SIG{PIPE} = sub { die "sigpipe\n" }; alarm(5); + log_out($buf); $s->write($buf); + $client->sysread($buf, 1024); + log2i($buf); alarm(0); }; @@ -259,6 +266,7 @@ EOF alarm(5); $s->sysread($buf, 1024); + log_in($buf); alarm(0); }; @@ -273,4 +281,8 @@ EOF return $f; } +sub log2i { Test::Nginx::log_core('|| <<', @_); } +sub log2o { Test::Nginx::log_core('|| >>', @_); } +sub log2c { Test::Nginx::log_core('||', @_); } + ###############################################################################
--- a/proxy_request_buffering_chunked.t +++ b/proxy_request_buffering_chunked.t @@ -242,6 +242,8 @@ EOF $client = $server->accept(); + log2c("(new connection $client)"); + alarm(0); }; alarm(0); @@ -251,6 +253,8 @@ EOF } $client->sysread(my $buf, 1024); + log2i($buf); + $buf =~ s/.*?\x0d\x0a?\x0d\x0a?(.*)/$1/ms; my $f = { preread => $buf }; @@ -276,8 +280,11 @@ EOF local $SIG{PIPE} = sub { die "sigpipe\n" }; alarm(5); + log_out($buf); $s->write($buf); + $client->sysread($buf, 1024); + log2i($buf); alarm(0); }; @@ -308,6 +315,8 @@ EOF alarm(5); $s->sysread($buf, 1024); + log_in($buf); + $s->close(); alarm(0); @@ -323,4 +332,8 @@ EOF return $f; } +sub log2i { Test::Nginx::log_core('|| <<', @_); } +sub log2o { Test::Nginx::log_core('|| >>', @_); } +sub log2c { Test::Nginx::log_core('||', @_); } + ###############################################################################
--- a/proxy_request_buffering_ssl.t +++ b/proxy_request_buffering_ssl.t @@ -228,6 +228,8 @@ EOF $client = $server->accept(); + log2c("(new connection $client)"); + alarm(0); }; alarm(0); @@ -237,6 +239,8 @@ EOF } $client->sysread(my $buf, 1024); + log2i($buf); + $buf =~ s/.*?\x0d\x0a?\x0d\x0a?(.*)/$1/ms; my $f = { preread => $buf }; @@ -248,8 +252,11 @@ EOF local $SIG{PIPE} = sub { die "sigpipe\n" }; alarm(5); + log_out($buf); $s->write($buf); + $client->sysread($buf, 1024); + log2i($buf); alarm(0); }; @@ -280,6 +287,7 @@ EOF alarm(5); $s->sysread($buf, 1024); + log_in($buf); alarm(0); }; @@ -294,4 +302,8 @@ EOF return $f; } +sub log2i { Test::Nginx::log_core('|| <<', @_); } +sub log2o { Test::Nginx::log_core('|| >>', @_); } +sub log2c { Test::Nginx::log_core('||', @_); } + ###############################################################################