diff scgi_merge_params.t @ 960:d4a0232425ee

Tests: fixed race in SCGI tests.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 24 Jun 2016 16:30:08 +0300
parents e9064d691790
children 882267679006
line wrap: on
line diff
--- a/scgi_merge_params.t
+++ b/scgi_merge_params.t
@@ -71,7 +71,7 @@ http {
 EOF
 
 $t->run_daemon(\&scgi_daemon);
-$t->run();
+$t->run()->waitforsocket('127.0.0.1:' . port(1));
 
 ###############################################################################
 
@@ -122,11 +122,10 @@ sub scgi_daemon {
 		or die "Can't create listening socket: $!\n";
 
 	my $scgi = SCGI->new($server, blocking => 1);
-	my $count = 0;
 
 	while (my $request = $scgi->accept()) {
-		$count++;
-		$request->read_env();
+		eval { $request->read_env(); };
+		next if $@;
 
 		my $ims = $request->env->{HTTP_IF_MODIFIED_SINCE} || '';
 		my $iums = $request->env->{HTTP_IF_UNMODIFIED_SINCE} || '';