changeset 295:6fe0459b6668

Tests: eliminate startup races in proxy and fastcgi tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 08 Jun 2013 07:02:11 +0400
parents 71e275487aeb
children a113f4d55b12
files fastcgi.t fastcgi_body.t fastcgi_cache.t fastcgi_header_params.t fastcgi_keepalive.t fastcgi_merge_params.t fastcgi_merge_params2.t proxy.t proxy_cache.t proxy_cache_chunked.t proxy_chunked.t proxy_noclose.t
diffstat 12 files changed, 23 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/fastcgi.t
+++ b/fastcgi.t
@@ -52,7 +52,7 @@ http {
 EOF
 
 $t->run_daemon(\&fastcgi_daemon);
-$t->run();
+$t->run()->waitforsocket('127.0.0.1:8081');
 
 ###############################################################################
 
--- a/fastcgi_body.t
+++ b/fastcgi_body.t
@@ -53,7 +53,7 @@ http {
 EOF
 
 $t->run_daemon(\&fastcgi_daemon);
-$t->run();
+$t->run()->waitforsocket('127.0.0.1:8081');
 
 ###############################################################################
 
--- a/fastcgi_cache.t
+++ b/fastcgi_cache.t
@@ -58,7 +58,7 @@ http {
 EOF
 
 $t->run_daemon(\&fastcgi_daemon);
-$t->run();
+$t->run()->waitforsocket('127.0.0.1:8081');
 
 ###############################################################################
 
--- a/fastcgi_header_params.t
+++ b/fastcgi_header_params.t
@@ -52,7 +52,7 @@ http {
 EOF
 
 $t->run_daemon(\&fastcgi_daemon);
-$t->run();
+$t->run()->waitforsocket('127.0.0.1:8081');
 
 ###############################################################################
 
--- a/fastcgi_keepalive.t
+++ b/fastcgi_keepalive.t
@@ -53,10 +53,7 @@ http {
 EOF
 
 $t->run_daemon(\&fastcgi_test_daemon);
-$t->run();
-
-$t->waitforsocket('127.0.0.1:8081')
-	or die "Can't start test backend";
+$t->run()->waitforsocket('127.0.0.1:8081');
 
 ###############################################################################
 
--- a/fastcgi_merge_params.t
+++ b/fastcgi_merge_params.t
@@ -68,7 +68,7 @@ http {
 EOF
 
 $t->run_daemon(\&fastcgi_daemon);
-$t->run();
+$t->run()->waitforsocket('127.0.0.1:8081');
 
 ###############################################################################
 
--- a/fastcgi_merge_params2.t
+++ b/fastcgi_merge_params2.t
@@ -63,7 +63,7 @@ http {
 EOF
 
 $t->run_daemon(\&fastcgi_daemon);
-$t->run();
+$t->run()->waitforsocket('127.0.0.1:8081');
 
 ###############################################################################
 
--- a/proxy.t
+++ b/proxy.t
@@ -49,7 +49,7 @@ http {
 EOF
 
 $t->run_daemon(\&http_daemon);
-$t->run();
+$t->run()->waitforsocket('127.0.0.1:8081');
 
 ###############################################################################
 
@@ -69,6 +69,8 @@ sub http_daemon {
 	)
 		or die "Can't create listening socket: $!\n";
 
+	local $SIG{PIPE} = 'IGNORE';
+
 	while (my $client = $server->accept()) {
 		$client->autoflush(1);
 
--- a/proxy_cache.t
+++ b/proxy_cache.t
@@ -80,8 +80,9 @@ EOF
 $t->write_file('t.html', 'SEE-THIS');
 $t->write_file('t2.html', 'SEE-THIS');
 $t->write_file('empty.html', '');
+
 $t->run_daemon(\&http_fake_daemon);
-$t->run();
+$t->run()->waitforsocket('127.0.0.1:8081');
 
 ###############################################################################
 
@@ -139,6 +140,8 @@ sub http_fake_daemon {
 	)
 		or die "Can't create listening socket: $!\n";
 
+	local $SIG{PIPE} = 'IGNORE';
+
 	my $num = 0;
 
 	while (my $client = $server->accept()) {
--- a/proxy_cache_chunked.t
+++ b/proxy_cache_chunked.t
@@ -59,7 +59,7 @@ http {
 EOF
 
 $t->run_daemon(\&http_chunked_daemon);
-$t->run();
+$t->run()->waitforsocket('127.0.0.1:8081');
 
 ###############################################################################
 
@@ -77,6 +77,8 @@ sub http_chunked_daemon {
 	)
 		or die "Can't create listening socket: $!\n";
 
+	local $SIG{PIPE} = 'IGNORE';
+
 	while (my $client = $server->accept()) {
 		$client->autoflush(1);
 
--- a/proxy_chunked.t
+++ b/proxy_chunked.t
@@ -66,7 +66,7 @@ EOF
 	'<!--#include virtual="/" set="one" --><!--#echo var="one" -->');
 
 $t->run_daemon(\&http_chunked_daemon);
-$t->run();
+$t->run()->waitforsocket('127.0.0.1:8081');
 
 ###############################################################################
 
@@ -85,6 +85,8 @@ sub http_chunked_daemon {
 	)
 		or die "Can't create listening socket: $!\n";
 
+	local $SIG{PIPE} = 'IGNORE';
+
 	while (my $client = $server->accept()) {
 		$client->autoflush(1);
 
--- a/proxy_noclose.t
+++ b/proxy_noclose.t
@@ -69,7 +69,7 @@ http {
 EOF
 
 $t->run_daemon(\&http_noclose_daemon);
-$t->run();
+$t->run()->waitforsocket('127.0.0.1:8081');
 
 ###############################################################################
 
@@ -96,6 +96,8 @@ sub http_noclose_daemon {
 	)
 		or die "Can't create listening socket: $!\n";
 
+	local $SIG{PIPE} = 'IGNORE';
+
 	while (my $client = $server->accept()) {
 		$client->autoflush(1);