From: Mark Andrews Date: Thu, 5 May 2011 04:56:25 +0000 (+0000) Subject: explictly kill the process if the server fails to start, check for a non zero length... X-Git-Tag: v9.4-ESV-R5~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1bf2397362c676d9512f5059e178944c97ee76e4;p=thirdparty%2Fbind9.git explictly kill the process if the server fails to start, check for a non zero length pid file --- diff --git a/bin/tests/system/start.pl b/bin/tests/system/start.pl index d07a3806cb1..59d74a26032 100644 --- a/bin/tests/system/start.pl +++ b/bin/tests/system/start.pl @@ -15,7 +15,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: start.pl,v 1.5.18.6 2011/03/05 23:47:52 tbox Exp $ +# $Id: start.pl,v 1.5.18.7 2011/05/05 04:56:25 marka Exp $ # Framework for starting test servers. # Based on the type of server specified, check for port availability, remove @@ -170,13 +170,21 @@ sub start_server { unlink glob $cleanup_files; } - system "$command"; + # get the shell to report the pid of the server ($!) + $command .= "echo \$!"; + # start the server + my $child = `$command`; + + # wait up to 14 seconds for the server to start and to write the + # pid file otherwise kill this server and any others that have + # already been started my $tries = 0; - while (!-f $pid_file) { + while (!-s $pid_file) { if (++$tries > 14) { - print "I:Couldn't start server $server\n"; + print "I:Couldn't start server $server (pid=$child)\n"; print "R:FAIL\n"; + system "kill -9 $child" if ("$child" ne ""); system "$PERL $topdir/stop.pl $testdir"; exit 1; }