diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-01-19 15:06:10 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-01-19 15:06:27 -0800 |
commit | 9424b13255a238dfa44952ebeb07bea3acee999c (patch) | |
tree | 9a517e9b22a3cc73c9ad16c9288eedf09ac18b8a /t | |
parent | 7a04133c1ab57923cac8a9de04b00bfe89bcce2d (diff) | |
download | rainbows-9424b13255a238dfa44952ebeb07bea3acee999c.tar.gz |
Coolio and EventMachine only use level-triggered epoll, but being Rainbows!, we live on the EDGE!
Diffstat (limited to 't')
-rw-r--r-- | t/GNUmakefile | 1 | ||||
-rw-r--r-- | t/kgio-pipe-response.ru | 10 | ||||
-rw-r--r-- | t/simple-http_Epoll.ru | 9 | ||||
-rwxr-xr-x | t/t0034-pipelined-pipe-response.sh | 3 | ||||
-rwxr-xr-x | t/t0035-kgio-pipe-response.sh | 2 | ||||
-rwxr-xr-x | t/t0113-rewindable-input-false.sh | 1 | ||||
-rwxr-xr-x | t/t0114-rewindable-input-true.sh | 1 | ||||
-rw-r--r-- | t/test_isolate.rb | 2 |
8 files changed, 26 insertions, 3 deletions
diff --git a/t/GNUmakefile b/t/GNUmakefile index 91e05f5..7b50944 100644 --- a/t/GNUmakefile +++ b/t/GNUmakefile @@ -19,6 +19,7 @@ endif RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))') export RUBY_VERSION RUBY_ENGINE +models += Epoll models += WriterThreadPool models += WriterThreadSpawn models += ThreadPool diff --git a/t/kgio-pipe-response.ru b/t/kgio-pipe-response.ru index edd2aac..9c70d47 100644 --- a/t/kgio-pipe-response.ru +++ b/t/kgio-pipe-response.ru @@ -1,10 +1,18 @@ # must be run without Rack::Lint since that clobbers to_path use Rainbows::DevFdResponse run(lambda { |env| + io = case env["rainbows.model"].to_s + when /Fiber/ + Rainbows::Fiber::IO::Pipe + else + Kgio::Pipe + end.popen('cat random_blob', 'rb') + [ 200, { 'Content-Length' => ::File.stat('random_blob').size.to_s, 'Content-Type' => 'application/octet-stream', }, - Rainbows::Fiber::IO::Pipe.popen('cat random_blob', 'rb') ] + io + ] }) diff --git a/t/simple-http_Epoll.ru b/t/simple-http_Epoll.ru new file mode 100644 index 0000000..6513343 --- /dev/null +++ b/t/simple-http_Epoll.ru @@ -0,0 +1,9 @@ +use Rack::ContentLength +use Rack::ContentType +run lambda { |env| + if env['rack.multithread'] == false && env['rainbows.model'] == :Epoll + [ 200, {}, [ Thread.current.inspect << "\n" ] ] + else + raise env.inspect + end +} diff --git a/t/t0034-pipelined-pipe-response.sh b/t/t0034-pipelined-pipe-response.sh index 8346af9..6dff9ad 100755 --- a/t/t0034-pipelined-pipe-response.sh +++ b/t/t0034-pipelined-pipe-response.sh @@ -22,12 +22,13 @@ require "kcar" $stdin.binmode expect = ENV["random_blob_sha1"] kcar = Kcar::Response.new($stdin, {}) -3.times do +3.times do |i| nr = 0 status, headers, body = kcar.rack dig = Digest::SHA1.new body.each { |buf| dig << buf ; nr += buf.size } sha1 = dig.hexdigest + warn "[#{i}] nr: #{nr}" sha1 == expect or abort "mismatch: sha1=#{sha1} != expect=#{expect}" body.close end diff --git a/t/t0035-kgio-pipe-response.sh b/t/t0035-kgio-pipe-response.sh index 97c3f2a..c4b1096 100755 --- a/t/t0035-kgio-pipe-response.sh +++ b/t/t0035-kgio-pipe-response.sh @@ -2,7 +2,7 @@ . ./test-lib.sh test -r random_blob || die "random_blob required, run with 'make $0'" case $model in -*Fiber* ) ;; +*Fiber*|Epoll) ;; *) t_info "skipping $T since it's not compatible with $model" exit 0 diff --git a/t/t0113-rewindable-input-false.sh b/t/t0113-rewindable-input-false.sh index 1ab79bf..82b0fb7 100755 --- a/t/t0113-rewindable-input-false.sh +++ b/t/t0113-rewindable-input-false.sh @@ -3,6 +3,7 @@ skip_models EventMachine NeverBlock skip_models Rev RevThreadSpawn RevThreadPool skip_models Coolio CoolioThreadSpawn CoolioThreadPool +skip_models Epoll t_plan 4 "rewindable_input toggled to false" diff --git a/t/t0114-rewindable-input-true.sh b/t/t0114-rewindable-input-true.sh index 7e337ea..fd8561c 100755 --- a/t/t0114-rewindable-input-true.sh +++ b/t/t0114-rewindable-input-true.sh @@ -3,6 +3,7 @@ skip_models EventMachine NeverBlock skip_models Rev RevThreadSpawn RevThreadPool skip_models Coolio CoolioThreadSpawn CoolioThreadPool +skip_models Epoll t_plan 4 "rewindable_input toggled to true" diff --git a/t/test_isolate.rb b/t/test_isolate.rb index 9b0c026..f0f16f1 100644 --- a/t/test_isolate.rb +++ b/t/test_isolate.rb @@ -33,6 +33,8 @@ Isolate.now!(opts) do gem 'revactor', '0.1.5' gem 'rack-fiber_pool', '0.9.1' end + + gem 'sleepy_penguin', '1.2.0' end $stdout.reopen(old_out) |