]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Wait for test instance of named to exit before completing subtest.
authorMark Andrews <marka@isc.org>
Mon, 31 Aug 2020 03:54:12 +0000 (13:54 +1000)
committerMark Andrews <marka@isc.org>
Thu, 10 Sep 2020 10:13:03 +0000 (20:13 +1000)
(cherry picked from commit dda5b7b0b86ca3250bcc3e6a4e3f931fdd253561)

bin/tests/system/runtime/clean.sh
bin/tests/system/runtime/tests.sh
configure
ltmain.sh
m4/libtool.m4

index 4a756b3d381a5c53d82aee99b4be90413807878c..1eddbee831a2b6172908ca4c6932647d69835b49 100644 (file)
@@ -9,13 +9,15 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
-rm -f ns2/named.conf ns2/named-alt*.conf
-rm -f */named.memstats
+[ -d ns2/nope ] && chmod 755 ns2/nope
+
+rm -f *.pid
 rm -f */named*.run
+rm -f */named.memstats
+rm -f kill*.out
+rm -f ns*/managed-keys.bind*
 rm -f ns*/named.lock ns*/named*.pid ns*/other.lock
-rm -f *.pid
+rm -f ns2/named.conf ns2/named-alt*.conf
 rm -f rndc.out*
-[ -d ns2/nope ] && chmod 755 ns2/nope
 rm -rf ns2/nope
 rm -rf ns2/tmp.*
-rm -f ns*/managed-keys.bind*
index e35cb70267096654b3c88ef2c619fa4ce8dfd0d9..7ab8a4543a972ff342d7dab40b9e12d661044363 100644 (file)
@@ -16,6 +16,7 @@ SYSTEMTESTTOP=..
 set -e
 
 RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s"
+NAMED_DEFAULT_ARGS="-m record,size,mctx -d 99 -g -U 4"
 
 kill_named() {
        pidfile="${1}"
@@ -44,21 +45,26 @@ kill_named() {
        return 0
 }
 
-wait_for_named() {
-       retries=10
-       while [ "$retries" -gt 0 ]; do
-               if grep "$@" >/dev/null 2>&1; then
-                       break
-               fi
-               sleep 1
-               retries=$((retries-1))
-       done
-       if [ "$retries" -eq 0 ]; then
-               return 1
-       fi
-       return 0
+check_named_log() {
+       grep "$@" >/dev/null 2>&1
 }
 
+run_named() (
+       dir="$1"
+       shift
+       run="$1"
+       shift
+       if cd "$dir" > /dev/null 2>&1
+       then
+               "${NAMED}" "$@" ${NAMED_DEFAULT_ARGS} >> "$run" 2>&1 &
+               echo $!
+       fi
+)
+
+check_pid() (
+       return $(! $KILL -0 "${1}" >/dev/null 2>&1)
+)
+
 status=0
 n=0
 
@@ -74,18 +80,24 @@ status=$((status+ret))
 n=$((n+1))
 echo_i "verifying that named checks for conflicting named processes ($n)"
 ret=0
-(cd ns2 && $NAMED -c named-alt2.conf -D runtime-ns2-extra-2 -X named.lock -m record,size,mctx -d 99 -g -U 4 >> named$n.run 2>&1 & )
-wait_for_named "another named process" ns2/named$n.run || ret=1
+testpid=$(run_named ns2 named$n.run -c named-alt2.conf -D runtime-ns2-extra-2 -X named.lock)
+test -n "$testpid" || ret=1
+retry_quiet 10 check_named_log "another named process" ns2/named$n.run || ret=1
+test -n "$testpid" && retry_quiet 10 check_pid $testpid || ret=1
+test -n "$testpid" && $KILL -15 $testpid > kill$n.out 2>&1 && ret=1
+test -n "$testpid" && retry_quiet 10 check_pid $testpid || ret=1
 if [ $ret -ne 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
 n=$((n+1))
 echo_i "verifying that 'lock-file none' disables process check ($n)"
 ret=0
-(cd ns2 && $NAMED -c named-alt3.conf -D runtime-ns2-extra-3 -m record,size,mctx -d 99 -g -U 4 >> named$n.run 2>&1 & )
-wait_for_named "running$" ns2/named$n.run || ret=1
+testpid=$(run_named ns2 named$n.run -c named-alt3.conf -D runtime-ns2-extra-3)
+test -n "$testpid" || ret=1
+retry_quiet 10 check_named_log "running$" ns2/named$n.run || ret=1
 grep "another named process" ns2/named$n.run > /dev/null && ret=1
 kill_named ns2/named-alt3.pid || ret=1
+test -n "$testpid" && retry_quiet 10 check_pid $testpid || ret=1
 if [ $ret -ne 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
@@ -135,30 +147,36 @@ status=$((status+ret))
 n=$((n+1))
 echo_i "checking that named refuses to start if working directory is not writable ($n)"
 ret=0
-(cd ns2 && $NAMED -c named-alt4.conf -D runtime-ns2-extra-4 -d 99 -g > named$n.run 2>&1 &)
-wait_for_named "exiting (due to fatal error)" ns2/named$n.run || ret=1
+testpid=$(run_named ns2 named$n.run -c named-alt4.conf -D runtime-ns2-extra-4)
+test -n "$testpid" || ret=1
+retry_quiet 10 check_named_log "exiting (due to fatal error)" ns2/named$n.run || ret=1
 grep "[^-]directory './nope' is not writable" ns2/named$n.run > /dev/null 2>&1 || ret=1
 kill_named ns2/named.pid && ret=1
+test -n "$testpid" && retry_quiet 10 check_pid $testpid || ret=1
 if [ $ret -ne 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
 n=$((n+1))
 echo_i "checking that named refuses to start if managed-keys-directory is not writable ($n)"
 ret=0
-(cd ns2 && $NAMED -c named-alt5.conf -D runtime-ns2-extra-5 -d 99 -g > named$n.run 2>&1 &)
-wait_for_named "exiting (due to fatal error)" ns2/named$n.run || ret=1
+testpid=$(run_named ns2 named$n.run -c named-alt5.conf -D runtime-ns2-extra-5)
+test -n "$testpid" || ret=1
+retry_quiet 10 check_named_log "exiting (due to fatal error)" ns2/named$n.run || ret=1
 grep "managed-keys-directory './nope' is not writable" ns2/named$n.run > /dev/null 2>&1 || ret=1
 kill_named named.pid && ret=1
+test -n "$testpid" && retry_quiet 10 check_pid $testpid || ret=1
 if [ $ret -ne 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
 n=$((n+1))
 echo_i "checking that named refuses to start if new-zones-directory is not writable ($n)"
 ret=0
-(cd ns2 && $NAMED -c named-alt6.conf -D runtime-ns2-extra-6 -d 99 -g > named$n.run 2>&1 &)
-wait_for_named "exiting (due to fatal error)" ns2/named$n.run || ret=1
+testpid=$(run_named ns2 named$n.run -c named-alt6.conf -D runtime-ns2-extra-6)
+test -n "$testpid" || ret=1
+retry_quiet 10 check_named_log "exiting (due to fatal error)" ns2/named$n.run || ret=1
 grep "new-zones-directory './nope' is not writable" ns2/named$n.run > /dev/null 2>&1 || ret=1
 kill_named ns2/named.pid && ret=1
+test -n "$testpid" && retry_quiet 10 check_pid $testpid || ret=1
 if [ $ret -ne 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
@@ -166,10 +184,12 @@ n=$((n+1))
 echo_i "checking that named logs control characters in octal notation ($n)"
 ret=0
 INSTANCE_NAME="runtime-ns2-extra-7-$(cat ctrl-chars)"
-(cd ns2 && $NAMED -c named-alt7.conf -D "${INSTANCE_NAME}" -d 99 -g > named$n.run 2>&1 &)
-wait_for_named "running$" ns2/named$n.run || ret=1
+testpid=$(run_named ns2 named$n.run -c named-alt7.conf -D "${INSTANCE_NAME}")
+test -n "$testpid" || ret=1
+retry_quiet 10 check_named_log "running$" ns2/named$n.run || ret=1
 grep 'running as.*\\177\\033' ns2/named$n.run > /dev/null || ret=1
 kill_named ns2/named.pid || ret=1
+test -n "$testpid" && retry_quiet 10 check_pid $testpid || ret=1
 if [ $ret -ne 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
@@ -177,10 +197,12 @@ n=$((n+1))
 echo_i "checking that named escapes special characters in the logs ($n)"
 ret=0
 INSTANCE_NAME="runtime-ns2-extra-8-$;"
-(cd ns2 && $NAMED -c named-alt7.conf -D "${INSTANCE_NAME}" -d 99 -g > named$n.run 2>&1 &)
-wait_for_named "running$" ns2/named$n.run || ret=1
+testpid=$(run_named ns2 named$n.run -c named-alt7.conf -D "${INSTANCE_NAME}")
+test -n "$testpid" || ret=1
+retry_quiet 10 check_named_log "running$" ns2/named$n.run || ret=1
 grep 'running as.*\\$\\;' ns2/named$n.run > /dev/null || ret=1
 kill_named ns2/named.pid || ret=1
+test -n "$testpid" && retry_quiet 10 check_pid $testpid || ret=1
 if [ $ret -ne 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
@@ -189,10 +211,12 @@ echo_i "checking that named logs an ellipsis when the command line is larger tha
 ret=0
 LONG_CMD_LINE=$(cat long-cmd-line)
 # shellcheck disable=SC2086
-(cd ns2 && $NAMED $LONG_CMD_LINE -c "named-alt7.conf" -g > named$n.run 2>&1 &)
-wait_for_named "running$" ns2/named$n.run || ret=1
+testpid=$(run_named ns2 named$n.run $LONG_CMD_LINE -c "named-alt7.conf")
+test -n "$testpid" || ret=1
+retry_quiet 10 check_named_log "running$" ns2/named$n.run || ret=1
 grep "running as.*\.\.\.$" ns2/named$n.run > /dev/null || ret=1
 kill_named ns2/named.pid || ret=1
+test -n "$testpid" && retry_quiet 10 check_pid $testpid || ret=1
 if [ $ret -ne 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
@@ -202,19 +226,21 @@ if [ "$(id -u)" -eq 0 ] && [ -z "$CYGWIN" ]; then
     ret=0
     TEMP_NAMED_DIR=$(mktemp -d "$(pwd)/ns2/tmp.XXXXXXXX")
     if [ "$?" -eq 0 ]; then
-        copy_setports ns2/named-alt9.conf.in "${TEMP_NAMED_DIR}/named-alt9.conf"
-        export SOFTHSM2_CONF="${TEMP_NAMED_DIR}/softhsm2.conf"
-        sh "$TOP/bin/tests/prepare-softhsm2.sh"
-        chown -R nobody: "${TEMP_NAMED_DIR}"
-        chmod 0700 "${TEMP_NAMED_DIR}"
-        ( cd "${TEMP_NAMED_DIR}" && $NAMED -u nobody -c named-alt9.conf -d 99 -g -U 4 >> named$n.run 2>&1 & ) || ret=1
-        wait_for_named "running$" "${TEMP_NAMED_DIR}/named$n.run" || ret=1
-        [ -s "${TEMP_NAMED_DIR}/named9.pid" ] || ret=1
-        grep "loading configuration: permission denied" "${TEMP_NAMED_DIR}/named$n.run" > /dev/null && ret=1
-        kill_named "${TEMP_NAMED_DIR}/named9.pid" || ret=1
+       copy_setports ns2/named-alt9.conf.in "${TEMP_NAMED_DIR}/named-alt9.conf"
+       export SOFTHSM2_CONF="${TEMP_NAMED_DIR}/softhsm2.conf"
+       sh "$TOP/bin/tests/prepare-softhsm2.sh"
+       chown -R nobody: "${TEMP_NAMED_DIR}"
+       chmod 0700 "${TEMP_NAMED_DIR}"
+       testpid=$(run_named "${TEMP_NAMED_DIR}" "${TEMP_NAMED_DIR}/named$n.run" -u nobody -c named-alt9.conf)
+       test -n "$testpid" || ret=1
+       retry_quiet 10 check_named_log "running$" "${TEMP_NAMED_DIR}/named$n.run" || ret=1
+       [ -s "${TEMP_NAMED_DIR}/named9.pid" ] || ret=1
+       grep "loading configuration: permission denied" "${TEMP_NAMED_DIR}/named$n.run" > /dev/null && ret=1
+       kill_named "${TEMP_NAMED_DIR}/named9.pid" || ret=1
+       test -n "$testpid" && retry_quiet 10 check_pid $testpid || ret=1
     else
-        echo_i "mktemp failed"
-        ret=1
+       echo_i "mktemp failed"
+       ret=1
     fi
     if [ $ret -ne 0 ]; then echo_i "failed"; fi
     status=$((status+ret))
index b446bcf45e70937f3c0dc6fce1a5d4a206eac291..e5acb387942fb19e8c16e213a3e948e9614cc4a2 100755 (executable)
--- a/configure
+++ b/configure
@@ -7577,16 +7577,11 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
       _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
     darwin1.*)
       _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
-    darwin*) # darwin 5.x on
-      # if running on 10.5 or later, the deployment target defaults
-      # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it?
-      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
-       10.0,*86*-darwin8*|10.0,*-darwin[91]*)
-         _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
-       10.[012][,.]*)
+    darwin*)
+      case ${MACOSX_DEPLOYMENT_TARGET},$host in
+       10.[012],*|,*powerpc*)
          _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
-       10.*)
+       *)
          _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
       esac
     ;;
index 0f0a2da3f9dd10627626bf9725b332d95f314393..b6f3fcbb288b937ab5270d580f3d2eab5684b216 100644 (file)
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -7273,9 +7273,11 @@ func_mode_link ()
       # --sysroot=*          for sysroot support
       # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
       # -stdlib=*            select c++ std lib with clang
+      # -fsanitize=*         Clang memory and address sanitizer
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
       -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-      -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*)
+      -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
+      -fsanitize=*)
         func_quote_for_eval "$arg"
        arg=$func_quote_for_eval_result
         func_append compile_command " $arg"
index a3bc337b79ad3d2bd26f0c10644e55db74e70448..92060119f737fef7352d509fc61f4640e0741828 100644 (file)
@@ -1067,16 +1067,11 @@ _LT_EOF
       _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
     darwin1.*)
       _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
-    darwin*) # darwin 5.x on
-      # if running on 10.5 or later, the deployment target defaults
-      # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it?
-      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
-       10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
-         _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
-       10.[[012]][[,.]]*)
+    darwin*)
+      case ${MACOSX_DEPLOYMENT_TARGET},$host in
+       10.[[012]],*|,*powerpc*)
          _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
-       10.*)
+       *)
          _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
       esac
     ;;