From dac42b86497e98d5f184d4c40ddc4ca718383403 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 6 Feb 2015 22:17:26 +0000 Subject: 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 [fixed test/unit/test_http_parser_xftrust.rb for backport] --- 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_http_parser_xftrust.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 +- 12 files changed, 18 insertions(+), 14 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 6dddf6c..7cf1023 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) @@ -115,14 +119,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 10a1bae..6deb96b 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 2251dcf..431ede5 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 ab335ac..4f13c9a 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_http_parser_xftrust.rb b/test/unit/test_http_parser_xftrust.rb index db8cfa9..8d0cc37 100644 --- a/test/unit/test_http_parser_xftrust.rb +++ b/test/unit/test_http_parser_xftrust.rb @@ -1,5 +1,5 @@ # -*- encoding: binary -*- -require 'test/test_helper' +require './test/test_helper' include Unicorn diff --git a/test/unit/test_request.rb b/test/unit/test_request.rb index fbda1a2..f0ccaf7 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 f33431b..10b247b 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 9c92bab..8b3afad 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 443c736..4592819 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 7135928..7722049 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 bcce4bc..5de02e4 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 904d51c..4d17a16 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 -- cgit v1.2.3-24-ge0c7