7 RUBY_VERSION
=${RUBY_VERSION-$($RUBY -e 'puts RUBY_VERSION')}
8 t_pfx
=$PWD/trash
/$T-$RUBY_VERSION
10 if test -z "$RAINBOWS_MODEL"
13 1.9.
*) RAINBOWS_MODEL
=FiberSpawn
;;
14 *) RAINBOWS_MODEL
=ThreadSpawn
;;
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_RM_LIST
="$T_RM_LIST $_tmp"
66 T_OK_RM_LIST
="$T_OK_RM_LIST $_tmp"
76 sed -e "s/^/$id:/" < $_file
83 if grep -i Error
$_r_err
85 die
"Errors found in $_r_err"
86 elif grep SIGKILL
$_r_err
88 die
"SIGKILL found in $_r_err"
92 rack_server_setup
() {
94 rtmpfiles unicorn_config pid r_err r_out fifo tmp ok
95 cat > $unicorn_config <<EOF
101 # close my-tap-lib.sh FDs
102 unless ENV['UNICORN_FD']
103 IO.for_fd(3).close rescue nil
104 IO.for_fd(4).close rescue nil
107 before_fork do |server, worker|
108 # test script will block while reading from $fifo,
109 # so notify the script on the first worker we spawn
110 # by opening the FIFO
112 File.open("$fifo", "wb") { |fp| fp.syswrite "START" }
122 rack_server_wait_start
() {
123 # "cat $fifo" will block until the before_fork hook is called in
124 # the Unicorn config file
125 test xSTART
= x
"$(cat $fifo)"
126 rack_server_pid
=$
(cat $pid)
129 rack_server_start
() {
131 rainbows
-D echo.ru
-c $unicorn_config
132 rack_server_wait_start
136 kill "$rack_server_pid"