diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-02-17 18:53:52 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-02-17 18:53:52 -0800 |
commit | 5cef71dc6c640db414c41f59a5016fd3f5326bf9 (patch) | |
tree | 500cd48b0d92ba8b847ce6839d6889d5304fa11b /t/GNUmakefile | |
parent | 13598f977ec3b707bd1a8f2abb99825cb8f85b58 (diff) | |
download | unicorn-5cef71dc6c640db414c41f59a5016fd3f5326bf9.tar.gz |
Diffstat (limited to 't/GNUmakefile')
-rw-r--r-- | t/GNUmakefile | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/t/GNUmakefile b/t/GNUmakefile new file mode 100644 index 0000000..20e5b6e --- /dev/null +++ b/t/GNUmakefile @@ -0,0 +1,67 @@ +# we can run tests in parallel with GNU make +all:: + +pid := $(shell echo $$PPID) + +RUBY = ruby +-include ../local.mk +ifeq ($(RUBY_VERSION),) + RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION') +endif + +ifeq ($(RUBY_VERSION),) + $(error unable to detect RUBY_VERSION) +endif + +T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh) + +all:: $(T) + +# can't rely on "set -o pipefail" since we don't require bash or ksh93 :< +t_pfx = trash/$@-$(RUBY_VERSION) +TEST_OPTS = +# TRACER = strace -f -o $(t_pfx).strace -s 100000 +# TRACER = /usr/bin/time -o $(t_pfx).time + +ifdef V + ifeq ($(V),2) + TEST_OPTS += --trace + else + TEST_OPTS += --verbose + endif +endif + +random_blob: + dd if=/dev/urandom bs=1M count=30 of=$@.$(pid) + mv $@.$(pid) $@ + +$(T): random_blob + +dependencies := socat curl +deps := $(addprefix .dep+,$(dependencies)) +$(deps): dep_bin = $(lastword $(subst +, ,$@)) +$(deps): + @which $(dep_bin) > $@.$(pid) 2>/dev/null || : + @test -s $@.$(pid) || \ + { echo >&2 "E '$(dep_bin)' not found in PATH=$(PATH)"; exit 1; } + @mv $@.$(pid) $@ +dep: $(deps) + +test_prefix := $(CURDIR)/../test/install-$(RUBY_VERSION) +$(test_prefix)/.stamp: + $(MAKE) -C .. test-install + +$(T): export RUBY := $(RUBY) +$(T): export PATH := $(test_prefix)/bin:$(PATH) +$(T): export RUBYLIB := $(test_prefix)/lib:$(RUBYLIB) +$(T): dep $(test_prefix)/.stamp trash/.gitignore + $(TRACER) $(SHELL) $(SH_TEST_OPTS) $@ $(TEST_OPTS) + +trash/.gitignore: + mkdir -p $(@D) + echo '*' > $@ + +clean: + $(RM) -r trash/* + +.PHONY: $(T) clean |