about summary refs log tree commit homepage
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-10-28 08:40:12 +0000
committerEric Wong <normalperson@yhbt.net>2010-10-28 08:41:44 +0000
commit015635f877084cc05a9e6e4c1430c70279d0a04e (patch)
tree1570868d2ecd3d509dc2949005b3b922e973aab3 /t/test-lib.sh
parentb06c6b3ac214bc598d499c994884113d5b106e90 (diff)
downloadrainbows-015635f877084cc05a9e6e4c1430c70279d0a04e.tar.gz
We need to ensure the old worker is really dead before sending
requests after reloading.
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 0fea06b..4f9d4b1 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -148,6 +148,31 @@ rainbows_wait_start () {
         rainbows_pid=$(cat $pid)
 }
 
+wait_for_reload () {
+        case $# in
+        0) err_log=$r_err status=done ;;
+        1) err_log=$1 status=done ;;
+        2) err_log=$1 status=$2 ;;
+        esac
+        while ! egrep '(done|error) reloading' < $err_log >/dev/null
+        do
+                sleep 1
+        done
+        grep "$status reloading" $err_log >/dev/null
+}
+
+wait_for_reap () {
+        case $# in
+        0) err_log=$r_err ;;
+        1) err_log=$1 ;;
+        esac
+
+        while ! grep reaped < $err_log >/dev/null
+        do
+                sleep 1
+        done
+}
+
 rsha1 () {
         _cmd="$(which sha1sum 2>/dev/null || :)"
         test -n "$_cmd" || _cmd="$(which openssl 2>/dev/null || :) sha1"