[RFC/PATCH] remove Rails-oriented integration tests

Eric Wong normalperson at yhbt.net
Sat Jul 28 02:22:36 UTC 2012


(This is a large patch which deletes a lot of files, so it's pointless
 to post in its entirety here.  Full diffstat and --diff-filter=M
 output below.  I've pushed this to the "pu" branch of
 git://bogomips.org/unicorn.git
 commit 91a3cde091d4ae6ff436681f155b3907daae1c04)

It's too much overhead to keep Rails-specific tests working,
especially when it's hauling in an ancient version of SQLite3.
Since Rails 3 has settled down with Rack and unicorn_rails is
unlikely to need changing in the future, we can drop these
tests.
---
 GNUmakefile                                        |  31 +--
 script/isolate_for_tests                           |  18 --

 Summary of full diffstat:
 94 files changed, 2 insertions(+), 1598 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 61fb739..ea13486 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -32,16 +32,13 @@ MYLIBS = $(RUBYLIB):$(ISOLATE_LIBS)
 # dunno how to implement this as concisely in Ruby, and hell, I love awk
 awk_slow := awk '/def test_/{print FILENAME"--"$$2".n"}' 2>/dev/null
 
-rails_vers := $(subst test/rails/app-,,$(wildcard test/rails/app-*))
 slow_tests := test/unit/test_server.rb test/exec/test_exec.rb \
   test/unit/test_signals.rb test/unit/test_upload.rb
 log_suffix = .$(RUBY_ENGINE).$(RUBY_VERSION).log
-T_r := $(wildcard test/rails/test*.rb)
-T := $(filter-out $(slow_tests) $(T_r), $(wildcard test/*/test*.rb))
+T := $(filter-out $(slow_tests), $(wildcard test/*/test*.rb))
 T_n := $(shell $(awk_slow) $(slow_tests))
 T_log := $(subst .rb,$(log_suffix),$(T))
 T_n_log := $(subst .n,$(log_suffix),$(T_n))
-T_r_log := $(subst .r,$(log_suffix),$(T_r))
 test_prefix = $(CURDIR)/test/$(RUBY_ENGINE)-$(RUBY_VERSION)
 
 ext := ext/unicorn_http
@@ -93,7 +90,7 @@ $(slow_tests): $(test_prefix)/.stamp
 test-integration: $(test_prefix)/.stamp
 	$(MAKE) -C t
 
-test-all: test test-rails test-integration
+test-all: test test-integration
 
 TEST_OPTS = -v
 check_test = grep '0 failures, 0 errors' $(t) >/dev/null
@@ -199,30 +196,6 @@ doc_gz:
 	for i in $(docs); do \
 	  gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
 
-rails_git_url = git://github.com/rails/rails.git
-rails_git := vendor/rails.git
-$(rails_git)/info/cloned-stamp:
-	git clone --mirror -q $(rails_git_url) $(rails_git)
-	> $@
-
-$(rails_git)/info/v2.2.3-stamp: $(rails_git)/info/cloned-stamp
-	cd $(rails_git) && git fetch
-	cd $(rails_git) && git rev-parse --verify refs/tags/v2.2.3
-	> $@
-
-rails_tests := $(addsuffix .r,$(addprefix $(T_r).,$(rails_vers)))
-test-rails: $(rails_tests)
-$(T_r).%.r: t = $(addsuffix $(log_suffix),$@)
-$(T_r).%.r: rv = $(subst .r,,$(subst $(T_r).,,$@))
-$(T_r).%.r: extra = ' 'v$(rv)
-$(T_r).%.r: arg = $(T_r)
-$(T_r).%.r: export PATH := $(test_prefix)/bin:$(PATH)
-$(T_r).%.r: export RUBYLIB := $(test_prefix):$(test_prefix)/lib:$(MYLIBS)
-$(T_r).%.r: export UNICORN_RAILS_TEST_VERSION = $(rv)
-$(T_r).%.r: export RAILS_GIT_REPO = $(CURDIR)/$(rails_git)
-$(T_r).%.r: $(test_prefix)/.stamp $(rails_git)/info/v2.2.3-stamp
-	$(run_test)
-
 ifneq ($(VERSION),)
 rfproject := mongrel
 rfpackage := unicorn
diff --git a/script/isolate_for_tests b/script/isolate_for_tests
index 5e6139c..00a3f2b 100755
--- a/script/isolate_for_tests
+++ b/script/isolate_for_tests
@@ -16,9 +16,6 @@ opts = {
 
 pid = fork do
   Isolate.now!(opts) do
-    if RUBY_VERSION.to_f < 2.0
-      gem 'sqlite3-ruby', '1.2.5'
-    end
     gem 'raindrops', '0.8.0'
     gem 'kgio-monkey', '0.4.0'
     gem 'kgio', '2.7.4'
@@ -33,18 +30,3 @@ File.open("#{dst}.#$$", "w") do |fp|
   fp.puts "ISOLATE_LIBS=#{lib_paths.join(':')}"
 end
 File.rename("#{dst}.#$$", dst)
-
-# pure Ruby gems can be shared across all Rubies
-%w(3.0.0).each do |rails_ver|
-  opts[:path] = "tmp/isolate/rails-#{rails_ver}"
-  pid = fork do
-    Isolate.now!(opts) do
-      gem 'rake', '0.8.7'
-      gem 'rails', rails_ver
-    end
-  end
-  _, status = Process.waitpid2(pid)
-  status.success? or abort status.inspect
-  more = Dir["#{opts[:path]}/gems/*-*/lib"].map { |x| File.expand_path(x) }
-  lib_paths.concat(more)
-end


More information about the mongrel-unicorn mailing list