From 1c0dab453688e8bfc9f21656e9b89b88fb3cc1d3 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 17 Oct 2009 22:42:56 -0700 Subject: tests: for log reopening for all concurrency models --- t/lib-reopen-logs.sh | 60 +++++++++++++++++++++++++++++++++++++ t/t1003-thread-pool-reopen-logs.sh | 2 ++ t/t2003-thread-spawn-reopen-logs.sh | 2 ++ t/t3003-revactor-reopen-logs.sh | 53 +------------------------------- t/t4003-rev-reopen-logs.sh | 2 ++ t/test-lib.sh | 0 6 files changed, 67 insertions(+), 52 deletions(-) create mode 100644 t/lib-reopen-logs.sh create mode 100755 t/t1003-thread-pool-reopen-logs.sh create mode 100755 t/t2003-thread-spawn-reopen-logs.sh create mode 100755 t/t4003-rev-reopen-logs.sh mode change 100644 => 100755 t/test-lib.sh diff --git a/t/lib-reopen-logs.sh b/t/lib-reopen-logs.sh new file mode 100644 index 0000000..ace223a --- /dev/null +++ b/t/lib-reopen-logs.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# don't set nr_client for Rev, only _one_ app running at once :x +nr_client=${nr_client-2} +. ./test-lib.sh + +eval $(unused_listen) +rtmpfiles unicorn_config curl_out curl_err pid r_err r_out r_rot + + +cat > $unicorn_config <> $curl_out 2>> $curl_err ) & +done +! grep Error $r_err + +rm $r_rot +mv $r_err $r_rot + +kill -USR1 $(cat $pid) +wait_for_pid $r_err + +dbgcat r_rot +dbgcat r_err + +wait +echo elapsed=$(( $(date +%s) - $start )) +! test -s $curl_err +test x"$(wc -l < $curl_out)" = x$nr_client +nr=$(sort < $curl_out | uniq | wc -l) + +test "$nr" -eq 1 +test x$(sort < $curl_out | uniq) = xHello +! grep Error $r_err +! grep Error $r_rot + +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 && echo "before_rot -eq after_rot" +test $after_err -gt $before_err && echo "before_err -gt after_err" + +kill $(cat $pid) +dbgcat r_err +! grep Error $r_err +! grep Error $r_rot diff --git a/t/t1003-thread-pool-reopen-logs.sh b/t/t1003-thread-pool-reopen-logs.sh new file mode 100755 index 0000000..6bba7ef --- /dev/null +++ b/t/t1003-thread-pool-reopen-logs.sh @@ -0,0 +1,2 @@ +#!/bin/sh +. ./lib-reopen-logs.sh diff --git a/t/t2003-thread-spawn-reopen-logs.sh b/t/t2003-thread-spawn-reopen-logs.sh new file mode 100755 index 0000000..6bba7ef --- /dev/null +++ b/t/t2003-thread-spawn-reopen-logs.sh @@ -0,0 +1,2 @@ +#!/bin/sh +. ./lib-reopen-logs.sh diff --git a/t/t3003-revactor-reopen-logs.sh b/t/t3003-revactor-reopen-logs.sh index 47b2eaf..6bba7ef 100755 --- a/t/t3003-revactor-reopen-logs.sh +++ b/t/t3003-revactor-reopen-logs.sh @@ -1,53 +1,2 @@ #!/bin/sh -. ./test-lib.sh - -eval $(unused_listen) -rtmpfiles unicorn_config curl_out curl_err pid r_err r_out r_rot - -nr_client=30 -nr_actor=10 - -cat > $unicorn_config <> $curl_out 2>> $curl_err ) & -done -! grep Error $r_err - -rm $r_rot -mv $r_err $r_rot - -kill -USR1 $(cat $pid) -wait_for_pid $r_err - -dbgcat r_rot -dbgcat r_err - -wait -echo elapsed=$(( $(date +%s) - $start )) -! test -s $curl_err -test x"$(wc -l < $curl_out)" = x$nr_client -nr=$(sort < $curl_out | uniq | wc -l) - -test "$nr" -eq 1 -test x$(sort < $curl_out | uniq) = xHello -! grep Error $r_err -! grep Error $r_rot - -kill $(cat $pid) -dbgcat r_err -! grep Error $r_err +. ./lib-reopen-logs.sh diff --git a/t/t4003-rev-reopen-logs.sh b/t/t4003-rev-reopen-logs.sh new file mode 100755 index 0000000..6bba7ef --- /dev/null +++ b/t/t4003-rev-reopen-logs.sh @@ -0,0 +1,2 @@ +#!/bin/sh +. ./lib-reopen-logs.sh diff --git a/t/test-lib.sh b/t/test-lib.sh old mode 100644 new mode 100755 -- cgit v1.2.3-24-ge0c7