about summary refs log tree commit homepage
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-05-16 19:04:06 +0000
committerEric Wong <normalperson@yhbt.net>2011-05-16 19:34:52 +0000
commit39f625fff05d457b01f088017f463a86d3b6c626 (patch)
treeeae2a3a759b70e0f6d12caefdf177d3eca418efe /t/test-lib.sh
parentd520222050ce88388ae5e446c63642d79cc9796e (diff)
downloadrainbows-39f625fff05d457b01f088017f463a86d3b6c626.tar.gz
This allows using IO::Splice.copy_stream from the "io_splice"
RubyGem on recent Linux systems.  This also allows users to
disable copy_stream usage entirely and use traditional
response_body.each calls which are compatible with all Rack
servers (to workaround bugs in IO.copy_stream under 1.9.2-p180).
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 655f36b..be654d6 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -198,6 +198,33 @@ req_curl_chunked_upload_err_check () {
         fi
 }
 
+check_splice () {
+        case $(uname -s) in
+        Linux) ;;
+        *)
+                t_info "skipping $T since it's not Linux"
+                exit 0
+                ;;
+        esac
+
+        # we only allow splice on 2.6.32+
+        min=32 uname_r=$(uname -r)
+        case $uname_r in
+        2.6.*)
+                sub=$(expr "$uname_r" : '2\.6\.\(.*\)$')
+                if test $sub -lt $min
+                then
+                        t_info "skipping $T (Linux $(uname_r < 2.6.$min)"
+                        exit 0
+                fi
+                ;;
+        *)
+                t_info "skipping $T (Linux $uname_r < 2.6.$min)"
+                exit 0
+                ;;
+        esac
+}
+
 case $model in
 Rev) require_check rev Rev::VERSION ;;
 Coolio) require_check coolio Coolio::VERSION ;;