2 # Copyright (c) 2009 Rainbows! hackers
3 # Copyright (c) 2010 Unicorn hackers
8 # sometimes we rely on http_proxy to avoid wasting bandwidth with Isolate
9 # and multiple Ruby versions
10 NO_PROXY
=${UNICORN_TEST_ADDR-127.0.0.1}
15 RUBY_VERSION
=${RUBY_VERSION-$($RUBY -e 'puts RUBY_VERSION')}
16 RUBY_ENGINE
=${RUBY_ENGINE-$($RUBY -e 'puts((RUBY_ENGINE rescue "ruby"))')}
17 t_pfx
=$PWD/trash
/$T-$RUBY_ENGINE-$RUBY_VERSION
23 test -x $PWD/bin
/unused_listen || die
"must be run in 't' directory"
28 while ! test -s "$path" && test $nr -gt 0
35 # "unix_time" is not in POSIX, but in GNU, and FreeBSD 9.0 (possibly earlier)
37 $RUBY -e 'puts Time.now.to_i'
40 # "wc -l" outputs leading whitespace on *BSDs, filter it out for portability
42 wc -l |
tr -d '[:space:]'
45 # "wc -c" outputs leading whitespace on *BSDs, filter it out for portability
47 wc -c |
tr -d '[:space:]'
50 # given a list of variable names, create temporary files and assign
51 # the pathnames to those variables
63 T_RM_LIST
="$T_RM_LIST $_tmp"
66 _tmp
="$(mktemp -t $id.$$.XXXXXXXX)"
67 if test $
(printf "$_tmp" |count_bytes
) -gt 108
69 echo >&2 "$_tmp too long, tests may fail"
70 echo >&2 "Try to set TMPDIR to a shorter path"
74 T_RM_LIST
="$T_RM_LIST $_tmp"
80 T_OK_RM_LIST
="$T_OK_RM_LIST $_tmp"
90 sed -e "s/^/$id:/" < $_file
97 if grep -v $T $_r_err |
grep -i Error
99 die
"Errors found in $_r_err"
100 elif grep SIGKILL
$_r_err
102 die
"SIGKILL found in $_r_err"
108 eval $
(unused_listen
)
109 port
=$
(expr $listen : '[^:]*:\([0-9]\+\)')
110 host=$
(expr $listen : '\([^:]*\):[0-9]\+')
112 rtmpfiles unicorn_config pid r_err r_out fifo tmp ok
113 cat > $unicorn_config <<EOF
121 unicorn_wait_start
() {
122 # no need to play tricks with FIFOs since we got "ready_pipe" now
123 unicorn_pid
=$
(cat $pid)