From ad3b40d258e09c7ddbfee387bd46e8b1d22e64c3 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 27 Feb 2007 02:59:22 +0000 Subject: r21554: Use a snippet from tridge's junkcode to cause us to wait for smbd to exit. If we kill smbd right away, we can interrupt the gcov data file writeout. Instead, we now wait up to 20 seconds for the process to exit, before sending it a kill -9. Andrew Bartlett (This used to be commit c547bce3d305f64d65961051e6462b8c83871f38) --- source4/script/tests/test_functions.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source4/script/tests/test_functions.sh') diff --git a/source4/script/tests/test_functions.sh b/source4/script/tests/test_functions.sh index 42c7d614d3..9b869782cd 100755 --- a/source4/script/tests/test_functions.sh +++ b/source4/script/tests/test_functions.sh @@ -113,6 +113,22 @@ EOF exit $failed } +# wait for a pid with given timeout +# returns 1 if it timed out, 0 if the process exited itself +waitforpid() { + pid=$1 + timeout=$2 # in seconds + _wcount=0 + while kill -0 $pid 2> /dev/null; do + sleep 1; + _wcount=`expr $_wcount + 1` + if [ $_wcount -eq $timeout ]; then + return "1"; + fi + done + return "0"; +} + if [ -z "$VALGRIND" ]; then MALLOC_CHECK_=2 export MALLOC_CHECK_ -- cgit