From f66c59d7b259e5784c9da87df1a6f1dbca160577 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 4 Jun 2010 01:25:29 +0000 Subject: tests: cleanup isolate usage We don't need tmp/ in our top level directory --- t/.gitignore | 1 + t/GNUmakefile | 22 +++++++++++----------- t/test_isolate.rb | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 t/test_isolate.rb (limited to 't') diff --git a/t/.gitignore b/t/.gitignore index 552f88a..ca24c05 100644 --- a/t/.gitignore +++ b/t/.gitignore @@ -3,3 +3,4 @@ /random_blob /.dep+* /trash +/tmp diff --git a/t/GNUmakefile b/t/GNUmakefile index 81484a7..955f273 100644 --- a/t/GNUmakefile +++ b/t/GNUmakefile @@ -15,12 +15,7 @@ ifeq ($(RUBY_VERSION),) $(error unable to detect RUBY_VERSION) endif -ifeq ($(RUBYLIB),) - RUBYLIB := $(rainbows_lib) -else - RUBYLIB := $(rainbows_lib):$(RUBYLIB) -endif -export RUBYLIB RUBY_VERSION +export RUBY_VERSION models += WriterThreadPool models += WriterThreadSpawn @@ -99,16 +94,21 @@ $(deps): @test -s $@.$(pid) || \ { echo >&2 "E '$(dep_bin)' not found in PATH=$(PATH)"; exit 1; } @mv $@.$(pid) $@ -dep: $(deps) - $(MAKE) -C .. isolate + +libs := tmp/isolate/ruby-$(RUBY_VERSION)/.libs +$(libs): test_isolate.rb + mkdir -p $(@D) + $(RUBY) $< > $@+ + mv $@+ $@ +$(T): $(libs) $(deps) test-bin-$(RUBY_VERSION)/rainbows trash/.gitignore $(MODEL_T): export model = $(firstword $(subst ., ,$@)) $(MODEL_T): script = $(subst $(model).,,$@) -$(MODEL_T): trash/.gitignore $(MODEL_T): export RUBY := $(RUBY) $(MODEL_T): export PATH := $(CURDIR)/test-bin-$(RUBY_VERSION):$(PATH) -$(MODEL_T): test-bin-$(RUBY_VERSION)/rainbows dep - $(TRACER) $(SHELL) $(SH_TEST_OPTS) $(script) $(TEST_OPTS) +$(MODEL_T): + RUBYLIB=$(rainbows_lib):$$(cat $(libs)) \ + $(TRACER) $(SHELL) $(SH_TEST_OPTS) $(script) $(TEST_OPTS) trash/.gitignore: mkdir -p $(@D) diff --git a/t/test_isolate.rb b/t/test_isolate.rb new file mode 100644 index 0000000..9e14b3f --- /dev/null +++ b/t/test_isolate.rb @@ -0,0 +1,39 @@ +require 'rubygems' +require 'isolate' + +path = "tmp/isolate/ruby-#{RUBY_VERSION}" +opts = { + :system => false, + # we want "ruby-1.8.7" and not "ruby-1.8", so disable multiruby + :multiruby => false, + :path => path, +} + +old_out = $stdout.dup +$stdout.reopen($stderr) + +Isolate.now!(opts) do + gem 'rack', '1.1.0' + gem 'unicorn', '0.99.0' + + gem 'iobuffer', '0.1.3' + gem 'rev', '0.3.2' + + gem 'eventmachine', '0.12.10' + + gem 'sinatra', '0.9.4' + gem 'async_sinatra', '0.1.5' + + gem 'neverblock', '0.1.6.2' + + if defined?(::Fiber) + 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) +puts Dir["#{path}/gems/*-*/lib"].map { |x| File.expand_path(x) }.join(':') -- cgit v1.2.3-24-ge0c7