about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-09 14:06:10 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-09 16:10:38 -0800
commita7ac8393ea6a1767ba07f95e8932d06a9f9db398 (patch)
tree604dc57be27bfdb47021b0404512e4d792f0cb66
parentcf5ba246ac045101a591bbcba57027e7fc5f492b (diff)
downloadrainbows-a7ac8393ea6a1767ba07f95e8932d06a9f9db398.tar.gz
Avoid the chances of misfiring when waiting on the master
process to start in case something bad happens or we're
sharing the FIFO for other purposes.
-rwxr-xr-xt/t0004-heartbeat-timeout.sh2
-rw-r--r--t/test-lib.sh4
2 files changed, 3 insertions, 3 deletions
diff --git a/t/t0004-heartbeat-timeout.sh b/t/t0004-heartbeat-timeout.sh
index d7a54a7..4aa8fd7 100755
--- a/t/t0004-heartbeat-timeout.sh
+++ b/t/t0004-heartbeat-timeout.sh
@@ -37,7 +37,7 @@ t_begin "ensure timeout took 3-6 seconds" && {
 }
 
 t_begin "wait for new worker to start up" && {
-        test x = x"$(cat $fifo)"
+        test xSTART = x"$(cat $fifo)"
 }
 
 t_begin "we get a fresh new worker process" && {
diff --git a/t/test-lib.sh b/t/test-lib.sh
index d28eaa0..1e22cb3 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -110,7 +110,7 @@ before_fork do |server, worker|
   # so notify the script on the first worker we spawn
   # by opening the FIFO
   if worker.nr == 0
-    File.open("$fifo", "wb").close
+    File.open("$fifo", "wb") { |fp| fp.syswrite "START" }
   end
 end
 EOF
@@ -130,7 +130,7 @@ EOF
 rainbows_wait_start () {
         # "cat $fifo" will block until the before_fork hook is called in
         # the Unicorn config file
-        test x = x"$(cat $fifo)"
+        test xSTART = x"$(cat $fifo)"
         rainbows_pid=$(cat $pid)
 }