about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-05-16 19:43:38 +0000
committerEric Wong <normalperson@yhbt.net>2011-05-16 19:43:38 +0000
commit49b60d6f67a94560a802c6ff80c16c92093de877 (patch)
treeacf5e7c4551b393c64fa35535427173751caca82
parent39f625fff05d457b01f088017f463a86d3b6c626 (diff)
This makes things easier to maintain as we add more concurrency
options.
-rwxr-xr-xt/t0022-copy_stream-byte-range.sh17
-rw-r--r--t/t0026-splice-copy_stream-byte-range.sh17
-rw-r--r--t/t0027-nil-copy_stream.sh10
-rwxr-xr-xt/t9100-thread-timeout.sh8
-rwxr-xr-xt/t9101-thread-timeout-threshold.sh8
-rw-r--r--t/test-lib.sh31
6 files changed, 36 insertions, 55 deletions
diff --git a/t/t0022-copy_stream-byte-range.sh b/t/t0022-copy_stream-byte-range.sh
index 3e0a66b..f8494d1 100755
--- a/t/t0022-copy_stream-byte-range.sh
+++ b/t/t0022-copy_stream-byte-range.sh
@@ -1,22 +1,7 @@
 #!/bin/sh
 . ./test-lib.sh
 test -r random_blob || die "random_blob required, run with 'make $0'"
-case $RUBY_VERSION in
-1.9.*) ;;
-*)
-        t_info "skipping $T since it can't IO.copy_stream"
-        exit 0
-        ;;
-esac
-
-case $model in
-ThreadSpawn|WriterThreadSpawn|ThreadPool|WriterThreadPool|Base) ;;
-XEpollThreadSpawn) ;;
-*)
-        t_info "skipping $T since it doesn't use IO.copy_stream"
-        exit 0
-        ;;
-esac
+check_copy_stream
 
 t_plan 13 "IO.copy_stream byte range response for $model"
 
diff --git a/t/t0026-splice-copy_stream-byte-range.sh b/t/t0026-splice-copy_stream-byte-range.sh
index 70546b6..b4b89e5 100644
--- a/t/t0026-splice-copy_stream-byte-range.sh
+++ b/t/t0026-splice-copy_stream-byte-range.sh
@@ -1,24 +1,9 @@
 #!/bin/sh
 . ./test-lib.sh
 test -r random_blob || die "random_blob required, run with 'make $0'"
-case $RUBY_VERSION in
-1.9.*) ;;
-*)
-        t_info "skipping $T since it can't IO::Splice.copy_stream"
-        exit 0
-        ;;
-esac
+check_copy_stream
 check_splice
 
-case $model in
-ThreadSpawn|WriterThreadSpawn|ThreadPool|WriterThreadPool|Base) ;;
-XEpollThreadSpawn) ;;
-*)
-        t_info "skipping $T since it doesn't use copy_stream"
-        exit 0
-        ;;
-esac
-
 t_plan 13 "IO::Splice.copy_stream byte range response for $model"
 
 t_begin "setup and startup" && {
diff --git a/t/t0027-nil-copy_stream.sh b/t/t0027-nil-copy_stream.sh
index 03c7f0a..9b68160 100644
--- a/t/t0027-nil-copy_stream.sh
+++ b/t/t0027-nil-copy_stream.sh
@@ -1,15 +1,7 @@
 #!/bin/sh
 . ./test-lib.sh
 test -r random_blob || die "random_blob required, run with 'make $0'"
-
-case $model in
-ThreadSpawn|WriterThreadSpawn|ThreadPool|WriterThreadPool|Base) ;;
-XEpollThreadSpawn) ;;
-*)
-        t_info "skipping $T since it doesn't use copy_stream"
-        exit 0
-        ;;
-esac
+check_copy_stream
 
 t_plan 7 "large file 'copy_stream nil' test for $model"
 
diff --git a/t/t9100-thread-timeout.sh b/t/t9100-thread-timeout.sh
index 8d61cc5..bf0c252 100755
--- a/t/t9100-thread-timeout.sh
+++ b/t/t9100-thread-timeout.sh
@@ -1,12 +1,6 @@
 #!/bin/sh
 . ./test-lib.sh
-case $model in
-ThreadSpawn|ThreadPool) ;;
-RevThreadSpawn|RevThreadPool) ;;
-CoolioThreadSpawn|CoolioThreadPool) ;;
-XEpollThreadSpawn) ;;
-*) t_info "$0 is only compatible with Thread*"; exit 0 ;;
-esac
+check_threaded_app_dispatch
 
 t_plan 6 "ThreadTimeout Rack middleware test for $model"
 
diff --git a/t/t9101-thread-timeout-threshold.sh b/t/t9101-thread-timeout-threshold.sh
index 67e65f6..07ac3b2 100755
--- a/t/t9101-thread-timeout-threshold.sh
+++ b/t/t9101-thread-timeout-threshold.sh
@@ -1,12 +1,6 @@
 #!/bin/sh
 . ./test-lib.sh
-case $model in
-ThreadSpawn|ThreadPool) ;;
-RevThreadSpawn|RevThreadPool) ;;
-CoolioThreadSpawn|CoolioThreadPool) ;;
-XEpollThreadSpawn) ;;
-*) t_info "$0 is only compatible with Thread*"; exit 0 ;;
-esac
+check_threaded_app_dispatch
 
 t_plan 6 "ThreadTimeout Rack middleware test for $model"
 
diff --git a/t/test-lib.sh b/t/test-lib.sh
index be654d6..2f02cf1 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -225,6 +225,37 @@ check_splice () {
         esac
 }
 
+check_threaded_app_dispatch () {
+        case $model in
+        ThreadSpawn|ThreadPool) ;;
+        RevThreadSpawn|RevThreadPool) ;;
+        CoolioThreadSpawn|CoolioThreadPool) ;;
+        XEpollThreadSpawn|XEpollThreadPool) ;;
+        *)
+                t_info "$0 is only compatible with threaded app dispatch"
+                exit 0 ;;
+        esac
+}
+
+check_copy_stream () {
+        case $RUBY_VERSION in
+        1.9.*) ;;
+        *)
+                t_info "skipping $T since it can't IO.copy_stream"
+                exit 0
+                ;;
+        esac
+
+        case $model in
+        ThreadSpawn|WriterThreadSpawn|ThreadPool|WriterThreadPool|Base) ;;
+        XEpollThreadSpawn|XEpollThreadPool) ;;
+        *)
+                t_info "skipping $T since it doesn't use copy_stream"
+                exit 0
+                ;;
+        esac
+}
+
 case $model in
 Rev) require_check rev Rev::VERSION ;;
 Coolio) require_check coolio Coolio::VERSION ;;