about summary refs log tree commit homepage
path: root/t/t0026-splice-copy_stream-byte-range.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/t0026-splice-copy_stream-byte-range.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/t0026-splice-copy_stream-byte-range.sh')
-rw-r--r--t/t0026-splice-copy_stream-byte-range.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/t/t0026-splice-copy_stream-byte-range.sh b/t/t0026-splice-copy_stream-byte-range.sh
new file mode 100644
index 0000000..70546b6
--- /dev/null
+++ b/t/t0026-splice-copy_stream-byte-range.sh
@@ -0,0 +1,40 @@
+#!/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_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" && {
+        rtmpfiles out err
+        rainbows_setup $model
+        cat >> $unicorn_config <<EOF
+require "io/splice"
+Rainbows! do
+  copy_stream IO::Splice
+end
+def (::IO).copy_stream(*x); abort "NO"; end
+EOF
+
+        # can't load Rack::Lint here since it clobbers body#to_path
+        rainbows -E none -D large-file-response.ru -c $unicorn_config
+        rainbows_wait_start
+}
+
+. ./byte-range-common.sh