2 # Copyright (c) 2009 Rainbows! developers
8 # defaulting to Base would unfortunately fail some concurrency tests
10 t_info
"model undefined, defaulting to $model"
15 RUBY_VERSION
=${RUBY_VERSION-$($RUBY -e 'puts RUBY_VERSION')}
16 t_pfx
=$PWD/trash
/$model.
$T-$RUBY_VERSION
22 test -x $PWD/bin
/unused_listen || die
"must be run in 't' directory"
27 while ! test -s "$path" && test $nr -gt 0
34 # requires $1 and prints out the value of $2
38 if ! $RUBY -r$lib -e "puts $const" >/dev
/null
2>&1
40 t_info
"skipping $T since we don't have $lib"
45 # given a list of variable names, create temporary files and assign
46 # the pathnames to those variables
58 T_RM_LIST
="$T_RM_LIST $_tmp"
62 T_OK_RM_LIST
="$T_OK_RM_LIST $_tmp"
72 sed -e "s/^/$id:/" < $_file
81 die
"Errors found in $_r_err"
82 elif grep SIGKILL
$_r_err
84 die
"SIGKILL found in $_r_err"
88 # rainbows_setup [ MODEL [ WORKER_CONNECTIONS ] ]
91 rtmpfiles unicorn_config pid r_err r_out fifo tmp ok
92 cat > $unicorn_config <<EOF
98 # close my-tap-lib.sh FDs
99 unless ENV['UNICORN_FD']
100 IO.for_fd(3).close rescue nil
101 IO.for_fd(4).close rescue nil
104 before_fork do |server, worker|
105 # test script will block while reading from $fifo,
106 # so notify the script on the first worker we spawn
107 # by opening the FIFO
109 File.open("$fifo", "wb").close
118 test $# -eq 2 && echo " worker_connections $2"
121 echo "Rainbows! { use :$model }"
126 rainbows_wait_start
() {
127 # "cat $fifo" will block until the before_fork hook is called in
128 # the Unicorn config file
129 test x
= x
"$(cat $fifo)"
130 rainbows_pid
=$
(cat $pid)
134 Rev
) require_check
rev Rev
::VERSION
;;
135 Revactor
) require_check revactor Revactor
::VERSION
;;
136 EventMachine
) require_check eventmachine EventMachine
::VERSION
;;