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