diff lib/Test/Nginx.pm @ 1263:ea3c7659b6c1

Tests: handled early pidfile write on win32 in the run() routine. In addition to the present waiting for pidfile, which is insufficient on win32 due to the CreateProcess model, and may lead to rare startup races, search now for the certain error message which indicates started worker process. This change allows tolerating moderate hiccups on win32 hosts.
author Sergey Kandaurov <pluknet@nginx.com>
date Tue, 19 Dec 2017 19:55:01 +0300
parents e35cc79ed4a1
children beed8146d045
line wrap: on
line diff
--- a/lib/Test/Nginx.pm
+++ b/lib/Test/Nginx.pm
@@ -345,6 +345,12 @@ sub run(;$) {
 	$self->waitforfile("$testdir/nginx.pid", $pid)
 		or die "Can't start nginx";
 
+	for (1 .. 50) {
+		last if $^O ne 'MSWin32';
+		last if $self->read_file('error.log') =~ /create thread/;
+		select undef, undef, undef, 0.1;
+	}
+
 	$self->{_started} = 1;
 	return $self;
 }