3 STRACE
=$
(which strace
2>/dev
/null ||
:)
6 t_info
"strace not found, skipping $T"
9 if test x
"$(uname -s)" != xLinux
11 t_info
"Linux is the only supported OS for $T"
15 # these buffer internally in external libraries, so we can't detect when
17 skip_models EventMachine NeverBlock
18 skip_models Coolio CoolioThreadPool CoolioThreadSpawn
19 skip_models Revactor Rev RevThreadPool RevThreadSpawn
21 # not sure why, but we don't have time to care about Ruby 1.8 too much
23 1.8.
*) skip_models WriterThreadSpawn WriterThreadPool
;;
26 t_plan
13 "Kgio autopush tests"
32 strace
-p $worker_pid -e '!futex' -f -o $strace_out &
34 while ! test -s $strace_out; do sleep 1; done
39 while test 2 -gt $
(grep TCP_CORK
$strace_out |
wc -l)
45 die
"waited too long ($nr seconds) for TCP_CORK"
50 test 2 -eq $
(grep TCP_CORK
$strace_out |
wc -l)
51 fgrep
'SOL_TCP, TCP_CORK, [0], 4) = 0' $strace_out
52 fgrep
'SOL_TCP, TCP_CORK, [1], 4) = 0' $strace_out
55 t_begin
"setup and start" && {
56 rainbows_setup
$model 1 1
58 ed
-s $unicorn_config <<EOF
59 ,s/^listen.*/listen "$listen", :tcp_nodelay => true, :tcp_nopush => true/
62 rainbows
-D large-file-response.ru
-c $unicorn_config -E none
66 t_begin
"read worker pid" && {
67 worker_pid
=$
(curl
-sSf http
://$listen/pid
)
71 t_begin
"start strace on worker" && start_strace
73 t_begin
"reading RSS uncorks" && {
74 curl
-sSf http
://$listen/rss
>/dev
/null
77 t_begin
"restart strace on worker" && {
83 t_begin
"reading static file uncorks" && {
84 curl
-sSf http
://$listen/random_blob
>/dev
/null
88 t_begin
"stop strace on worker" && {
93 t_begin
"enable sendfile" && {
94 echo >> $unicorn_config 'require "sendfile"'
95 kill -HUP $rainbows_pid
96 test xSTART
= x
"$(cat $fifo)"
99 t_begin
"reread worker pid" && {
100 worker_pid
=$
(curl
-sSf http
://$listen/pid
)
104 t_begin
"restart strace on the worker" && start_strace
106 t_begin
"HTTP/1.x GET on static file with sendfile uncorks" && {
107 curl
-sSf http
://$listen/random_blob
>/dev
/null
111 t_begin
"killing succeeds" && {
118 t_begin
"check stderr" && check_stderr