# HG changeset patch # User Maxim Dounin # Date 1370660531 -14400 # Node ID 6fe0459b6668b258b6bce86dcab958b57a2696ce # Parent 71e275487aeb430194c5e94a530059eb0010454c Tests: eliminate startup races in proxy and fastcgi tests. diff --git a/fastcgi.t b/fastcgi.t --- 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'); ############################################################################### diff --git a/fastcgi_body.t b/fastcgi_body.t --- 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'); ############################################################################### diff --git a/fastcgi_cache.t b/fastcgi_cache.t --- 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'); ############################################################################### diff --git a/fastcgi_header_params.t b/fastcgi_header_params.t --- 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'); ############################################################################### diff --git a/fastcgi_keepalive.t b/fastcgi_keepalive.t --- 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'); ############################################################################### diff --git a/fastcgi_merge_params.t b/fastcgi_merge_params.t --- 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'); ############################################################################### diff --git a/fastcgi_merge_params2.t b/fastcgi_merge_params2.t --- 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'); ############################################################################### diff --git a/proxy.t b/proxy.t --- 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); diff --git a/proxy_cache.t b/proxy_cache.t --- 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()) { diff --git a/proxy_cache_chunked.t b/proxy_cache_chunked.t --- 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); diff --git a/proxy_chunked.t b/proxy_chunked.t --- a/proxy_chunked.t +++ b/proxy_chunked.t @@ -66,7 +66,7 @@ EOF ''); $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); diff --git a/proxy_noclose.t b/proxy_noclose.t --- 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);