KNOWN_ISSUES: fix error in isolate example :x
[unicorn.git] / t / GNUmakefile
blob20e5b6e8759565a2ff0076b4f02e86e814cf5afe
1 # we can run tests in parallel with GNU make
2 all::
4 pid := $(shell echo $$PPID)
6 RUBY = ruby
7 -include ../local.mk
8 ifeq ($(RUBY_VERSION),)
9 RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
10 endif
12 ifeq ($(RUBY_VERSION),)
13 $(error unable to detect RUBY_VERSION)
14 endif
16 T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
18 all:: $(T)
20 # can't rely on "set -o pipefail" since we don't require bash or ksh93 :<
21 t_pfx = trash/$@-$(RUBY_VERSION)
22 TEST_OPTS =
23 # TRACER = strace -f -o $(t_pfx).strace -s 100000
24 # TRACER = /usr/bin/time -o $(t_pfx).time
26 ifdef V
27 ifeq ($(V),2)
28 TEST_OPTS += --trace
29 else
30 TEST_OPTS += --verbose
31 endif
32 endif
34 random_blob:
35 dd if=/dev/urandom bs=1M count=30 of=$@.$(pid)
36 mv $@.$(pid) $@
38 $(T): random_blob
40 dependencies := socat curl
41 deps := $(addprefix .dep+,$(dependencies))
42 $(deps): dep_bin = $(lastword $(subst +, ,$@))
43 $(deps):
44 @which $(dep_bin) > $@.$(pid) 2>/dev/null || :
45 @test -s $@.$(pid) || \
46 { echo >&2 "E '$(dep_bin)' not found in PATH=$(PATH)"; exit 1; }
47 @mv $@.$(pid) $@
48 dep: $(deps)
50 test_prefix := $(CURDIR)/../test/install-$(RUBY_VERSION)
51 $(test_prefix)/.stamp:
52 $(MAKE) -C .. test-install
54 $(T): export RUBY := $(RUBY)
55 $(T): export PATH := $(test_prefix)/bin:$(PATH)
56 $(T): export RUBYLIB := $(test_prefix)/lib:$(RUBYLIB)
57 $(T): dep $(test_prefix)/.stamp trash/.gitignore
58 $(TRACER) $(SHELL) $(SH_TEST_OPTS) $@ $(TEST_OPTS)
60 trash/.gitignore:
61 mkdir -p $(@D)
62 echo '*' > $@
64 clean:
65 $(RM) -r trash/*
67 .PHONY: $(T) clean