From 15fe80b3bff7b0d249ee32bcbbe1dfa116d3c629 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 24 Oct 2009 20:41:15 -0700 Subject: tests: remove symlinks and small files, use Make This will make it easier to enable and manage tests for new concurrency models. --- t/GNUmakefile | 33 +++-- t/README | 8 +- t/lib-async-response-no-autochunk.sh | 3 - t/lib-async-response.sh | 65 ---------- t/lib-graceful.sh | 31 ----- t/lib-input-trailer.sh | 67 ---------- t/lib-large-file-response.sh | 82 ------------ t/lib-parser-error.sh | 30 ----- t/lib-rack-input-hammer.sh | 45 ------- t/lib-reopen-logs.sh | 97 -------------- t/lib-simple-http.sh | 142 --------------------- t/simple-http_Base.ru | 3 + t/simple-http_Rev.ru | 9 ++ t/simple-http_Revactor.ru | 10 ++ t/simple-http_ThreadPool.ru | 10 ++ t/simple-http_ThreadSpawn.ru | 10 ++ t/t0000-basic.sh | 2 - t/t0000-simple-http.sh | 142 +++++++++++++++++++++ t/t0002-graceful.sh | 32 +++++ t/t0002-parser-error.sh | 31 +++++ t/t0003-reopen-logs.sh | 97 ++++++++++++++ t/t0005-large-file-response.sh | 83 ++++++++++++ t/t0100-rack-input-hammer.sh | 45 +++++++ t/t0101-rack-input-trailer.sh | 68 ++++++++++ t/t0200-async-response.sh | 66 ++++++++++ t/t0201-async-response-no-autochunk.sh | 3 + t/t1000-thread-pool-basic.sh | 2 - t/t1002-thread-pool-graceful.sh | 2 - t/t1003-thread-pool-reopen-logs.sh | 2 - t/t1004-thread-pool-async-response.sh | 1 - t/t1005-thread-pool-large-file-response.sh | 1 - t/t1006-thread-pool-async-response-no-autochunk.sh | 1 - t/t1100-thread-pool-rack-input.sh | 2 - t/t1101-thread-pool-input-trailer.sh | 2 - t/t2000-thread-spawn-basic.sh | 2 - t/t2002-thread-spawn-graceful.sh | 2 - t/t2003-thread-spawn-reopen-logs.sh | 2 - t/t2004-thread-spawn-async-response.sh | 1 - t/t2005-thread-spawn-large-file-response.sh | 1 - ...006-thread-spawn-async-response-no-autochunk.sh | 1 - t/t2100-thread-spawn-rack-input.sh | 2 - t/t2101-thread-spawn-input-trailer.sh | 2 - t/t3000-revactor-basic.sh | 2 - t/t3002-revactor-graceful.sh | 2 - t/t3003-revactor-reopen-logs.sh | 2 - t/t3004-revactor-async-response.sh | 1 - t/t3005-revactor-large-file-response.sh | 2 - t/t3006-revactor-async-response-no-autochunk.sh | 1 - t/t3100-revactor-rack-input.sh | 2 - t/t3101-revactor-rack-input-trailer.sh | 2 - t/t4000-rev-basic.sh | 2 - t/t4002-rev-graceful.sh | 2 - t/t4003-rev-parser-error.sh | 2 - t/t4003-rev-reopen-logs.sh | 2 - t/t4004-rev-async-response.sh | 1 - t/t4005-rev-large-file-response.sh | 2 - t/t4006-rev-async-response-no-autochunk.sh | 1 - t/t4100-rev-rack-input.sh | 2 - t/t4101-rev-rack-input-trailer.sh | 2 - t/t9000-rack-app-pool.sh | 4 +- t/test-lib.sh | 12 +- 61 files changed, 646 insertions(+), 640 deletions(-) delete mode 100644 t/lib-async-response-no-autochunk.sh delete mode 100644 t/lib-async-response.sh delete mode 100644 t/lib-graceful.sh delete mode 100644 t/lib-input-trailer.sh delete mode 100644 t/lib-large-file-response.sh delete mode 100644 t/lib-parser-error.sh delete mode 100644 t/lib-rack-input-hammer.sh delete mode 100644 t/lib-reopen-logs.sh delete mode 100644 t/lib-simple-http.sh create mode 100644 t/simple-http_Base.ru create mode 100644 t/simple-http_Rev.ru create mode 100644 t/simple-http_Revactor.ru create mode 100644 t/simple-http_ThreadPool.ru create mode 100644 t/simple-http_ThreadSpawn.ru delete mode 100755 t/t0000-basic.sh create mode 100755 t/t0000-simple-http.sh create mode 100755 t/t0002-graceful.sh create mode 100755 t/t0002-parser-error.sh create mode 100755 t/t0003-reopen-logs.sh create mode 100755 t/t0005-large-file-response.sh create mode 100755 t/t0100-rack-input-hammer.sh create mode 100755 t/t0101-rack-input-trailer.sh create mode 100755 t/t0200-async-response.sh create mode 100755 t/t0201-async-response-no-autochunk.sh delete mode 100755 t/t1000-thread-pool-basic.sh delete mode 100755 t/t1002-thread-pool-graceful.sh delete mode 100755 t/t1003-thread-pool-reopen-logs.sh delete mode 120000 t/t1004-thread-pool-async-response.sh delete mode 120000 t/t1005-thread-pool-large-file-response.sh delete mode 120000 t/t1006-thread-pool-async-response-no-autochunk.sh delete mode 100755 t/t1100-thread-pool-rack-input.sh delete mode 100755 t/t1101-thread-pool-input-trailer.sh delete mode 100755 t/t2000-thread-spawn-basic.sh delete mode 100755 t/t2002-thread-spawn-graceful.sh delete mode 100755 t/t2003-thread-spawn-reopen-logs.sh delete mode 120000 t/t2004-thread-spawn-async-response.sh delete mode 120000 t/t2005-thread-spawn-large-file-response.sh delete mode 120000 t/t2006-thread-spawn-async-response-no-autochunk.sh delete mode 100755 t/t2100-thread-spawn-rack-input.sh delete mode 100755 t/t2101-thread-spawn-input-trailer.sh delete mode 100755 t/t3000-revactor-basic.sh delete mode 100755 t/t3002-revactor-graceful.sh delete mode 100755 t/t3003-revactor-reopen-logs.sh delete mode 120000 t/t3004-revactor-async-response.sh delete mode 100755 t/t3005-revactor-large-file-response.sh delete mode 120000 t/t3006-revactor-async-response-no-autochunk.sh delete mode 100755 t/t3100-revactor-rack-input.sh delete mode 100755 t/t3101-revactor-rack-input-trailer.sh delete mode 100755 t/t4000-rev-basic.sh delete mode 100755 t/t4002-rev-graceful.sh delete mode 100755 t/t4003-rev-parser-error.sh delete mode 100755 t/t4003-rev-reopen-logs.sh delete mode 120000 t/t4004-rev-async-response.sh delete mode 100755 t/t4005-rev-large-file-response.sh delete mode 120000 t/t4006-rev-async-response-no-autochunk.sh delete mode 100755 t/t4100-rev-rack-input.sh delete mode 100755 t/t4101-rev-rack-input-trailer.sh mode change 100755 => 100644 t/test-lib.sh diff --git a/t/GNUmakefile b/t/GNUmakefile index 24ce750..0966563 100644 --- a/t/GNUmakefile +++ b/t/GNUmakefile @@ -16,8 +16,25 @@ else endif export RUBYLIB RUBY_VERSION +models := ThreadPool ThreadSpawn Revactor Rev +all_models := $(models) Base + T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh) +MODEL_T := $(foreach m,$(all_models),$(addprefix $(m).,$(T))) +$(T): MODELS = $(models) + +# some tests can be run with all models +t0000-simple-http.sh: MODELS = $(all_models) + +# this test is not compatible with non-Thread models yet +t9000-rack-app-pool.sh: MODELS = ThreadPool ThreadSpawn + +# recursively run per-model tests +# haven't figured out a good way to make make non-recursive here, yet... +$(T): + $(MAKE) $(foreach m,$(MODELS),$(addprefix $(m).,$@)) + all:: $(T) # can't rely on "set -o pipefail" since we don't require bash or ksh93 :< @@ -25,7 +42,6 @@ t_pfx = trash/$@-$(RUBY_VERSION) TEST_OPTS = # TRACER = strace -f -o $(t_pfx).strace -s 100000 # TRACER = /usr/bin/time -o $(t_pfx).time -run_test = $(TRACER) $(SHELL) $(SH_TEST_OPTS) $@ $(TEST_OPTS) ifdef V ifeq ($(V),2) @@ -42,18 +58,19 @@ test-bin-$(RUBY_VERSION)/rainbows: ../bin/rainbows $(RUBY) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $@+ mv $@+ $@ -req_random_blob := $(wildcard t?1??-*.sh) random_blob: dd if=/dev/urandom bs=1M count=10 of=$@+ mv $@+ $@ -$(req_random_blob): random_blob +$(T): random_blob -$(T): trash/.gitignore -$(T): export RUBY := $(RUBY) -$(T): export PATH := $(CURDIR)/test-bin-$(RUBY_VERSION):$(PATH) -$(T): test-bin-$(RUBY_VERSION)/rainbows - @$(run_test) +$(MODEL_T): export model = $(firstword $(subst ., ,$@)) +$(MODEL_T): script = $(subst $(model).,,$@) +$(MODEL_T): trash/.gitignore +$(MODEL_T): export RUBY := $(RUBY) +$(MODEL_T): export PATH := $(CURDIR)/test-bin-$(RUBY_VERSION):$(PATH) +$(MODEL_T): test-bin-$(RUBY_VERSION)/rainbows + $(TRACER) $(SHELL) $(SH_TEST_OPTS) $(script) $(TEST_OPTS) trash/.gitignore: mkdir -p $(@D) diff --git a/t/README b/t/README index a019dbf..4a6430a 100644 --- a/t/README +++ b/t/README @@ -28,9 +28,13 @@ To run the entire test suite with 8 tests running at once: make -j8 -To run one individual test: +To run one individual test for all concurrency models: - make t0000-basic.sh + make t0000-simple-http.sh + +To run one individual test for one concurrency model: + + make Revactor.t0000-simple-http.sh You may also increase verbosity by setting the "V" variable for GNU make. To disable trapping of stdout/stderr: diff --git a/t/lib-async-response-no-autochunk.sh b/t/lib-async-response-no-autochunk.sh deleted file mode 100644 index c94907a..0000000 --- a/t/lib-async-response-no-autochunk.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -CONFIG_RU=async-response-no-autochunk.ru -. ./lib-async-response.sh diff --git a/t/lib-async-response.sh b/t/lib-async-response.sh deleted file mode 100644 index 368792b..0000000 --- a/t/lib-async-response.sh +++ /dev/null @@ -1,65 +0,0 @@ -CONFIG_RU=${CONFIG_RU-'async-response.ru'} -. ./test-lib.sh - -case $CONFIG_RU in -*no-autochunk.ru) - t_plan 7 "async response w/o autochunk for $model" - skip_autochunk=true - ;; -*) - t_plan 6 "async response for $model" - skip_autochunk=false - ;; -esac - -t_begin "setup and start" && { - rainbows_setup - rtmpfiles a b c curl_err - # can't load Rack::Lint here since it'll cause Rev to slurp - rainbows -E none -D $CONFIG_RU -c $unicorn_config - rainbows_wait_start -} - -t_begin "send async requests off in parallel" && { - t0=$(date +%s) - ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $a) & - ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $b) & - ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $c) & - wait - t1=$(date +%s) -} - -t_begin "ensure elapsed requests were processed in parallel" && { - elapsed=$(( $t1 - $t0 )) - echo "elapsed=$elapsed < 30" - test $elapsed -lt 30 -} - -t_begin "termination signal sent" && { - kill $rainbows_pid -} - -dbgcat a -dbgcat b -dbgcat c -dbgcat r_err -dbgcat curl_err - -t_begin "no errors from curl" && { - test ! -s $curl_err -} - -t_begin "no errors in stderr" && check_stderr - -dbgcat r_err - -if $skip_autochunk -then - t_begin "no responses are chunked" && { - test x"$(cat $a)" = x0123456789 - test x"$(cat $b)" = x0123456789 - test x"$(cat $c)" = x0123456789 - } -fi - -t_done diff --git a/t/lib-graceful.sh b/t/lib-graceful.sh deleted file mode 100644 index 45008a5..0000000 --- a/t/lib-graceful.sh +++ /dev/null @@ -1,31 +0,0 @@ -. ./test-lib.sh - -t_plan 4 "graceful exit test for $model" - -t_begin "setup and startup" && { - rtmpfiles curl_out - rainbows_setup $model - rainbows -D sleep.ru -c $unicorn_config - rainbows_wait_start -} - -t_begin "send a request and SIGQUIT while request is processing" && { - curl -sSfv -T- $curl_out 2> $fifo & - awk -v rainbows_pid=$rainbows_pid ' -{ print $0 } -/100 Continue/ { - print "awk: sending SIGQUIT to", rainbows_pid - system("kill -QUIT "rainbows_pid) -}' $fifo - wait -} - -dbgcat r_err - -t_begin 'response returned "Hello"' && { - test x$(cat $curl_out) = xHello -} - -t_begin 'stderr has no errors' && check_stderr - -t_done diff --git a/t/lib-input-trailer.sh b/t/lib-input-trailer.sh deleted file mode 100644 index 9dce292..0000000 --- a/t/lib-input-trailer.sh +++ /dev/null @@ -1,67 +0,0 @@ -. ./test-lib.sh -test -r random_blob || die "random_blob required, run with 'make $0'" - -t_plan 11 "input trailer test $model" - -t_begin "setup and startup" && { - rtmpfiles curl_out - rainbows_setup $model - rainbows -D content-md5.ru -c $unicorn_config - rainbows_wait_start -} - -t_begin "upload small blob" && { - ( - cat $fifo > $tmp & - echo hello world | content-md5-put - wait - echo ok > $ok - ) | socat - TCP:$listen > $fifo - test xok = x"$(cat $ok)" -} - -t_begin "HTTP response is OK" && fgrep 'HTTP/1.1 200 OK' $tmp -t_begin "no errors in stderr log" && check_stderr - -t_begin "big blob request" && { - ( - cat $fifo > $tmp & - content-md5-put < random_blob - wait - echo ok > $ok - ) | socat - TCP:$listen > $fifo - test xok = x"$(cat $ok)" -} - -t_begin "HTTP response is OK" && fgrep 'HTTP/1.1 200 OK' $tmp -t_begin "no errors in stderr log" && check_stderr - -t_begin "staggered blob upload" && { - ( - cat $fifo > $tmp & - ( - dd bs=164 count=1 < random_blob - sleep 2 - dd bs=4545 count=1 < random_blob - sleep 2 - dd bs=1234 count=1 < random_blob - echo subok > $ok - ) 2>/dev/null | content-md5-put - test xsubok = x"$(cat $ok)" - wait - echo ok > $ok - ) | socat - TCP:$listen > $fifo - test xok = x"$(cat $ok)" -} - -t_begin "HTTP response is OK" && { - fgrep 'HTTP/1.1 200 OK' $tmp -} - -t_begin "no errors in stderr log" && check_stderr - -t_begin "kill server" && { - kill $rainbows_pid -} - -t_done diff --git a/t/lib-large-file-response.sh b/t/lib-large-file-response.sh deleted file mode 100644 index 9bbd767..0000000 --- a/t/lib-large-file-response.sh +++ /dev/null @@ -1,82 +0,0 @@ -. ./test-lib.sh -test -r random_blob || die "random_blob required, run with 'make $0'" - -if ! grep -v ^VmRSS: /proc/self/status >/dev/null 2>&1 -then - t_info "skipping, can't read RSS from /proc/self/status" - exit 0 -fi - -t_plan 10 "large file response slurp avoidance for $model" - -t_begin "setup and startup" && { - rtmpfiles curl_out - rainbows_setup $model - # can't load Rack::Lint here since it'll cause Rev to slurp - rainbows -E none -D large-file-response.ru -c $unicorn_config - rainbows_wait_start -} - -t_begin "read random blob size" && { - random_blob_size=$(wc -c < random_blob) -} - -t_begin "read current RSS" && { - curl -v http://$listen/rss - dbgcat r_err - rss_before=$(curl -sSfv http://$listen/rss) - t_info "rss_before=$rss_before" -} - -t_begin "send a series HTTP/1.1 requests sequentially" && { - for i in a b c - do - size=$( (curl -sSfv http://$listen/random_blob && - echo ok >$ok) |wc -c) - test $size -eq $random_blob_size - test xok = x$(cat $ok) - done -} - -# this was a problem during development -t_begin "HTTP/1.0 test" && { - size=$( (curl -0 -sSfv http://$listen/random_blob && - echo ok >$ok) |wc -c) - test $size -eq $random_blob_size - test xok = x$(cat $ok) -} - -t_begin "HTTP/0.9 test" && { - ( - printf 'GET /random_blob\r\n' - cat $fifo > $tmp & - wait - echo ok > $ok - ) | socat - TCP:$listen > $fifo - cmp $tmp random_blob - test xok = x$(cat $ok) -} - -dbgcat r_err - -t_begin "read RSS again" && { - curl -v http://$listen/rss - rss_after=$(curl -sSfv http://$listen/rss) - t_info "rss_after=$rss_after" -} - -t_begin "shutdown server" && { - kill -QUIT $rainbows_pid -} - -t_begin "compare RSS before and after" && { - diff=$(( $rss_after - $rss_before )) - t_info "test diff=$diff < orig=$random_blob_size" - test $diff -le $random_blob_size -} - -dbgcat r_err - -t_begin "check stderr" && check_stderr - -t_done diff --git a/t/lib-parser-error.sh b/t/lib-parser-error.sh deleted file mode 100644 index 2b35b17..0000000 --- a/t/lib-parser-error.sh +++ /dev/null @@ -1,30 +0,0 @@ -. ./test-lib.sh -t_plan 5 "parser error test for $model" - -t_begin "setup and startup" && { - rainbows_setup $model - rainbows -D env.ru -c $unicorn_config - rainbows_wait_start -} - -t_begin "send request" && { - ( - printf 'GET / HTTP/1/1\r\nHost: example.com\r\n\r\n' - cat $fifo > $tmp & - wait - echo ok > $ok - ) | socat - TCP:$listen > $fifo - test xok = x$(cat $ok) -} - -dbgcat tmp - -t_begin "response should be a 400" && { - grep -F 'HTTP/1.1 400 Bad Request' $tmp -} - -t_begin "server stderr should be clean" && check_stderr - -t_begin "term signal sent" && kill $rainbows_pid - -t_done diff --git a/t/lib-rack-input-hammer.sh b/t/lib-rack-input-hammer.sh deleted file mode 100644 index 3e543b3..0000000 --- a/t/lib-rack-input-hammer.sh +++ /dev/null @@ -1,45 +0,0 @@ -nr_client=${nr_client-4} -. ./test-lib.sh -test -r random_blob || die "random_blob required, run with 'make $0'" - -t_plan 7 "concurrent rack.input hammer stress test" - -t_begin "setup and startup" && { - rtmpfiles curl_out curl_err - rainbows_setup $model - rainbows -D sha1.ru -c $unicorn_config - rainbows_wait_start -} - -t_begin "send $nr_client concurrent requests" && { - start=$(date +%s) - for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" > $curl_out 2>> $curl_err - ) & - done - wait - t_info elapsed=$(( $(date +%s) - $start )) -} - -t_begin "kill server" && kill $rainbows_pid - -t_begin "got $nr_client responses" && { - test $nr_client -eq $(wc -l < $curl_out) -} - -t_begin "all responses identical" && { - test 1 -eq $(sort < $curl_out | uniq | wc -l) -} - -t_begin "sha1 matches on-disk sha1" && { - blob_sha1=$( expr "$(sha1sum < random_blob)" : '\([a-f0-9]\+\)') - t_info blob_sha1=$blob_sha1 - test x"$blob_sha1" = x"$(sort < $curl_out | uniq)" -} - -t_begin "no errors in stderr log" && check_stderr - -t_done diff --git a/t/lib-reopen-logs.sh b/t/lib-reopen-logs.sh deleted file mode 100644 index 822de8b..0000000 --- a/t/lib-reopen-logs.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/sh -# don't set nr_client for Rev, only _one_ app running at once :x -nr_client=${nr_client-2} -. ./test-lib.sh - -t_plan 18 "reopen rotated logs" - -t_begin "setup and startup" && { - rtmpfiles curl_out curl_err r_rot - rainbows_setup $model - rainbows -D sleep.ru -c $unicorn_config - rainbows_wait_start -} - -t_begin "ensure server is responsive" && { - curl -sSf http://$listen/ >/dev/null -} - -t_begin "start $nr_client concurrent requests" && { - start=$(date +%s) - for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" > $curl_out 2>> $curl_err ) & - done -} - -t_begin "ensure stderr log is clean" && check_stderr - -t_begin "external log rotation" && { - rm -f $r_rot - mv $r_err $r_rot -} - -t_begin "send reopen log signal (USR1)" && { - kill -USR1 $rainbows_pid -} - -t_begin "wait for rotated log to reappear" && { - nr=60 - while ! test -f $r_err && test $nr -ge 0 - do - sleep 1 - nr=$(( $nr - 1 )) - done -} - -dbgcat r_rot -dbgcat r_err - -t_begin "wait curl requests to finish" && { - wait - t_info elapsed=$(( $(date +%s) - $start )) -} - -t_begin "ensure no errors from curl" && { - test ! -s $curl_err -} - -t_begin "curl got $nr_client responses" && { - test "$(wc -l < $curl_out)" -eq $nr_client -} - -t_begin "all responses were identical" && { - nr=$(sort < $curl_out | uniq | wc -l) - test "$nr" -eq 1 -} - -t_begin 'response was "Hello"' && { - test x$(sort < $curl_out | uniq) = xHello -} - -t_begin "current server stderr is clean" && check_stderr - -t_begin "rotated stderr is clean" && { - check_stderr $r_rot -} - -t_begin "server is now writing logs to new stderr" && { - before_rot=$(wc -c < $r_rot) - before_err=$(wc -c < $r_err) - curl -sSfv http://$listen/ - after_rot=$(wc -c < $r_rot) - after_err=$(wc -c < $r_err) - test $after_rot -eq $before_rot - test $after_err -gt $before_err -} - -t_begin "stop server" && { - kill $rainbows_pid -} - -dbgcat r_err - -t_begin "current server stderr is clean" && check_stderr -t_begin "rotated stderr is clean" && check_stderr $r_rot - -t_done diff --git a/t/lib-simple-http.sh b/t/lib-simple-http.sh deleted file mode 100644 index cb0b28f..0000000 --- a/t/lib-simple-http.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/sh -. ./test-lib.sh -t_plan 24 "simple HTTP connection keepalive/pipelining tests for $model" - -t_begin "checking for config.ru for $model" && { - tbase=$(expr "$T" : '^\(t....\)-').ru - test -f "$tbase" -} - -t_begin "setup and start" && { - rainbows_setup - rainbows -D $tbase -c $unicorn_config - rainbows_wait_start -} - -t_begin "pid file exists" && { - test -f $pid -} - -t_begin "single request" && { - curl -sSfv http://$listen/ -} - -dbgcat r_err - -t_begin "two requests with keepalive" && { - curl -sSfv http://$listen/a http://$listen/b > $tmp 2>&1 -} - -dbgcat r_err -dbgcat tmp - -t_begin "reused existing connection" && { - grep 'Re-using existing connection' < $tmp -} - -t_begin "pipelining partial requests" && { - req='GET / HTTP/1.1\r\nHost: example.com\r\n' - ( - cat $fifo > $tmp & - printf "$req"'\r\n'"$req" - sleep 1 - printf 'Connection: close\r\n\r\n' - wait - echo ok > $ok - ) | socat - TCP:$listen > $fifo -} -dbgcat tmp - -t_begin "two HTTP/1.1 responses" && { - test 2 -eq $(grep '^HTTP/1.1' $tmp | wc -l) -} - -t_begin "two HTTP/1.1 200 OK responses" && { - test 2 -eq $(grep '^HTTP/1.1 200 OK' $tmp | wc -l) -} - -t_begin 'one "Connection: keep-alive" response' && { - test 1 -eq $(grep '^Connection: keep-alive' $tmp | wc -l) -} - -t_begin 'one "Connection: close" response' && { - test 1 -eq $(grep '^Connection: close' $tmp | wc -l) -} - -t_begin 'check subshell success' && { - test x"$(cat $ok)" = xok -} - - -t_begin "check stderr" && { - check_stderr -} - -t_begin "burst pipelining requests" && { - req='GET / HTTP/1.1\r\nHost: example.com\r\n' - ( - cat $fifo > $tmp & - printf "$req"'\r\n'"$req"'Connection: close\r\n\r\n' - wait - echo ok > $ok - ) | socat - TCP:$listen > $fifo -} - -dbgcat tmp -dbgcat r_err - -t_begin "got 2 HTTP/1.1 responses from pipelining" && { - test 2 -eq $(grep '^HTTP/1.1' $tmp | wc -l) -} - -t_begin "got 2 HTTP/1.1 200 OK responses" && { - test 2 -eq $(grep '^HTTP/1.1 200 OK' $tmp | wc -l) -} - -t_begin "one keepalive connection" && { - test 1 -eq $(grep '^Connection: keep-alive' $tmp | wc -l) -} - -t_begin "second request closes connection" && { - test 1 -eq $(grep '^Connection: close' $tmp | wc -l) -} - -t_begin "subshell exited correctly" && { - test x"$(cat $ok)" = xok -} - -t_begin "stderr log has no errors" && { - check_stderr -} - -t_begin "HTTP/0.9 request should not return headers" && { - ( - printf 'GET /\r\n' - cat $fifo > $tmp & - wait - echo ok > $ok - ) | socat - TCP:$listen > $fifo -} - -dbgcat tmp -dbgcat r_err - -t_begin "env.inspect should've put everything on one line" && { - test 1 -eq $(wc -l < $tmp) -} - -t_begin "no headers in output" && { - if grep ^Connection: $tmp - then - die "Connection header found in $tmp" - elif grep ^HTTP/ $tmp - then - die "HTTP/ found in $tmp" - fi -} - -t_begin "killing succeeds" && { - kill $rainbows_pid -} - -t_done diff --git a/t/simple-http_Base.ru b/t/simple-http_Base.ru new file mode 100644 index 0000000..c2355da --- /dev/null +++ b/t/simple-http_Base.ru @@ -0,0 +1,3 @@ +use Rack::ContentLength +use Rack::ContentType +run lambda { |env| [ 200, {}, [ env.inspect << "\n" ] ] } diff --git a/t/simple-http_Rev.ru b/t/simple-http_Rev.ru new file mode 100644 index 0000000..a3e2855 --- /dev/null +++ b/t/simple-http_Rev.ru @@ -0,0 +1,9 @@ +use Rack::ContentLength +use Rack::ContentType +run lambda { |env| + if env['rack.multithread'] == false && env['rainbows.model'] == :Rev + [ 200, {}, [ env.inspect << "\n" ] ] + else + raise "rack.multithread is true" + end +} diff --git a/t/simple-http_Revactor.ru b/t/simple-http_Revactor.ru new file mode 100644 index 0000000..9b9c56a --- /dev/null +++ b/t/simple-http_Revactor.ru @@ -0,0 +1,10 @@ +use Rack::ContentLength +use Rack::ContentType +run lambda { |env| + Actor.sleep 1 + if env['rack.multithread'] == false && env['rainbows.model'] == :Revactor + [ 200, {}, [ Thread.current.inspect << "\n" ] ] + else + raise "rack.multithread is true" + end +} diff --git a/t/simple-http_ThreadPool.ru b/t/simple-http_ThreadPool.ru new file mode 100644 index 0000000..4bb7348 --- /dev/null +++ b/t/simple-http_ThreadPool.ru @@ -0,0 +1,10 @@ +use Rack::ContentLength +use Rack::ContentType +run lambda { |env| + sleep 1 + if env['rack.multithread'] && env['rainbows.model'] == :ThreadPool + [ 200, {}, [ Thread.current.inspect << "\n" ] ] + else + raise "rack.multithread is not true" + end +} diff --git a/t/simple-http_ThreadSpawn.ru b/t/simple-http_ThreadSpawn.ru new file mode 100644 index 0000000..aa1accb --- /dev/null +++ b/t/simple-http_ThreadSpawn.ru @@ -0,0 +1,10 @@ +use Rack::ContentLength +use Rack::ContentType +run lambda { |env| + sleep 1 + if env['rack.multithread'] && env['rainbows.model'] == :ThreadSpawn + [ 200, {}, [ Thread.current.inspect << "\n" ] ] + else + raise "rack.multithread is not true" + end +} diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh deleted file mode 100755 index 7942942..0000000 --- a/t/t0000-basic.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-simple-http.sh diff --git a/t/t0000-simple-http.sh b/t/t0000-simple-http.sh new file mode 100755 index 0000000..173281b --- /dev/null +++ b/t/t0000-simple-http.sh @@ -0,0 +1,142 @@ +#!/bin/sh +. ./test-lib.sh +t_plan 24 "simple HTTP connection keepalive/pipelining tests for $model" + +t_begin "checking for config.ru for $model" && { + tbase=simple-http_$model.ru + test -f "$tbase" +} + +t_begin "setup and start" && { + rainbows_setup + rainbows -D $tbase -c $unicorn_config + rainbows_wait_start +} + +t_begin "pid file exists" && { + test -f $pid +} + +t_begin "single request" && { + curl -sSfv http://$listen/ +} + +dbgcat r_err + +t_begin "two requests with keepalive" && { + curl -sSfv http://$listen/a http://$listen/b > $tmp 2>&1 +} + +dbgcat r_err +dbgcat tmp + +t_begin "reused existing connection" && { + grep 'Re-using existing connection' < $tmp +} + +t_begin "pipelining partial requests" && { + req='GET / HTTP/1.1\r\nHost: example.com\r\n' + ( + cat $fifo > $tmp & + printf "$req"'\r\n'"$req" + sleep 1 + printf 'Connection: close\r\n\r\n' + wait + echo ok > $ok + ) | socat - TCP:$listen > $fifo +} +dbgcat tmp + +t_begin "two HTTP/1.1 responses" && { + test 2 -eq $(grep '^HTTP/1.1' $tmp | wc -l) +} + +t_begin "two HTTP/1.1 200 OK responses" && { + test 2 -eq $(grep '^HTTP/1.1 200 OK' $tmp | wc -l) +} + +t_begin 'one "Connection: keep-alive" response' && { + test 1 -eq $(grep '^Connection: keep-alive' $tmp | wc -l) +} + +t_begin 'one "Connection: close" response' && { + test 1 -eq $(grep '^Connection: close' $tmp | wc -l) +} + +t_begin 'check subshell success' && { + test x"$(cat $ok)" = xok +} + + +t_begin "check stderr" && { + check_stderr +} + +t_begin "burst pipelining requests" && { + req='GET / HTTP/1.1\r\nHost: example.com\r\n' + ( + cat $fifo > $tmp & + printf "$req"'\r\n'"$req"'Connection: close\r\n\r\n' + wait + echo ok > $ok + ) | socat - TCP:$listen > $fifo +} + +dbgcat tmp +dbgcat r_err + +t_begin "got 2 HTTP/1.1 responses from pipelining" && { + test 2 -eq $(grep '^HTTP/1.1' $tmp | wc -l) +} + +t_begin "got 2 HTTP/1.1 200 OK responses" && { + test 2 -eq $(grep '^HTTP/1.1 200 OK' $tmp | wc -l) +} + +t_begin "one keepalive connection" && { + test 1 -eq $(grep '^Connection: keep-alive' $tmp | wc -l) +} + +t_begin "second request closes connection" && { + test 1 -eq $(grep '^Connection: close' $tmp | wc -l) +} + +t_begin "subshell exited correctly" && { + test x"$(cat $ok)" = xok +} + +t_begin "stderr log has no errors" && { + check_stderr +} + +t_begin "HTTP/0.9 request should not return headers" && { + ( + printf 'GET /\r\n' + cat $fifo > $tmp & + wait + echo ok > $ok + ) | socat - TCP:$listen > $fifo +} + +dbgcat tmp +dbgcat r_err + +t_begin "env.inspect should've put everything on one line" && { + test 1 -eq $(wc -l < $tmp) +} + +t_begin "no headers in output" && { + if grep ^Connection: $tmp + then + die "Connection header found in $tmp" + elif grep ^HTTP/ $tmp + then + die "HTTP/ found in $tmp" + fi +} + +t_begin "killing succeeds" && { + kill $rainbows_pid +} + +t_done diff --git a/t/t0002-graceful.sh b/t/t0002-graceful.sh new file mode 100755 index 0000000..c3ff27e --- /dev/null +++ b/t/t0002-graceful.sh @@ -0,0 +1,32 @@ +#!/bin/sh +. ./test-lib.sh + +t_plan 4 "graceful exit test for $model" + +t_begin "setup and startup" && { + rtmpfiles curl_out + rainbows_setup $model + rainbows -D sleep.ru -c $unicorn_config + rainbows_wait_start +} + +t_begin "send a request and SIGQUIT while request is processing" && { + curl -sSfv -T- $curl_out 2> $fifo & + awk -v rainbows_pid=$rainbows_pid ' +{ print $0 } +/100 Continue/ { + print "awk: sending SIGQUIT to", rainbows_pid + system("kill -QUIT "rainbows_pid) +}' $fifo + wait +} + +dbgcat r_err + +t_begin 'response returned "Hello"' && { + test x$(cat $curl_out) = xHello +} + +t_begin 'stderr has no errors' && check_stderr + +t_done diff --git a/t/t0002-parser-error.sh b/t/t0002-parser-error.sh new file mode 100755 index 0000000..c4e5ab7 --- /dev/null +++ b/t/t0002-parser-error.sh @@ -0,0 +1,31 @@ +#!/bin/sh +. ./test-lib.sh +t_plan 5 "parser error test for $model" + +t_begin "setup and startup" && { + rainbows_setup $model + rainbows -D env.ru -c $unicorn_config + rainbows_wait_start +} + +t_begin "send request" && { + ( + printf 'GET / HTTP/1/1\r\nHost: example.com\r\n\r\n' + cat $fifo > $tmp & + wait + echo ok > $ok + ) | socat - TCP:$listen > $fifo + test xok = x$(cat $ok) +} + +dbgcat tmp + +t_begin "response should be a 400" && { + grep -F 'HTTP/1.1 400 Bad Request' $tmp +} + +t_begin "server stderr should be clean" && check_stderr + +t_begin "term signal sent" && kill $rainbows_pid + +t_done diff --git a/t/t0003-reopen-logs.sh b/t/t0003-reopen-logs.sh new file mode 100755 index 0000000..822de8b --- /dev/null +++ b/t/t0003-reopen-logs.sh @@ -0,0 +1,97 @@ +#!/bin/sh +# don't set nr_client for Rev, only _one_ app running at once :x +nr_client=${nr_client-2} +. ./test-lib.sh + +t_plan 18 "reopen rotated logs" + +t_begin "setup and startup" && { + rtmpfiles curl_out curl_err r_rot + rainbows_setup $model + rainbows -D sleep.ru -c $unicorn_config + rainbows_wait_start +} + +t_begin "ensure server is responsive" && { + curl -sSf http://$listen/ >/dev/null +} + +t_begin "start $nr_client concurrent requests" && { + start=$(date +%s) + for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" > $curl_out 2>> $curl_err ) & + done +} + +t_begin "ensure stderr log is clean" && check_stderr + +t_begin "external log rotation" && { + rm -f $r_rot + mv $r_err $r_rot +} + +t_begin "send reopen log signal (USR1)" && { + kill -USR1 $rainbows_pid +} + +t_begin "wait for rotated log to reappear" && { + nr=60 + while ! test -f $r_err && test $nr -ge 0 + do + sleep 1 + nr=$(( $nr - 1 )) + done +} + +dbgcat r_rot +dbgcat r_err + +t_begin "wait curl requests to finish" && { + wait + t_info elapsed=$(( $(date +%s) - $start )) +} + +t_begin "ensure no errors from curl" && { + test ! -s $curl_err +} + +t_begin "curl got $nr_client responses" && { + test "$(wc -l < $curl_out)" -eq $nr_client +} + +t_begin "all responses were identical" && { + nr=$(sort < $curl_out | uniq | wc -l) + test "$nr" -eq 1 +} + +t_begin 'response was "Hello"' && { + test x$(sort < $curl_out | uniq) = xHello +} + +t_begin "current server stderr is clean" && check_stderr + +t_begin "rotated stderr is clean" && { + check_stderr $r_rot +} + +t_begin "server is now writing logs to new stderr" && { + before_rot=$(wc -c < $r_rot) + before_err=$(wc -c < $r_err) + curl -sSfv http://$listen/ + after_rot=$(wc -c < $r_rot) + after_err=$(wc -c < $r_err) + test $after_rot -eq $before_rot + test $after_err -gt $before_err +} + +t_begin "stop server" && { + kill $rainbows_pid +} + +dbgcat r_err + +t_begin "current server stderr is clean" && check_stderr +t_begin "rotated stderr is clean" && check_stderr $r_rot + +t_done diff --git a/t/t0005-large-file-response.sh b/t/t0005-large-file-response.sh new file mode 100755 index 0000000..7aafd5b --- /dev/null +++ b/t/t0005-large-file-response.sh @@ -0,0 +1,83 @@ +#!/bin/sh +. ./test-lib.sh +test -r random_blob || die "random_blob required, run with 'make $0'" + +if ! grep -v ^VmRSS: /proc/self/status >/dev/null 2>&1 +then + t_info "skipping, can't read RSS from /proc/self/status" + exit 0 +fi + +t_plan 10 "large file response slurp avoidance for $model" + +t_begin "setup and startup" && { + rtmpfiles curl_out + rainbows_setup $model + # can't load Rack::Lint here since it'll cause Rev to slurp + rainbows -E none -D large-file-response.ru -c $unicorn_config + rainbows_wait_start +} + +t_begin "read random blob size" && { + random_blob_size=$(wc -c < random_blob) +} + +t_begin "read current RSS" && { + curl -v http://$listen/rss + dbgcat r_err + rss_before=$(curl -sSfv http://$listen/rss) + t_info "rss_before=$rss_before" +} + +t_begin "send a series HTTP/1.1 requests sequentially" && { + for i in a b c + do + size=$( (curl -sSfv http://$listen/random_blob && + echo ok >$ok) |wc -c) + test $size -eq $random_blob_size + test xok = x$(cat $ok) + done +} + +# this was a problem during development +t_begin "HTTP/1.0 test" && { + size=$( (curl -0 -sSfv http://$listen/random_blob && + echo ok >$ok) |wc -c) + test $size -eq $random_blob_size + test xok = x$(cat $ok) +} + +t_begin "HTTP/0.9 test" && { + ( + printf 'GET /random_blob\r\n' + cat $fifo > $tmp & + wait + echo ok > $ok + ) | socat - TCP:$listen > $fifo + cmp $tmp random_blob + test xok = x$(cat $ok) +} + +dbgcat r_err + +t_begin "read RSS again" && { + curl -v http://$listen/rss + rss_after=$(curl -sSfv http://$listen/rss) + t_info "rss_after=$rss_after" +} + +t_begin "shutdown server" && { + kill -QUIT $rainbows_pid +} + +t_begin "compare RSS before and after" && { + diff=$(( $rss_after - $rss_before )) + t_info "test diff=$diff < orig=$random_blob_size" + test $diff -le $random_blob_size +} + +dbgcat r_err + +t_begin "check stderr" && check_stderr + +t_done diff --git a/t/t0100-rack-input-hammer.sh b/t/t0100-rack-input-hammer.sh new file mode 100755 index 0000000..3e543b3 --- /dev/null +++ b/t/t0100-rack-input-hammer.sh @@ -0,0 +1,45 @@ +nr_client=${nr_client-4} +. ./test-lib.sh +test -r random_blob || die "random_blob required, run with 'make $0'" + +t_plan 7 "concurrent rack.input hammer stress test" + +t_begin "setup and startup" && { + rtmpfiles curl_out curl_err + rainbows_setup $model + rainbows -D sha1.ru -c $unicorn_config + rainbows_wait_start +} + +t_begin "send $nr_client concurrent requests" && { + start=$(date +%s) + for i in $(awk "BEGIN{for(i=0;i<$nr_client;++i) print i}" > $curl_out 2>> $curl_err + ) & + done + wait + t_info elapsed=$(( $(date +%s) - $start )) +} + +t_begin "kill server" && kill $rainbows_pid + +t_begin "got $nr_client responses" && { + test $nr_client -eq $(wc -l < $curl_out) +} + +t_begin "all responses identical" && { + test 1 -eq $(sort < $curl_out | uniq | wc -l) +} + +t_begin "sha1 matches on-disk sha1" && { + blob_sha1=$( expr "$(sha1sum < random_blob)" : '\([a-f0-9]\+\)') + t_info blob_sha1=$blob_sha1 + test x"$blob_sha1" = x"$(sort < $curl_out | uniq)" +} + +t_begin "no errors in stderr log" && check_stderr + +t_done diff --git a/t/t0101-rack-input-trailer.sh b/t/t0101-rack-input-trailer.sh new file mode 100755 index 0000000..75528d6 --- /dev/null +++ b/t/t0101-rack-input-trailer.sh @@ -0,0 +1,68 @@ +#!/bin/sh +. ./test-lib.sh +test -r random_blob || die "random_blob required, run with 'make $0'" + +t_plan 11 "input trailer test $model" + +t_begin "setup and startup" && { + rtmpfiles curl_out + rainbows_setup $model + rainbows -D content-md5.ru -c $unicorn_config + rainbows_wait_start +} + +t_begin "upload small blob" && { + ( + cat $fifo > $tmp & + echo hello world | content-md5-put + wait + echo ok > $ok + ) | socat - TCP:$listen > $fifo + test xok = x"$(cat $ok)" +} + +t_begin "HTTP response is OK" && fgrep 'HTTP/1.1 200 OK' $tmp +t_begin "no errors in stderr log" && check_stderr + +t_begin "big blob request" && { + ( + cat $fifo > $tmp & + content-md5-put < random_blob + wait + echo ok > $ok + ) | socat - TCP:$listen > $fifo + test xok = x"$(cat $ok)" +} + +t_begin "HTTP response is OK" && fgrep 'HTTP/1.1 200 OK' $tmp +t_begin "no errors in stderr log" && check_stderr + +t_begin "staggered blob upload" && { + ( + cat $fifo > $tmp & + ( + dd bs=164 count=1 < random_blob + sleep 2 + dd bs=4545 count=1 < random_blob + sleep 2 + dd bs=1234 count=1 < random_blob + echo subok > $ok + ) 2>/dev/null | content-md5-put + test xsubok = x"$(cat $ok)" + wait + echo ok > $ok + ) | socat - TCP:$listen > $fifo + test xok = x"$(cat $ok)" +} + +t_begin "HTTP response is OK" && { + fgrep 'HTTP/1.1 200 OK' $tmp +} + +t_begin "no errors in stderr log" && check_stderr + +t_begin "kill server" && { + kill $rainbows_pid +} + +t_done diff --git a/t/t0200-async-response.sh b/t/t0200-async-response.sh new file mode 100755 index 0000000..f3ead0b --- /dev/null +++ b/t/t0200-async-response.sh @@ -0,0 +1,66 @@ +#!/bin/sh +CONFIG_RU=${CONFIG_RU-'async-response.ru'} +. ./test-lib.sh + +case $CONFIG_RU in +*no-autochunk.ru) + t_plan 7 "async response w/o autochunk for $model" + skip_autochunk=true + ;; +*) + t_plan 6 "async response for $model" + skip_autochunk=false + ;; +esac + +t_begin "setup and start" && { + rainbows_setup + rtmpfiles a b c curl_err + # can't load Rack::Lint here since it'll cause Rev to slurp + rainbows -E none -D $CONFIG_RU -c $unicorn_config + rainbows_wait_start +} + +t_begin "send async requests off in parallel" && { + t0=$(date +%s) + ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $a) & + ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $b) & + ( curl --no-buffer -sSf http://$listen/ 2>> $curl_err | utee $c) & + wait + t1=$(date +%s) +} + +t_begin "ensure elapsed requests were processed in parallel" && { + elapsed=$(( $t1 - $t0 )) + echo "elapsed=$elapsed < 30" + test $elapsed -lt 30 +} + +t_begin "termination signal sent" && { + kill $rainbows_pid +} + +dbgcat a +dbgcat b +dbgcat c +dbgcat r_err +dbgcat curl_err + +t_begin "no errors from curl" && { + test ! -s $curl_err +} + +t_begin "no errors in stderr" && check_stderr + +dbgcat r_err + +if $skip_autochunk +then + t_begin "no responses are chunked" && { + test x"$(cat $a)" = x0123456789 + test x"$(cat $b)" = x0123456789 + test x"$(cat $c)" = x0123456789 + } +fi + +t_done diff --git a/t/t0201-async-response-no-autochunk.sh b/t/t0201-async-response-no-autochunk.sh new file mode 100755 index 0000000..bb46385 --- /dev/null +++ b/t/t0201-async-response-no-autochunk.sh @@ -0,0 +1,3 @@ +#!/bin/sh +CONFIG_RU=async-response-no-autochunk.ru +. ./t0200-async-response.sh diff --git a/t/t1000-thread-pool-basic.sh b/t/t1000-thread-pool-basic.sh deleted file mode 100755 index 7942942..0000000 --- a/t/t1000-thread-pool-basic.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-simple-http.sh diff --git a/t/t1002-thread-pool-graceful.sh b/t/t1002-thread-pool-graceful.sh deleted file mode 100755 index e3c266b..0000000 --- a/t/t1002-thread-pool-graceful.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-graceful.sh diff --git a/t/t1003-thread-pool-reopen-logs.sh b/t/t1003-thread-pool-reopen-logs.sh deleted file mode 100755 index 6bba7ef..0000000 --- a/t/t1003-thread-pool-reopen-logs.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-reopen-logs.sh diff --git a/t/t1004-thread-pool-async-response.sh b/t/t1004-thread-pool-async-response.sh deleted file mode 120000 index 15c27db..0000000 --- a/t/t1004-thread-pool-async-response.sh +++ /dev/null @@ -1 +0,0 @@ -lib-async-response.sh \ No newline at end of file diff --git a/t/t1005-thread-pool-large-file-response.sh b/t/t1005-thread-pool-large-file-response.sh deleted file mode 120000 index 37d2877..0000000 --- a/t/t1005-thread-pool-large-file-response.sh +++ /dev/null @@ -1 +0,0 @@ -lib-large-file-response.sh \ No newline at end of file diff --git a/t/t1006-thread-pool-async-response-no-autochunk.sh b/t/t1006-thread-pool-async-response-no-autochunk.sh deleted file mode 120000 index bb87ca9..0000000 --- a/t/t1006-thread-pool-async-response-no-autochunk.sh +++ /dev/null @@ -1 +0,0 @@ -lib-async-response-no-autochunk.sh \ No newline at end of file diff --git a/t/t1100-thread-pool-rack-input.sh b/t/t1100-thread-pool-rack-input.sh deleted file mode 100755 index 4d6d4c9..0000000 --- a/t/t1100-thread-pool-rack-input.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-rack-input-hammer.sh diff --git a/t/t1101-thread-pool-input-trailer.sh b/t/t1101-thread-pool-input-trailer.sh deleted file mode 100755 index e297cc9..0000000 --- a/t/t1101-thread-pool-input-trailer.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-input-trailer.sh diff --git a/t/t2000-thread-spawn-basic.sh b/t/t2000-thread-spawn-basic.sh deleted file mode 100755 index 7942942..0000000 --- a/t/t2000-thread-spawn-basic.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-simple-http.sh diff --git a/t/t2002-thread-spawn-graceful.sh b/t/t2002-thread-spawn-graceful.sh deleted file mode 100755 index e3c266b..0000000 --- a/t/t2002-thread-spawn-graceful.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-graceful.sh diff --git a/t/t2003-thread-spawn-reopen-logs.sh b/t/t2003-thread-spawn-reopen-logs.sh deleted file mode 100755 index 6bba7ef..0000000 --- a/t/t2003-thread-spawn-reopen-logs.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-reopen-logs.sh diff --git a/t/t2004-thread-spawn-async-response.sh b/t/t2004-thread-spawn-async-response.sh deleted file mode 120000 index 15c27db..0000000 --- a/t/t2004-thread-spawn-async-response.sh +++ /dev/null @@ -1 +0,0 @@ -lib-async-response.sh \ No newline at end of file diff --git a/t/t2005-thread-spawn-large-file-response.sh b/t/t2005-thread-spawn-large-file-response.sh deleted file mode 120000 index 37d2877..0000000 --- a/t/t2005-thread-spawn-large-file-response.sh +++ /dev/null @@ -1 +0,0 @@ -lib-large-file-response.sh \ No newline at end of file diff --git a/t/t2006-thread-spawn-async-response-no-autochunk.sh b/t/t2006-thread-spawn-async-response-no-autochunk.sh deleted file mode 120000 index bb87ca9..0000000 --- a/t/t2006-thread-spawn-async-response-no-autochunk.sh +++ /dev/null @@ -1 +0,0 @@ -lib-async-response-no-autochunk.sh \ No newline at end of file diff --git a/t/t2100-thread-spawn-rack-input.sh b/t/t2100-thread-spawn-rack-input.sh deleted file mode 100755 index 4d6d4c9..0000000 --- a/t/t2100-thread-spawn-rack-input.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-rack-input-hammer.sh diff --git a/t/t2101-thread-spawn-input-trailer.sh b/t/t2101-thread-spawn-input-trailer.sh deleted file mode 100755 index e297cc9..0000000 --- a/t/t2101-thread-spawn-input-trailer.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-input-trailer.sh diff --git a/t/t3000-revactor-basic.sh b/t/t3000-revactor-basic.sh deleted file mode 100755 index 7942942..0000000 --- a/t/t3000-revactor-basic.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-simple-http.sh diff --git a/t/t3002-revactor-graceful.sh b/t/t3002-revactor-graceful.sh deleted file mode 100755 index e3c266b..0000000 --- a/t/t3002-revactor-graceful.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-graceful.sh diff --git a/t/t3003-revactor-reopen-logs.sh b/t/t3003-revactor-reopen-logs.sh deleted file mode 100755 index 6bba7ef..0000000 --- a/t/t3003-revactor-reopen-logs.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-reopen-logs.sh diff --git a/t/t3004-revactor-async-response.sh b/t/t3004-revactor-async-response.sh deleted file mode 120000 index 15c27db..0000000 --- a/t/t3004-revactor-async-response.sh +++ /dev/null @@ -1 +0,0 @@ -lib-async-response.sh \ No newline at end of file diff --git a/t/t3005-revactor-large-file-response.sh b/t/t3005-revactor-large-file-response.sh deleted file mode 100755 index ef1a4a3..0000000 --- a/t/t3005-revactor-large-file-response.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-large-file-response.sh diff --git a/t/t3006-revactor-async-response-no-autochunk.sh b/t/t3006-revactor-async-response-no-autochunk.sh deleted file mode 120000 index bb87ca9..0000000 --- a/t/t3006-revactor-async-response-no-autochunk.sh +++ /dev/null @@ -1 +0,0 @@ -lib-async-response-no-autochunk.sh \ No newline at end of file diff --git a/t/t3100-revactor-rack-input.sh b/t/t3100-revactor-rack-input.sh deleted file mode 100755 index 4d6d4c9..0000000 --- a/t/t3100-revactor-rack-input.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-rack-input-hammer.sh diff --git a/t/t3101-revactor-rack-input-trailer.sh b/t/t3101-revactor-rack-input-trailer.sh deleted file mode 100755 index e297cc9..0000000 --- a/t/t3101-revactor-rack-input-trailer.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-input-trailer.sh diff --git a/t/t4000-rev-basic.sh b/t/t4000-rev-basic.sh deleted file mode 100755 index 7942942..0000000 --- a/t/t4000-rev-basic.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-simple-http.sh diff --git a/t/t4002-rev-graceful.sh b/t/t4002-rev-graceful.sh deleted file mode 100755 index e3c266b..0000000 --- a/t/t4002-rev-graceful.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-graceful.sh diff --git a/t/t4003-rev-parser-error.sh b/t/t4003-rev-parser-error.sh deleted file mode 100755 index 04df895..0000000 --- a/t/t4003-rev-parser-error.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-parser-error.sh diff --git a/t/t4003-rev-reopen-logs.sh b/t/t4003-rev-reopen-logs.sh deleted file mode 100755 index 6bba7ef..0000000 --- a/t/t4003-rev-reopen-logs.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-reopen-logs.sh diff --git a/t/t4004-rev-async-response.sh b/t/t4004-rev-async-response.sh deleted file mode 120000 index 15c27db..0000000 --- a/t/t4004-rev-async-response.sh +++ /dev/null @@ -1 +0,0 @@ -lib-async-response.sh \ No newline at end of file diff --git a/t/t4005-rev-large-file-response.sh b/t/t4005-rev-large-file-response.sh deleted file mode 100755 index ef1a4a3..0000000 --- a/t/t4005-rev-large-file-response.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-large-file-response.sh diff --git a/t/t4006-rev-async-response-no-autochunk.sh b/t/t4006-rev-async-response-no-autochunk.sh deleted file mode 120000 index bb87ca9..0000000 --- a/t/t4006-rev-async-response-no-autochunk.sh +++ /dev/null @@ -1 +0,0 @@ -lib-async-response-no-autochunk.sh \ No newline at end of file diff --git a/t/t4100-rev-rack-input.sh b/t/t4100-rev-rack-input.sh deleted file mode 100755 index 4d6d4c9..0000000 --- a/t/t4100-rev-rack-input.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-rack-input-hammer.sh diff --git a/t/t4101-rev-rack-input-trailer.sh b/t/t4101-rev-rack-input-trailer.sh deleted file mode 100755 index e297cc9..0000000 --- a/t/t4101-rev-rack-input-trailer.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -. ./lib-input-trailer.sh diff --git a/t/t9000-rack-app-pool.sh b/t/t9000-rack-app-pool.sh index b04564b..994c244 100755 --- a/t/t9000-rack-app-pool.sh +++ b/t/t9000-rack-app-pool.sh @@ -2,11 +2,11 @@ . ./test-lib.sh nr_client=30 APP_POOL_SIZE=4 -t_plan 6 "AppPool Rack middleware test" +t_plan 6 "AppPool Rack middleware test for $model" t_begin "configure and start" && { rtmpfiles curl_out curl_err - rainbows_setup ThreadSpawn 50 + rainbows_setup $model 50 APP_POOL_SIZE=$APP_POOL_SIZE rainbows -D t9000.ru -c $unicorn_config rainbows_wait_start } diff --git a/t/test-lib.sh b/t/test-lib.sh old mode 100755 new mode 100644 index 5e279a1..39225c6 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -5,19 +5,15 @@ set +u if test -z "$model" then - case $T in - t1???-thread-pool-*.sh) model=ThreadPool ;; - t2???-thread-spawn-*.sh) model=ThreadSpawn ;; - t3???-revactor-*.sh) model=Revactor ;; - t4???-rev-*.sh) model=Rev ;; - *) model=Base ;; - esac + # defaulting to Base would unfortunately fail some concurrency tests + model=ThreadSpawn + t_info "model undefined, defaulting to $model" fi set -e RUBY="${RUBY-ruby}" RUBY_VERSION=${RUBY_VERSION-$($RUBY -e 'puts RUBY_VERSION')} -t_pfx=$PWD/trash/$T-$RUBY_VERSION +t_pfx=$PWD/trash/$model.$T-$RUBY_VERSION set -u PATH=$PWD/bin:$PATH -- cgit v1.2.3-24-ge0c7