t3003: set executable bit
[rainbows.git] / t / t3003-revactor-reopen-logs.sh
blobe39160f64927bc24f982be875db6147ff86fe144
1 #!/bin/sh
2 . ./test-lib.sh
3 require_revactor
5 eval $(unused_listen)
6 rtmpfiles unicorn_config curl_out curl_err pid r_err r_out r_rot
8 nr_client=30
9 nr_actor=10
11 cat > $unicorn_config <<EOF
12 listen "$listen"
13 pid "$pid"
14 stderr_path "$r_err"
15 stdout_path "$r_out"
16 Rainbows! do
17 use :Revactor
18 worker_connections $nr_actor
19 end
20 EOF
22 SLEEP_CLASS=Actor rainbows -D sleep.ru -c $unicorn_config
23 wait_for_pid $pid
25 start=$(date +%s)
26 for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" </dev/null)
28 ( curl -sSf http://$listen/2 >> $curl_out 2>> $curl_err ) &
29 done
30 ! grep Error $r_err
32 rm $r_rot
33 mv $r_err $r_rot
35 kill -USR1 $(cat $pid)
36 wait_for_pid $r_err
38 dbgcat r_rot
39 dbgcat r_err
41 wait
42 echo elapsed=$(( $(date +%s) - $start ))
43 ! test -s $curl_err
44 test x"$(wc -l < $curl_out)" = x$nr_client
45 nr=$(sort < $curl_out | uniq | wc -l)
47 test "$nr" -eq 1
48 test x$(sort < $curl_out | uniq) = xHello
49 ! grep Error $r_err
50 ! grep Error $r_rot
52 kill $(cat $pid)
53 dbgcat r_err
54 ! grep Error $r_err