From c50132e156da457186929e5c36d9e16f636f48df Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 17 Oct 2009 22:42:56 -0700 Subject: tests: factor out a common parser error "library" --- t/env.ru | 3 +++ t/lib-parser-error.sh | 32 ++++++++++++++++++++++++++++++++ t/t4003-rev-parser-error.sh | 35 ++--------------------------------- 3 files changed, 37 insertions(+), 33 deletions(-) create mode 100644 t/env.ru create mode 100644 t/lib-parser-error.sh diff --git a/t/env.ru b/t/env.ru new file mode 100644 index 0000000..c2355da --- /dev/null +++ b/t/env.ru @@ -0,0 +1,3 @@ +use Rack::ContentLength +use Rack::ContentType +run lambda { |env| [ 200, {}, [ env.inspect << "\n" ] ] } 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 < $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 diff --git a/t/t4003-rev-parser-error.sh b/t/t4003-rev-parser-error.sh index dff3e33..bcb129a 100755 --- a/t/t4003-rev-parser-error.sh +++ b/t/t4003-rev-parser-error.sh @@ -1,34 +1,3 @@ #!/bin/sh -. ./test-lib.sh -require_rev - -eval $(unused_listen) -rtmpfiles unicorn_config pid r_err r_out tmp fifo ok -rm -f $fifo -mkfifo $fifo - -cat > $unicorn_config < $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 +model=Rev +. ./lib-parser-error.sh -- cgit v1.2.3-24-ge0c7