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 --- .gitignore | 1 - Rakefile | 11 ----------- config/.gitignore | 1 - config/isolate.rb | 25 ------------------------- local.mk.sample | 17 ----------------- t/.gitignore | 1 + t/GNUmakefile | 22 +++++++++++----------- t/test_isolate.rb | 39 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 51 insertions(+), 66 deletions(-) delete mode 100644 config/.gitignore delete mode 100644 config/isolate.rb create mode 100644 t/test_isolate.rb diff --git a/.gitignore b/.gitignore index d20450a..a9cb887 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,3 @@ pkg/ /.manifest /GIT-VERSION-FILE /man -/tmp diff --git a/Rakefile b/Rakefile index 1c35b44..219744a 100644 --- a/Rakefile +++ b/Rakefile @@ -183,14 +183,3 @@ task :fm_update do p http.post(uri.path, req, {'Content-Type'=>'application/json'}) end end - -desc 'isolate gems for development' -task :isolate do - require 'isolate' - - Isolate.now!( - :system => false, - # we want "ruby-1.8.7" and not "ruby-1.8", so disable multiruby - :multiruby => false, - :path => "tmp/isolate/ruby-#{RUBY_VERSION}") -end diff --git a/config/.gitignore b/config/.gitignore deleted file mode 100644 index 0aaed9f..0000000 --- a/config/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/isolate_*.rb diff --git a/config/isolate.rb b/config/isolate.rb deleted file mode 100644 index 75d4931..0000000 --- a/config/isolate.rb +++ /dev/null @@ -1,25 +0,0 @@ -# this the default config file used by John Barnette's isolate gem -# you can create a config/isolate_local.rb file to override this -# See the corresponding tasks in Rakefile and GNUmakefile -# `rake isolate' or (faster in the unmodified case, `make isolate') - -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' diff --git a/local.mk.sample b/local.mk.sample index 7180bbd..169f6ea 100644 --- a/local.mk.sample +++ b/local.mk.sample @@ -29,23 +29,6 @@ else prefix := $(prefix)/ruby-1.9.2 export PATH := $(prefix)/bin:$(PATH) RUBY := $(prefix)/bin/ruby --disable-gems - gem_paths := $(addprefix $(prefix)/lib/ruby/gems/1.9.1/gems/,$(gems)) -endif - -ifndef NO_ISOLATE - x := $(shell test -d t/ && \ - PATH=$(PATH) NO_ISOLATE=T $(MAKE) -s isolate RUBY:="$(RUBY)") -endif - -RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION') - -updir := $(shell git rev-parse --show-cdup) -gem_paths := $(wildcard $(updir)tmp/isolate/ruby-$(RUBY_VERSION)/gems/*-*) - -ifdef gem_paths - sp := - sp += - export RUBYLIB := $(subst $(sp),:,$(addsuffix /lib,$(gem_paths))) endif # pipefail is THE reason to use bash (v3+) or never revisions of ksh93 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