about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--GNUmakefile8
-rw-r--r--test/unit/test_util.rb58
2 files changed, 34 insertions, 32 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 1145143..47c6b5f 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -48,7 +48,7 @@ http11: lib/unicorn/http11.$(DLEXT)
 
 $(test_prefix)/.stamp: $(inst_deps)
         mkdir -p $(test_prefix)/.ccache
-        tar c bin ext lib GNUmakefile Manifest | (cd $(test_prefix) && tar x)
+        tar c `cat Manifest` | (cd $(test_prefix) && tar x)
         $(MAKE) -C $(test_prefix) clean
         $(MAKE) -C $(test_prefix) http11 shebang
         > $@
@@ -88,14 +88,14 @@ run_test = $(quiet_pre) setsid $(ruby) -w $(arg) $(TEST_OPTS) $(quiet_post) || \
 %.n: arg = $(subst .n,,$(subst --, -n ,$@))
 %.n: t = $(subst .n,$(log_suffix),$@)
 %.n: export PATH := $(test_prefix)/bin:$(PATH)
-%.n: export RUBYLIB := $(test_prefix)/lib:$(RUBYLIB)
+%.n: export RUBYLIB := $(test_prefix):$(test_prefix)/lib:$(RUBYLIB)
 %.n: $(test_prefix)/.stamp
         $(run_test)
 
 $(T): arg = $@
 $(T): t = $(subst .rb,$(log_suffix),$@)
 $(T): export PATH := $(test_prefix)/bin:$(PATH)
-$(T): export RUBYLIB := $(test_prefix)/lib:$(RUBYLIB)
+$(T): export RUBYLIB := $(test_prefix):$(test_prefix)/lib:$(RUBYLIB)
 $(T): $(test_prefix)/.stamp
         $(run_test)
 
@@ -141,7 +141,7 @@ $(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)/lib:$(RUBYLIB)
+$(T_r).%.r: export RUBYLIB := $(test_prefix):$(test_prefix)/lib:$(RUBYLIB)
 $(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/cloned-stamp
diff --git a/test/unit/test_util.rb b/test/unit/test_util.rb
index 1616eac..032f0be 100644
--- a/test/unit/test_util.rb
+++ b/test/unit/test_util.rb
@@ -43,20 +43,21 @@ class TestUtil < Test::Unit::TestCase
     tmp = Tempfile.new(nil)
     tmp_path = tmp.path.dup.freeze
     Encoding.list.each { |encoding|
-      tmp.reopen(tmp_path, "a:#{encoding.to_s}")
-      tmp.sync = true
-      assert_equal encoding, tmp.external_encoding
-      assert_nil tmp.internal_encoding
-      File.unlink(tmp_path)
-      assert ! File.exist?(tmp_path)
-      Unicorn::Util.reopen_logs
-      assert_equal tmp_path, tmp.path
-      assert File.exist?(tmp_path)
-      assert_equal tmp.stat.inspect, File.stat(tmp_path).inspect
-      assert_equal encoding, tmp.external_encoding
-      assert_nil tmp.internal_encoding
-      assert_equal(EXPECT_FLAGS, EXPECT_FLAGS & tmp.fcntl(Fcntl::F_GETFL))
-      assert tmp.sync
+      File.open(tmp_path, "a:#{encoding.to_s}") { |fp|
+        fp.sync = true
+        assert_equal encoding, fp.external_encoding
+        assert_nil fp.internal_encoding
+        File.unlink(tmp_path)
+        assert ! File.exist?(tmp_path)
+        Unicorn::Util.reopen_logs
+        assert_equal tmp_path, fp.path
+        assert File.exist?(tmp_path)
+        assert_equal fp.stat.inspect, File.stat(tmp_path).inspect
+        assert_equal encoding, fp.external_encoding
+        assert_nil fp.internal_encoding
+        assert_equal(EXPECT_FLAGS, EXPECT_FLAGS & fp.fcntl(Fcntl::F_GETFL))
+        assert fp.sync
+      }
     }
   end if STDIN.respond_to?(:external_encoding)
 
@@ -66,20 +67,21 @@ class TestUtil < Test::Unit::TestCase
     Encoding.list.each { |ext|
       Encoding.list.each { |int|
         next if ext == int
-        tmp.reopen(tmp_path, "a:#{ext.to_s}:#{int.to_s}")
-        tmp.sync = true
-        assert_equal ext, tmp.external_encoding
-        assert_equal int, tmp.internal_encoding
-        File.unlink(tmp_path)
-        assert ! File.exist?(tmp_path)
-        Unicorn::Util.reopen_logs
-        assert_equal tmp_path, tmp.path
-        assert File.exist?(tmp_path)
-        assert_equal tmp.stat.inspect, File.stat(tmp_path).inspect
-        assert_equal ext, tmp.external_encoding
-        assert_equal int, tmp.internal_encoding
-        assert_equal(EXPECT_FLAGS, EXPECT_FLAGS & tmp.fcntl(Fcntl::F_GETFL))
-        assert tmp.sync
+        File.open(tmp_path, "a:#{ext.to_s}:#{int.to_s}") { |fp|
+          fp.sync = true
+          assert_equal ext, fp.external_encoding
+          assert_equal int, fp.internal_encoding
+          File.unlink(tmp_path)
+          assert ! File.exist?(tmp_path)
+          Unicorn::Util.reopen_logs
+          assert_equal tmp_path, fp.path
+          assert File.exist?(tmp_path)
+          assert_equal fp.stat.inspect, File.stat(tmp_path).inspect
+          assert_equal ext, fp.external_encoding
+          assert_equal int, fp.internal_encoding
+          assert_equal(EXPECT_FLAGS, EXPECT_FLAGS & fp.fcntl(Fcntl::F_GETFL))
+          assert fp.sync
+        }
       }
     }
   end if STDIN.respond_to?(:external_encoding)