From e82fbfc8b67ac61d712dc9e764d8c7767ab2664b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 27 Jul 2010 07:01:32 +0000 Subject: t00{2,3}1: beef tests up with more aborted requests HTTP/1.1 and HTTP/1.0 code paths may vary significantly from the (highly uncommon) HTTP/0.9 ones in our concurrency models, so add extra tests for those. --- t/t0021-sendfile-wrap-to_path.sh | 47 ++++++++++++++++++++++++++++++++++++---- t/t0031-close-pipe-response.sh | 47 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 86 insertions(+), 8 deletions(-) diff --git a/t/t0021-sendfile-wrap-to_path.sh b/t/t0021-sendfile-wrap-to_path.sh index 6baa890..7f3acaa 100755 --- a/t/t0021-sendfile-wrap-to_path.sh +++ b/t/t0021-sendfile-wrap-to_path.sh @@ -9,7 +9,7 @@ ruby) ;; ;; esac -t_plan 10 "sendfile wrap body response for $model" +t_plan 16 "sendfile wrap body response for $model" t_begin "setup and startup" && { rtmpfiles out err http_fifo sub_ok @@ -42,11 +42,50 @@ t_begin "body.close called" && { grep CLOSING $out || die "body.close not logged" } -t_begin "start FIFO reader for abortive request" && { +t_begin "start FIFO reader for abortive HTTP/1.1 request" && { cat $fifo > $out & } -t_begin "send abortive request" && { +t_begin "send abortive HTTP/1.1 request" && { + rm -f $ok + ( + printf 'GET /random_blob HTTP/1.1\r\nHost: example.com\r\n\r\n' + dd bs=4096 count=1 < $http_fifo >/dev/null + echo ok > $ok + ) | socat - TCP:$listen > $http_fifo || : + test xok = x$(cat $ok) +} + +t_begin "body.close called for aborted HTTP/1.1 request" && { + wait # for cat $fifo + grep CLOSING $out || die "body.close not logged" +} + +t_begin "start FIFO reader for abortive HTTP/1.0 request" && { + cat $fifo > $out & +} + +t_begin "send abortive HTTP/1.0 request" && { + rm -f $ok + ( + printf 'GET /random_blob HTTP/1.0\r\n\r\n' + dd bs=4096 count=1 < $http_fifo >/dev/null + echo ok > $ok + ) | socat - TCP:$listen > $http_fifo || : + test xok = x$(cat $ok) +} + +t_begin "body.close called for aborted HTTP/1.0 request" && { + wait # for cat $fifo + grep CLOSING $out || die "body.close not logged" +} + +t_begin "start FIFO reader for abortive HTTP/0.9 request" && { + cat $fifo > $out & +} + +t_begin "send abortive HTTP/0.9 request" && { + rm -f $ok ( printf 'GET /random_blob\r\n' dd bs=4096 count=1 < $http_fifo >/dev/null @@ -55,7 +94,7 @@ t_begin "send abortive request" && { test xok = x$(cat $ok) } -t_begin "body.close called for aborted request" && { +t_begin "body.close called for aborted HTTP/0.9 request" && { wait # for cat $fifo grep CLOSING $out || die "body.close not logged" } diff --git a/t/t0031-close-pipe-response.sh b/t/t0031-close-pipe-response.sh index 58b6346..c863d4a 100755 --- a/t/t0031-close-pipe-response.sh +++ b/t/t0031-close-pipe-response.sh @@ -1,7 +1,7 @@ #!/bin/sh . ./test-lib.sh -t_plan 10 "close pipe response for $model" +t_plan 16 "close pipe response for $model" t_begin "setup and startup" && { rtmpfiles err out http_fifo sub_ok @@ -30,11 +30,50 @@ t_begin "body.close called" && { grep CLOSING $out || die "body.close not logged" } -t_begin "start FIFO reader for abortive request" && { +t_begin "start FIFO reader for abortive HTTP/1.1 request" && { cat $fifo > $out & } -t_begin "send abortive request" && { +t_begin "send abortive HTTP/1.1 request" && { + rm -f $ok + ( + printf 'GET /random_blob HTTP/1.1\r\nHost: example.com\r\n\r\n' + dd bs=4096 count=1 < $http_fifo >/dev/null + echo ok > $ok + ) | socat - TCP:$listen > $http_fifo || : + test xok = x$(cat $ok) +} + +t_begin "body.close called for aborted HTTP/1.1 request" && { + wait # for cat $fifo + grep CLOSING $out || die "body.close not logged" +} + +t_begin "start FIFO reader for abortive HTTP/1.0 request" && { + cat $fifo > $out & +} + +t_begin "send abortive HTTP/1.0 request" && { + rm -f $ok + ( + printf 'GET /random_blob HTTP/1.0\r\n\r\n' + dd bs=4096 count=1 < $http_fifo >/dev/null + echo ok > $ok + ) | socat - TCP:$listen > $http_fifo || : + test xok = x$(cat $ok) +} + +t_begin "body.close called for aborted HTTP/1.0 request" && { + wait # for cat $fifo + grep CLOSING $out || die "body.close not logged" +} + +t_begin "start FIFO reader for abortive HTTP/0.9 request" && { + cat $fifo > $out & +} + +t_begin "send abortive HTTP/0.9 request" && { + rm -f $ok ( printf 'GET /random_blob\r\n' dd bs=4096 count=1 < $http_fifo >/dev/null @@ -43,7 +82,7 @@ t_begin "send abortive request" && { test xok = x$(cat $ok) } -t_begin "body.close called for aborted request" && { +t_begin "body.close called for aborted HTTP/0.9 request" && { wait # for cat $fifo grep CLOSING $out || die "body.close not logged" } -- cgit v1.2.3-24-ge0c7