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"
24 # requires $1 and prints out the value of $2
28 if ! $RUBY -r$lib -e "puts $const" >/dev
/null
2>&1
30 t_info
"skipping $T since we don't have $lib"
38 if test x
"$model" != x
"$i"
42 t_info
"skipping $T since it is not compatible with $model"
48 # given a list of variable names, create temporary files and assign
49 # the pathnames to those variables
61 T_RM_LIST
="$T_RM_LIST $_tmp"
65 T_RM_LIST
="$T_RM_LIST $_tmp"
69 T_OK_RM_LIST
="$T_OK_RM_LIST $_tmp"
79 sed -e "s/^/$id:/" < $_file
86 if grep -i Error
$_r_err
88 die
"Errors found in $_r_err"
89 elif grep SIGKILL
$_r_err
91 die
"SIGKILL found in $_r_err"
95 # rainbows_setup [ MODEL [ WORKER_CONNECTIONS ] ]
98 rtmpfiles unicorn_config pid r_err r_out fifo tmp ok
99 cat > $unicorn_config <<EOF
105 after_fork do |server, worker|
106 # test script will block while reading from $fifo,
107 # so notify the script on the first worker we spawn
108 # by opening the FIFO
110 File.open("$fifo", "wb") { |fp| fp.syswrite "START" }
115 # set a higher default for tests since we run heavily-loaded
116 # boxes and sometimes sleep 1s in tests
119 echo " client_max_body_size nil"
123 test $# -eq 2 && echo " worker_connections $2"
126 echo " keepalive_timeout $3"
128 echo " keepalive_timeout $kato"
132 echo " keepalive_timeout $kato"
138 rainbows_wait_start
() {
139 # "cat $fifo" will block until the before_fork hook is called in
140 # the Unicorn config file
141 test xSTART
= x
"$(cat $fifo)"
142 rainbows_pid
=$
(cat $pid)
146 _cmd
="$(which sha1sum 2>/dev/null || :)"
147 test -n "$_cmd" || _cmd
="$(which openssl 2>/dev/null || :) sha1"
148 test "$_cmd" != " sha1" || _cmd
="$(which gsha1sum 2>/dev/null || :)"
150 # last resort, see comments in sha1sum.rb for reasoning
151 test -n "$_cmd" || _cmd
=sha1sum.rb
152 expr "$($_cmd)" : '\([a-f0-9]\{40\}\)'
155 req_curl_chunked_upload_err_check
() {
157 curl
--version 2>/dev
/null |
awk '$1 == "curl" {
159 if ((v[1] < 7) || (v[1] == 7 && v[2] < 18))
165 t_info
"curl >= 7.18.0 required for $T"
171 Rev
) require_check
rev Rev
::VERSION
;;
172 Revactor
) require_check revactor Revactor
::VERSION
;;
173 EventMachine
) require_check eventmachine EventMachine
::VERSION
;;