From 3a250fcfb9fcfa0ab3a8105821e670563025faa4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 27 Dec 2010 07:18:49 +0000 Subject: initial cool.io support Cool.io is the new name for Rev. We'll continue to support Rev until Cool.io breaks backwards compatibility. Rev may not be supported if Cool.io is. --- t/GNUmakefile | 6 +++++- t/simple-http_Coolio.ru | 9 +++++++++ t/simple-http_CoolioFiberSpawn.ru | 10 ++++++++++ t/simple-http_CoolioThreadPool.ru | 9 +++++++++ t/simple-http_CoolioThreadSpawn.ru | 9 +++++++++ t/t0113-rewindable-input-false.sh | 4 +++- t/t0114-rewindable-input-true.sh | 4 +++- t/t9100-thread-timeout.sh | 4 +++- t/t9101-thread-timeout-threshold.sh | 4 +++- t/test-lib.sh | 1 + t/test_isolate.rb | 9 +++++++-- 11 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 t/simple-http_Coolio.ru create mode 100644 t/simple-http_CoolioFiberSpawn.ru create mode 100644 t/simple-http_CoolioThreadPool.ru create mode 100644 t/simple-http_CoolioThreadSpawn.ru (limited to 't') diff --git a/t/GNUmakefile b/t/GNUmakefile index 00c887d..0084f3d 100644 --- a/t/GNUmakefile +++ b/t/GNUmakefile @@ -24,6 +24,7 @@ models += WriterThreadSpawn models += ThreadPool models += ThreadSpawn models += Rev +models += Coolio models += EventMachine models += NeverBlock @@ -33,10 +34,13 @@ ifeq ($(RUBY_ENGINE),ruby) ifeq ($(ONENINE),true) models += Revactor models += FiberSpawn - models += RevFiberSpawn models += FiberPool models += RevThreadPool models += RevThreadSpawn + models += RevFiberSpawn + models += CoolioThreadPool + models += CoolioThreadSpawn + models += CoolioFiberSpawn endif endif diff --git a/t/simple-http_Coolio.ru b/t/simple-http_Coolio.ru new file mode 100644 index 0000000..cd9266a --- /dev/null +++ b/t/simple-http_Coolio.ru @@ -0,0 +1,9 @@ +use Rack::ContentLength +use Rack::ContentType +run lambda { |env| + if env['rack.multithread'] == false && env['rainbows.model'] == :Coolio + [ 200, {}, [ env.inspect << "\n" ] ] + else + raise "rack.multithread is true" + end +} diff --git a/t/simple-http_CoolioFiberSpawn.ru b/t/simple-http_CoolioFiberSpawn.ru new file mode 100644 index 0000000..9c39ed4 --- /dev/null +++ b/t/simple-http_CoolioFiberSpawn.ru @@ -0,0 +1,10 @@ +use Rack::ContentLength +use Rack::ContentType +run lambda { |env| + if env['rack.multithread'] == false && + env['rainbows.model'] == :CoolioFiberSpawn + [ 200, {}, [ Thread.current.inspect << "\n" ] ] + else + raise env.inspect + end +} diff --git a/t/simple-http_CoolioThreadPool.ru b/t/simple-http_CoolioThreadPool.ru new file mode 100644 index 0000000..b65357c --- /dev/null +++ b/t/simple-http_CoolioThreadPool.ru @@ -0,0 +1,9 @@ +use Rack::ContentLength +use Rack::ContentType +run lambda { |env| + if env['rack.multithread'] && env['rainbows.model'] == :CoolioThreadPool + [ 200, {}, [ env.inspect << "\n" ] ] + else + raise "rack.multithread is false" + end +} diff --git a/t/simple-http_CoolioThreadSpawn.ru b/t/simple-http_CoolioThreadSpawn.ru new file mode 100644 index 0000000..3c4bcaa --- /dev/null +++ b/t/simple-http_CoolioThreadSpawn.ru @@ -0,0 +1,9 @@ +use Rack::ContentLength +use Rack::ContentType +run lambda { |env| + if env['rack.multithread'] && env['rainbows.model'] == :CoolioThreadSpawn + [ 200, {}, [ env.inspect << "\n" ] ] + else + raise "rack.multithread is false" + end +} diff --git a/t/t0113-rewindable-input-false.sh b/t/t0113-rewindable-input-false.sh index c906106..1ab79bf 100755 --- a/t/t0113-rewindable-input-false.sh +++ b/t/t0113-rewindable-input-false.sh @@ -1,6 +1,8 @@ #!/bin/sh . ./test-lib.sh -skip_models EventMachine NeverBlock Rev RevThreadSpawn RevThreadPool +skip_models EventMachine NeverBlock +skip_models Rev RevThreadSpawn RevThreadPool +skip_models Coolio CoolioThreadSpawn CoolioThreadPool 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 349449c..7e337ea 100755 --- a/t/t0114-rewindable-input-true.sh +++ b/t/t0114-rewindable-input-true.sh @@ -1,6 +1,8 @@ #!/bin/sh . ./test-lib.sh -skip_models EventMachine NeverBlock Rev RevThreadSpawn RevThreadPool +skip_models EventMachine NeverBlock +skip_models Rev RevThreadSpawn RevThreadPool +skip_models Coolio CoolioThreadSpawn CoolioThreadPool t_plan 4 "rewindable_input toggled to true" diff --git a/t/t9100-thread-timeout.sh b/t/t9100-thread-timeout.sh index 0f802dd..422052e 100755 --- a/t/t9100-thread-timeout.sh +++ b/t/t9100-thread-timeout.sh @@ -1,7 +1,9 @@ #!/bin/sh . ./test-lib.sh case $model in -ThreadSpawn|ThreadPool|RevThreadSpawn|RevThreadPool) ;; +ThreadSpawn|ThreadPool) ;; +RevThreadSpawn|RevThreadPool) ;; +CoolioThreadSpawn|CoolioThreadPool) ;; *) t_info "$0 is only compatible with Thread*"; exit 0 ;; esac diff --git a/t/t9101-thread-timeout-threshold.sh b/t/t9101-thread-timeout-threshold.sh index 99d3f98..7309475 100755 --- a/t/t9101-thread-timeout-threshold.sh +++ b/t/t9101-thread-timeout-threshold.sh @@ -1,7 +1,9 @@ #!/bin/sh . ./test-lib.sh case $model in -ThreadSpawn|ThreadPool|RevThreadSpawn|RevThreadPool) ;; +ThreadSpawn|ThreadPool) ;; +RevThreadSpawn|RevThreadPool) ;; +CoolioThreadSpawn|CoolioThreadPool) ;; *) t_info "$0 is only compatible with Thread*"; exit 0 ;; esac diff --git a/t/test-lib.sh b/t/test-lib.sh index 4f9d4b1..f65adc5 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -200,6 +200,7 @@ req_curl_chunked_upload_err_check () { case $model in Rev) require_check rev Rev::VERSION ;; +Coolio) require_check coolio Coolio::VERSION ;; Revactor) require_check revactor Revactor::VERSION ;; EventMachine) require_check eventmachine EventMachine::VERSION ;; esac diff --git a/t/test_isolate.rb b/t/test_isolate.rb index ad92f72..e49a7ee 100644 --- a/t/test_isolate.rb +++ b/t/test_isolate.rb @@ -23,7 +23,7 @@ Isolate.now!(opts) do gem 'sendfile', '1.0.0' # next Rubinius should support this gem 'iobuffer', '0.1.3' - gem 'rev', '0.3.2' + gem 'cool.io', '1.0.0' gem 'eventmachine', '0.12.10' gem 'sinatra', '1.0.0' @@ -41,4 +41,9 @@ Isolate.now!(opts) do end $stdout.reopen(old_out) -puts Dir["#{path}/gems/*-*/lib"].map { |x| File.expand_path(x) }.join(':') + +# don't load the old Rev if it exists, Cool.io 1.0.0 is compatible with it, +# even for everything Revactor uses. +dirs = Dir["#{path}/gems/*-*/lib"] +dirs.delete_if { |x| x =~ %r{/rev-[\d\.]+/lib} } +puts dirs.map { |x| File.expand_path(x) }.join(':') -- cgit v1.2.3-24-ge0c7