t0019: add CPU usage test
[rainbows.git] / t / t9001-sendfile-to-path.sh
blob88b9c342f4426608881db8b9485f9e4017e31656
1 #!/bin/sh
2 . ./test-lib.sh
4 t_plan 7 "Sendfile middleware test for $model"
6 t_begin "configure and start" && {
7 rtmpfiles curl_err
8 rainbows_setup
10 # do not allow default middleware to be loaded since it may
11 # kill body#to_path
12 rainbows -E none -D t9001.ru -c $unicorn_config
13 rainbows_wait_start
14 random_blob_sha1=$(rsha1 < random_blob)
17 t_begin "hit with curl" && {
18 sha1=$(curl -sSfv http://$listen/ 2> $curl_err | rsha1)
21 t_begin "kill server" && {
22 kill $rainbows_pid
25 t_begin "SHA1 matches source" && {
26 test x$random_blob_sha1 = x$sha1
29 t_begin "no errors in Rainbows! stderr" && {
30 check_stderr
33 t_begin "X-Sendfile does not show up in headers" && {
34 dbgcat curl_err
35 if grep -i x-sendfile $curl_err
36 then
37 die "X-Sendfile did show up!"
41 t_begin "Content-Length is set correctly in headers" && {
42 expect=$(wc -c < random_blob)
43 grep "^< Content-Length: $expect" $curl_err
46 t_done