about summary refs log tree commit homepage
path: root/t/lib-parser-error.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/lib-parser-error.sh')
-rw-r--r--t/lib-parser-error.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/t/lib-parser-error.sh b/t/lib-parser-error.sh
new file mode 100644
index 0000000..b8433e5
--- /dev/null
+++ b/t/lib-parser-error.sh
@@ -0,0 +1,32 @@
+. ./test-lib.sh
+echo "parser error test for model=$model"
+require_for_model
+
+eval $(unused_listen)
+rtmpfiles unicorn_config pid r_err r_out tmp fifo ok
+rm -f $fifo
+mkfifo $fifo
+
+cat > $unicorn_config <<EOF
+listen "$listen"
+pid "$pid"
+stderr_path "$r_err"
+stdout_path "$r_out"
+Rainbows! { use :$model }
+EOF
+
+rainbows -D env.ru -c $unicorn_config
+wait_for_pid $pid
+
+(
+        printf 'GET / HTTP/1/1\r\nHost: example.com\r\n\r\n'
+        cat $fifo > $tmp &
+        wait
+        echo ok > $ok
+) | socat - TCP:$listen > $fifo
+
+kill $(cat $pid)
+
+dbgcat tmp
+grep -F 'HTTP/1.1 400 Bad Request' $tmp
+! grep Error $r_err