about summary refs log tree commit homepage
path: root/t/t0002-graceful.sh
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-10-24 20:41:15 -0700
committerEric Wong <normalperson@yhbt.net>2009-10-24 20:42:57 -0700
commit15fe80b3bff7b0d249ee32bcbbe1dfa116d3c629 (patch)
tree8edf5313e3ef41395b406706dd807b97e6321eb9 /t/t0002-graceful.sh
parente77369a6bde35a4e8925d450aac85f328f87d208 (diff)
downloadrainbows-15fe80b3bff7b0d249ee32bcbbe1dfa116d3c629.tar.gz
This will make it easier to enable and manage tests for new
concurrency models.
Diffstat (limited to 't/t0002-graceful.sh')
-rwxr-xr-xt/t0002-graceful.sh32
1 files changed, 32 insertions, 0 deletions
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- </dev/null http://$listen/5 > $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