summaryrefslogtreecommitdiff
path: root/source4/script/tests/test_functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 'source4/script/tests/test_functions.sh')
-rwxr-xr-xsource4/script/tests/test_functions.sh16
1 files changed, 16 insertions, 0 deletions
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_