export ALGORITHM
export KEY
+trap "kill_process 2" EXIT INT TERM
+
nsdfix ()
{
sed -e 's/"A very .*"/"shorter"/' < test.com > test.com.nsd
;;
*)
echo 'tonsd called with wrong param'
- exit 1
+ exit
esac
echo "" >> nsd.conf
cp ${zone}.bind ${zone}.signed
;;
*)
- echo 'tonsd called with wrong param'
- exit 1
+ echo 'tobind called with wrong param'
+ exit
esac
echo "" >> bind.conf
if [ ! -x ../pdns/pdns_control ]
then
echo "No pdns_control found"
- exit 1
+ exit
fi
loopcount=0
let loopcount=loopcount+1
done
echo "PowerDNS did not start"
- exit 1
+ exit
+}
+
+kill_process ()
+{
+ set +e
+ trap - EXIT INT TERM
+
+ pids=$(cat pdns*.pid)
+
+ if [ -n "$pids" ]
+ then
+ kill $pids
+ # make sure they die.
+ loopcount=0
+ done=0
+ while [ $loopcount -lt 10 ] && [ $done -eq 0 ]
+ do
+ done=1
+ for pid in $pids
+ do
+ kill -0 $pid > /dev/null 2>&1
+ if [ $? -eq 0 ];
+ then
+ done=0
+ fi
+ done
+ let loopcount=loopcount+1
+ sleep 1
+ done
+
+ kill -9 $pids
+ fi
+
+ rm pdns*.pid
+ exit $1
}
if [ ! -x $PDNS ]
then
echo "$PDNS is not executable binary"
- exit 1
+ exit
fi
if [ ! -x $PDNS2 ]
then
echo "$PDNS2 is not executable binary"
- exit 1
+ exit
fi
port=$1
* Specifictest can be used to run only one single test.
__EOF__
- exit 1
+ exit
fi
-${MAKE} -C ../pdns sdig nsec3dig || exit 1
+${MAKE} -C ../pdns sdig nsec3dig || exit
# Copy original zones because the test might modify them (well only the dyndns stuff, but let's make this work for others as well)
for zone in $(grep zone named.conf | cut -f2 -d\")
do
;;
*)
echo "Invalid usage"
- exit 1
+ exit
;;
esac
: > passed_tests
echo 'unknown-context-'"$context" > failed_tests
./toxml $context
- exit 1
+ exit
esac
if [ "$skiplua" == "1" ]; then
read l
fi
-pids=$(cat pdns*.pid)
-
-kill $pids
-# make sure they die.
-set +e
-loopcount=0
-done=0
-while [ $loopcount -lt 10 ] && [ $done -eq 0 ]
-do
- done=1
- for pid in $pids
- do
- kill -0 $pid > /dev/null 2>&1
- if [ $? -eq 0 ]; then
- done=0
- fi
- done
- let loopcount=loopcount+1
- sleep 1
-done
-
-kill -9 $pids
-
-rm pdns*.pid || true
-exit $RETVAL
+trap "kill_process $RETVAL" EXIT