add "copy_stream" config directive
[rainbows.git] / t / t0027-nil-copy_stream.sh
blob03c7f0ab1320b6267f01af247c0e129d86e137a8
1 #!/bin/sh
2 . ./test-lib.sh
3 test -r random_blob || die "random_blob required, run with 'make $0'"
5 case $model in
6 ThreadSpawn|WriterThreadSpawn|ThreadPool|WriterThreadPool|Base) ;;
7 XEpollThreadSpawn) ;;
8 *)
9 t_info "skipping $T since it doesn't use copy_stream"
10 exit 0
12 esac
14 t_plan 7 "large file 'copy_stream nil' test for $model"
16 t_begin "setup and startup" && {
17 rtmpfiles curl_out
18 rainbows_setup $model
19 cat >> $unicorn_config <<EOF
20 Rainbows! do
21 copy_stream nil
22 end
23 EOF
24 rainbows -E none -D large-file-response.ru -c $unicorn_config
25 rainbows_wait_start
28 t_begin "read random blob sha1 and size" && {
29 random_blob_sha1=$(rsha1 < random_blob)
30 random_blob_size=$(wc -c < random_blob)
33 t_begin "send a series HTTP/1.1 requests sequentially" && {
34 for i in a b c
36 sha1=$( (curl -sSfv http://$listen/random_blob &&
37 echo ok >$ok) | rsha1)
38 test $sha1 = $random_blob_sha1
39 test xok = x$(cat $ok)
40 done
43 # this was a problem during development
44 t_begin "HTTP/1.0 test" && {
45 sha1=$( (curl -0 -sSfv http://$listen/random_blob &&
46 echo ok >$ok) | rsha1)
47 test $sha1 = $random_blob_sha1
48 test xok = x$(cat $ok)
51 t_begin "HTTP/0.9 test" && {
53 printf 'GET /random_blob\r\n'
54 rsha1 < $fifo > $tmp &
55 wait
56 echo ok > $ok
57 ) | socat - TCP:$listen > $fifo
58 test $(cat $tmp) = $random_blob_sha1
59 test xok = x$(cat $ok)
62 t_begin "shutdown server" && {
63 kill -QUIT $rainbows_pid
66 t_begin "check stderr" && check_stderr
68 t_done