From: Brian Conry Date: Tue, 27 Nov 2018 23:47:08 +0000 (-0600) Subject: start.pl - wait for server to say 'running' X-Git-Tag: v9.13.5~17^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=597049461d9e7b3d43291ee4869aa2f6d47857b6;p=thirdparty%2Fbind9.git start.pl - wait for server to say 'running' --- diff --git a/bin/tests/system/start.pl b/bin/tests/system/start.pl index dc790bc6072..8df5ab1b52e 100755 --- a/bin/tests/system/start.pl +++ b/bin/tests/system/start.pl @@ -306,6 +306,36 @@ sub verify_server { $tcp = "" if (-e "$testdir/$server/named.notcp"); my $tries = 0; + + my $runfile = "$testdir/$server/named.run"; + + while (1) { + # the shell *ought* to have created the file immediately, but this + # logic allows the creation to be delayed without issues + if (open(my $fh, "<", $runfile)) { + # the two non-whitespace blobs should be the date and time + # but we don't care about them really, only that they are there + if (grep /^\S+ \S+ running$/, <$fh>) { + last; + } + } + + $tries++; + + if ($tries >= 30) { + print "I:server $server seems to have not started\n"; + print "I:failed\n"; + + system("$PERL $topdir/stop.pl $testdir"); + + exit 1; + } + + sleep 2; + } + + $tries = 0; + while (1) { my $return = system("$DIG $tcp +noadd +nosea +nostat +noquest +nocomm +nocmd +noedns -p $port version.bind. chaos txt \@10.53.0.$n > dig.out"); last if ($return == 0);