about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-06-11 08:47:41 +0000
committerEric Wong <normalperson@yhbt.net>2010-06-11 08:48:07 +0000
commit0a3e9cacd7ca2feb91bae23b0c678d5e986f866f (patch)
tree321d8960d0a6711ccefdc12b759cfa890c4d93f2 /t
parent37687e027233072582c28bdd1530047a40ef7869 (diff)
downloadrainbows-0a3e9cacd7ca2feb91bae23b0c678d5e986f866f.tar.gz
Rubinius still has a few issues that prevent 100% support,
but it basically works if log rotation or USR2 upgrades aren't
required.  Tickets for all known issues for Rubinius have
been filed on the project's issue tracker.

* rbx does not support -i/-p yet, so rely on MRI for that
* "io/nonblock" is missing
* avoiding any optional Gems for now (EM, Rev, etc..)
Diffstat (limited to 't')
-rw-r--r--t/.gitignore2
-rw-r--r--t/GNUmakefile38
-rw-r--r--t/test-lib.sh2
-rw-r--r--t/test_isolate.rb22
4 files changed, 36 insertions, 28 deletions
diff --git a/t/.gitignore b/t/.gitignore
index ca24c05..f810a71 100644
--- a/t/.gitignore
+++ b/t/.gitignore
@@ -1,5 +1,5 @@
 /test-results-*
-/test-bin-*
+/bin-*
 /random_blob
 /.dep+*
 /trash
diff --git a/t/GNUmakefile b/t/GNUmakefile
index 2e86d24..2402257 100644
--- a/t/GNUmakefile
+++ b/t/GNUmakefile
@@ -4,6 +4,7 @@ all::
 
 pid := $(shell echo $$PPID)
 
+MRI = ruby
 RUBY = ruby
 rainbows_lib := $(shell cd ../lib && pwd)
 -include ../local.mk
@@ -15,7 +16,8 @@ ifeq ($(RUBY_VERSION),)
   $(error unable to detect RUBY_VERSION)
 endif
 
-export RUBY_VERSION
+RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
+export RUBY_VERSION RUBY_ENGINE
 
 models += WriterThreadPool
 models += WriterThreadSpawn
@@ -27,13 +29,15 @@ models += NeverBlock
 models += RevThreadSpawn
 models += RevThreadPool
 
-rp := )
-ONENINE := $(shell case $(RUBY_VERSION) in 1.9.*$(rp) echo true;;esac)
-ifeq ($(ONENINE),true)
-  models += Revactor
-  models += FiberSpawn
-  models += RevFiberSpawn
-  models += FiberPool
+ifeq ($(RUBY_ENGINE),ruby)
+  rp := )
+  ONENINE := $(shell case $(RUBY_VERSION) in 1.9.*$(rp) echo true;;esac)
+  ifeq ($(ONENINE),true)
+    models += Revactor
+    models += FiberSpawn
+    models += RevFiberSpawn
+    models += FiberPool
+  endif
 endif
 all_models := $(models) Base
 
@@ -60,7 +64,7 @@ $(all_models):
 all:: $(T)
 
 # can't rely on "set -o pipefail" since we don't require bash or ksh93 :<
-t_pfx = trash/$@-$(RUBY_VERSION)
+t_pfx = trash/$@-$(RUBY_ENGINE)-$(RUBY_VERSION)
 TEST_OPTS =
 # TRACER = strace -f -o $(t_pfx).strace -s 100000
 # TRACER = /usr/bin/time -o $(t_pfx).time
@@ -73,11 +77,13 @@ ifdef V
   endif
 endif
 
-test-bin-$(RUBY_VERSION)/rainbows: ruby_bin = $(shell which $(RUBY))
-test-bin-$(RUBY_VERSION)/rainbows: ../bin/rainbows
+bindir := $(CURDIR)/bin-$(RUBY_ENGINE)-$(RUBY_VERSION)
+bin_rainbows := $(bindir)/rainbows
+$(bin_rainbows): ruby_bin = $(shell which $(RUBY))
+$(bin_rainbows): ../bin/rainbows
         mkdir -p $(@D)
         install -m 755 $^ $@.$(pid)
-        $(RUBY) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $@.$(pid)
+        $(MRI) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $@.$(pid)
         mv $@.$(pid) $@
 
 random_blob:
@@ -95,18 +101,18 @@ $(deps):
           { echo >&2 "E '$(dep_bin)' not found in PATH=$(PATH)"; exit 1; }
         @mv $@.$(pid) $@
 
-libs := tmp/isolate/ruby-$(RUBY_VERSION)/.libs
+libs := tmp/isolate/$(RUBY_ENGINE)-$(RUBY_VERSION)/.libs
 $(libs): test_isolate.rb
         mkdir -p $(@D)
         $(RUBY) $< > $@+
         mv $@+ $@
-t_deps := $(libs) $(deps) test-bin-$(RUBY_VERSION)/rainbows trash/.gitignore
+t_deps := $(libs) $(deps) $(bin_rainbows) trash/.gitignore
 $(T): $(t_deps)
 
 $(MODEL_T): export model = $(firstword $(subst ., ,$@))
 $(MODEL_T): script = $(subst $(model).,,$@)
 $(MODEL_T): export RUBY := $(RUBY)
-$(MODEL_T): export PATH := $(CURDIR)/test-bin-$(RUBY_VERSION):$(PATH)
+$(MODEL_T): export PATH := $(bindir):$(PATH)
 $(MODEL_T): $(t_deps)
         RUBYLIB=$(rainbows_lib):$$(cat $(libs)) \
            $(TRACER) $(SHELL) $(SH_TEST_OPTS) $(script) $(TEST_OPTS)
@@ -116,6 +122,6 @@ trash/.gitignore:
         echo '*' > $@
 
 clean:
-        $(RM) -r trash/*.log trash/*.code test-bin-$(RUBY_VERSION)
+        $(RM) -r trash/*.log trash/*.code $(bindir)
 
 .PHONY: $(T) clean
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 4218dff..0fea06b 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -19,7 +19,7 @@ fi
 set -e
 RUBY="${RUBY-ruby}"
 RUBY_VERSION=${RUBY_VERSION-$($RUBY -e 'puts RUBY_VERSION')}
-t_pfx=$PWD/trash/$model.$T-$RUBY_VERSION
+t_pfx=$PWD/trash/$model.$T-$RUBY_ENGINE-$RUBY_VERSION
 set -u
 
 PATH=$PWD/bin:$PATH
diff --git a/t/test_isolate.rb b/t/test_isolate.rb
index ca446c8..2adac31 100644
--- a/t/test_isolate.rb
+++ b/t/test_isolate.rb
@@ -1,7 +1,8 @@
 require 'rubygems'
 require 'isolate'
+engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'
 
-path = "tmp/isolate/ruby-#{RUBY_VERSION}"
+path = "tmp/isolate/#{engine}-#{RUBY_VERSION}"
 opts = {
   :system => false,
   # we want "ruby-1.8.7" and not "ruby-1.8", so disable multiruby
@@ -16,23 +17,24 @@ Isolate.now!(opts) do
   gem 'rack', '1.1.0'
   gem 'unicorn', '0.991.0'
 
-  gem 'iobuffer', '0.1.3'
-  gem 'rev', '0.3.2'
+  if ! defined?(RUBY_ENGINE)
+    gem 'iobuffer', '0.1.3'
+    gem 'rev', '0.3.2'
 
-  gem 'eventmachine', '0.12.10'
+    gem 'eventmachine', '0.12.10'
 
-  gem 'sinatra', '0.9.4'
-  gem 'async_sinatra', '0.1.5'
+    gem 'sinatra', '0.9.4'
+    gem 'async_sinatra', '0.1.5'
 
-  gem 'neverblock', '0.1.6.2'
+    gem 'neverblock', '0.1.6.2'
+    gem 'cramp', '0.11'
+  end
 
-  if defined?(::Fiber)
+  if defined?(::Fiber) && ! defined?(RUBY_ENGINE)
     gem 'case', '0.5'
     gem 'revactor', '0.1.5'
     gem 'rack-fiber_pool', '0.9.0'
   end
-
-  gem 'cramp', '0.11'
 end
 
 $stdout.reopen(old_out)