]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4846. [test] Adjust timing values in runtime system test. Address
authorMark Andrews <marka@isc.org>
Tue, 12 Dec 2017 23:20:09 +0000 (10:20 +1100)
committerMark Andrews <marka@isc.org>
Tue, 12 Dec 2017 23:26:58 +0000 (10:26 +1100)
                        named.pid removal races in runtime system test.
                        [RT #46800]

(cherry picked from commit c67180f09b137456e535e60e8051aa8f9a62bd7a)

CHANGES
bin/tests/system/runtime/tests.sh

diff --git a/CHANGES b/CHANGES
index c21dc3d9956d09fd68e1bb71b26ea736566f28eb..5d881ae5d64c3aeffc9806588e20a4258545ef24 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+4846.  [test]          Adjust timing values in runtime system test. Address
+                       named.pid removal races in runtime system test.
+                       [RT #46800]
+
 4844.  [test]          Address memory leaks in libatf-c. [RT #46798]
 
 4843.  [bug]           dnssec-signzone free hashlist on exit. [RT #46791]
index 496ab10693fc38de88d87a88f076e13591501846..dafec7eef2f8daf437aa4e359c2ba9c9a32a6ae5 100644 (file)
@@ -24,9 +24,19 @@ if [ ! "$CYGWIN" ]; then
     echo "I:verifying that named checks for conflicting listeners ($n)"
     ret=0
     (cd ns2; $NAMED -c named-alt1.conf -D ns2-extra-1 -X other.lock -m record,size,mctx -d 99 -g -U 4 >> named2.run 2>&1 & )
-    sleep 2
+    for i in 1 2 3 4 5 6 7 8 9
+    do
+        grep "unable to listen on any configured interface" ns2/named2.run > /dev/null && break
+        sleep 1
+    done
     grep "unable to listen on any configured interface" ns2/named2.run > /dev/null || ret=1
-    [ -s ns2/named2.pid ] && $KILL -15 `cat ns2/named2.pid`
+    for i in 1 2 3 4 5 6 7 8 9
+    do
+       grep "exiting (due to fatal error)" ns2/named2.run > /dev/null && break
+       sleep 1
+    done
+    pid=`cat ns2/named2.pid 2>/dev/null`
+    test "${pid:+set}" = set && $KILL -15 ${pid} >/dev/null 2>&1
     if [ $ret != 0 ]; then echo "I:failed"; fi
     status=`expr $status + $ret`
 fi
@@ -37,7 +47,8 @@ ret=0
 (cd ns2; $NAMED -c named-alt2.conf -D ns2-extra-2 -X named.lock -m record,size,mctx -d 99 -g -U 4 >> named3.run 2>&1 & )
 sleep 2
 grep "another named process" ns2/named3.run > /dev/null || ret=1
-[ -s ns2/named3.pid ] && $KILL -15 `cat ns2/named3.pid`
+pid=`cat ns2/named3.pid 2>/dev/null`
+test "${pid:+set}" = set && $KILL -15 ${pid} >/dev/null 2>&1
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
@@ -47,7 +58,8 @@ ret=0
 (cd ns2; $NAMED -c named-alt3.conf -D ns2-extra-3 -m record,size,mctx -d 99 -g -U 4 >> named4.run 2>&1 & )
 sleep 2
 grep "another named process" ns2/named4.run > /dev/null && ret=1
-[ -s ns2/named4.pid ] && $KILL -15 `cat ns2/named4.pid`
+pid=`cat ns2/named4.pid 2>/dev/null`
+test "${pid:+set}" = set && $KILL -15 ${pid} >/dev/null 2>&1
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
@@ -85,9 +97,12 @@ then
     status=`expr $status + $ret`
 
     echo "I: shutting down existing named"
-    [ -s named4.pid ] && kill -15 `cat named4.pid` > /dev/null 2>&1
-    [ -s named5.pid ] && kill -15 `cat named5.pid` > /dev/null 2>&1
-    [ -s named6.pid ] && kill -15 `cat named6.pid` > /dev/null 2>&1
+    pid=`cat named4.pid 2>/dev/null`
+    test "${pid:+set}" = set && $KILL -15 ${pid} >/dev/null 2>&1
+    pid=`cat named5.pid 2>/dev/null`
+    test "${pid:+set}" = set && $KILL -15 ${pid} >/dev/null 2>&1
+    pid=`cat named6.pid 2>/dev/null`
+    test "${pid:+set}" = set && $KILL -15 ${pid} >/dev/null 2>&1
 fi
 
 n=`expr $n + 1`
@@ -97,7 +112,8 @@ cd ns2
 $NAMED -c named-alt4.conf -d 99 -g > named4.run 2>&1 &
 sleep 2
 grep "exiting (due to fatal error)" named4.run > /dev/null || ret=1
-[ -s named4.pid ] && kill -15 `cat named4.pid` > /dev/null 2>&1
+pid=`cat named4.pid 2>/dev/null`
+test "${pid:+set}" = set && $KILL -15 ${pid} >/dev/null 2>&1
 cd ..
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
@@ -109,7 +125,8 @@ cd ns2
 $NAMED -c named-alt5.conf -d 99 -g > named5.run 2>&1 &
 sleep 2
 grep "exiting (due to fatal error)" named5.run > /dev/null || ret=1
-[ -s named5.pid ] && kill -15 `cat named5.pid` > /dev/null 2>&1
+pid=`cat named5.pid 2>/dev/null`
+test "${pid:+set}" = set && $KILL -15 ${pid} >/dev/null 2>&1
 cd ..
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
@@ -121,7 +138,8 @@ cd ns2
 $NAMED -c named-alt6.conf -d 99 -g > named6.run 2>&1 &
 sleep 2
 grep "exiting (due to fatal error)" named6.run > /dev/null || ret=1
-[ -s named6.pid ] && kill -15 `cat named6.pid` > /dev/null 2>&1
+pid=`cat named6.pid 2>/dev/null`
+test "${pid:+set}" = set && $KILL -15 ${pid} >/dev/null 2>&1
 cd ..
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`