From 2f8ed953decce975307a6c5b39330af816e184bc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 24 Oct 2009 12:20:58 -0700 Subject: tests: common setup and wait_start functions Instead of sleeping and waiting for a PID file to appear, just use a named-pipe and block on it in the test scripts since we know Unicorn won't attempt to fork until sockets are already bound. --- t/test-lib.sh | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 't/test-lib.sh') diff --git a/t/test-lib.sh b/t/test-lib.sh index b4ece30..d3815c4 100755 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -23,7 +23,7 @@ then t2???-thread-spawn-*.sh) model=ThreadSpawn ;; t3???-revactor-*.sh) model=Revactor ;; t4???-rev-*.sh) model=Rev ;; - *) model=any ;; + *) model=Base ;; esac fi @@ -126,6 +126,44 @@ check_stderr () { fi } +rainbows_setup () { + eval $(unused_listen) + rtmpfiles unicorn_config pid r_err r_out fifo tmp ok + cat > $unicorn_config <> $unicorn_config +} + +rainbows_wait_start () { + # "cat $fifo" will block until the before_fork hook is called in + # the Unicorn config file + test x = x"$(cat $fifo)" + rainbows_pid=$(cat $pid) +} + case $model in Rev) require_check rev Rev::VERSION ;; Revactor) require_check revactor Revactor::VERSION ;; -- cgit v1.2.3-24-ge0c7