From 079a23e4f868e6615762efcc711cbf86d95876ef Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 6 Feb 2015 22:17:26 +0000 Subject: [PATCH] fix uninstalled testing and reduce require paths This fixes a bug introduced in commit fe83ead4eae6f011fa15f506cd80cb4256813a92 (GNUmakefile: fix clean gem build + reduce build cruft) which broke clean Ruby installations without an existing unicorn gem installed :x --- GNUmakefile | 10 +++++++--- test/exec/test_exec.rb | 2 +- test/unit/test_http_parser.rb | 2 +- test/unit/test_http_parser_ng.rb | 2 +- test/unit/test_request.rb | 2 +- test/unit/test_response.rb | 2 +- test/unit/test_server.rb | 2 +- test/unit/test_signals.rb | 2 +- test/unit/test_socket_helper.rb | 2 +- test/unit/test_upload.rb | 2 +- test/unit/test_util.rb | 2 +- 11 files changed, 17 insertions(+), 13 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 8bd63ee4..2995a6ba 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -59,13 +59,17 @@ $(ext)/unicorn_http.$(DLEXT): $(ext)/Makefile $(MAKE) -C $(@D) http: $(ext)/unicorn_http.$(DLEXT) +# only used for tests +http-install: $(ext)/unicorn_http.$(DLEXT) + install -m644 $< lib/ + test-install: $(test_prefix)/.stamp $(test_prefix)/.stamp: $(inst_deps) mkdir -p $(test_prefix)/.ccache tar cf - $(inst_deps) GIT-VERSION-GEN | \ (cd $(test_prefix) && tar xf -) $(MAKE) -C $(test_prefix) clean - $(MAKE) -C $(test_prefix) http shebang RUBY="$(RUBY)" + $(MAKE) -C $(test_prefix) http-install shebang RUBY="$(RUBY)" > $@ # this is only intended to be run within $(test_prefix) @@ -119,14 +123,14 @@ run_test = $(quiet_pre) \ %.n: arg = $(subst .n,,$(subst --, -n ,$@)) %.n: t = $(subst .n,$(log_suffix),$@) %.n: export PATH := $(test_prefix)/bin:$(PATH) -%.n: export RUBYLIB := $(test_prefix):$(test_prefix)/lib:$(MYLIBS) +%.n: export RUBYLIB := $(test_prefix)/lib:$(MYLIBS) %.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):$(test_prefix)/lib:$(MYLIBS) +$(T): export RUBYLIB := $(test_prefix)/lib:$(MYLIBS) $(T): $(test_prefix)/.stamp $(run_test) diff --git a/test/exec/test_exec.rb b/test/exec/test_exec.rb index 10a1baed..6deb96b9 100644 --- a/test/exec/test_exec.rb +++ b/test/exec/test_exec.rb @@ -2,7 +2,7 @@ # Copyright (c) 2009 Eric Wong FLOCK_PATH = File.expand_path(__FILE__) -require 'test/test_helper' +require './test/test_helper' do_test = true $unicorn_bin = ENV['UNICORN_TEST_BIN'] || "unicorn" diff --git a/test/unit/test_http_parser.rb b/test/unit/test_http_parser.rb index 2251dcff..431ede51 100644 --- a/test/unit/test_http_parser.rb +++ b/test/unit/test_http_parser.rb @@ -7,7 +7,7 @@ # Additional work donated by contributors. See git history # for more information. -require 'test/test_helper' +require './test/test_helper' include Unicorn diff --git a/test/unit/test_http_parser_ng.rb b/test/unit/test_http_parser_ng.rb index d5c8d2e6..0c810725 100644 --- a/test/unit/test_http_parser_ng.rb +++ b/test/unit/test_http_parser_ng.rb @@ -1,6 +1,6 @@ # -*- encoding: binary -*- -require 'test/test_helper' +require './test/test_helper' require 'digest/md5' include Unicorn diff --git a/test/unit/test_request.rb b/test/unit/test_request.rb index fbda1a2e..f0ccaf7f 100644 --- a/test/unit/test_request.rb +++ b/test/unit/test_request.rb @@ -4,7 +4,7 @@ # You can redistribute it and/or modify it under the same terms as Ruby 1.8 or # the GPLv2+ (GPLv3+ preferred) -require 'test/test_helper' +require './test/test_helper' include Unicorn diff --git a/test/unit/test_response.rb b/test/unit/test_response.rb index bdca9f58..d0f0c79f 100644 --- a/test/unit/test_response.rb +++ b/test/unit/test_response.rb @@ -7,7 +7,7 @@ # Additional work donated by contributors. See git history # for more information. -require 'test/test_helper' +require './test/test_helper' require 'time' include Unicorn diff --git a/test/unit/test_server.rb b/test/unit/test_server.rb index 9c92babd..8b3afadf 100644 --- a/test/unit/test_server.rb +++ b/test/unit/test_server.rb @@ -7,7 +7,7 @@ # Additional work donated by contributors. See git history # for more information. -require 'test/test_helper' +require './test/test_helper' include Unicorn diff --git a/test/unit/test_signals.rb b/test/unit/test_signals.rb index 443c7369..45928195 100644 --- a/test/unit/test_signals.rb +++ b/test/unit/test_signals.rb @@ -6,7 +6,7 @@ # # Ensure we stay sane in the face of signals being sent to us -require 'test/test_helper' +require './test/test_helper' include Unicorn diff --git a/test/unit/test_socket_helper.rb b/test/unit/test_socket_helper.rb index 994b9904..8b091983 100644 --- a/test/unit/test_socket_helper.rb +++ b/test/unit/test_socket_helper.rb @@ -1,6 +1,6 @@ # -*- encoding: binary -*- -require 'test/test_helper' +require './test/test_helper' require 'tempfile' class TestSocketHelper < Test::Unit::TestCase diff --git a/test/unit/test_upload.rb b/test/unit/test_upload.rb index bcce4bc1..5de02e4a 100644 --- a/test/unit/test_upload.rb +++ b/test/unit/test_upload.rb @@ -1,7 +1,7 @@ # -*- encoding: binary -*- # Copyright (c) 2009 Eric Wong -require 'test/test_helper' +require './test/test_helper' require 'digest/md5' include Unicorn diff --git a/test/unit/test_util.rb b/test/unit/test_util.rb index 904d51cd..4d17a166 100644 --- a/test/unit/test_util.rb +++ b/test/unit/test_util.rb @@ -1,6 +1,6 @@ # -*- encoding: binary -*- -require 'test/test_helper' +require './test/test_helper' require 'tempfile' class TestUtil < Test::Unit::TestCase -- 2.11.4.GIT