1 # we can run tests in parallel with GNU make
4 pid
:= $(shell echo
$$PPID)
9 ifeq ($(RUBY_VERSION
),)
10 RUBY_VERSION
:= $(shell $(RUBY
) -e
'puts RUBY_VERSION')
13 ifeq ($(RUBY_VERSION
),)
14 $(error unable to detect RUBY_VERSION
)
17 RUBY_ENGINE
:= $(shell $(RUBY
) -e
'puts((RUBY_ENGINE rescue "ruby"))')
22 T
= $(wildcard t
[0-9][0-9][0-9][0-9]-*.sh
)
26 # can't rely on "set -o pipefail" since we don't require bash or ksh93 :<
27 t_pfx
= trash
/$@
-$(RUBY_ENGINE
)-$(RUBY_VERSION
)
29 # TRACER = strace -f -o $(t_pfx).strace -s 100000
30 # TRACER = /usr/bin/time -o $(t_pfx).time
36 TEST_OPTS
+= --verbose
41 dd if
=/dev
/urandom bs
=1M count
=30 of
=$@.
$(pid
)
46 dependencies
:= socat curl
47 deps
:= $(addprefix .dep
+,$(dependencies
))
48 $(deps
): dep_bin
= $(lastword
$(subst +, ,$@
))
50 @which
$(dep_bin
) > $@.
$(pid
) 2>/dev
/null ||
:
51 @
test -s
$@.
$(pid
) || \
52 { echo
>&2 "E '$(dep_bin)' not found in PATH=$(PATH)"; exit
1; }
56 test_prefix
:= $(CURDIR
)/..
/test/$(RUBY_ENGINE
)-$(RUBY_VERSION
)
57 $(test_prefix
)/.stamp
:
58 $(MAKE
) -C .. test-install
60 $(T
): export RUBY
:= $(RUBY
)
61 $(T
): export RAKE
:= $(RAKE
)
62 $(T
): export PATH
:= $(test_prefix
)/bin
:$(PATH
)
63 $(T
): export RUBYLIB
:= $(test_prefix
)/lib
:$(MYLIBS
)
64 $(T
): dep
$(test_prefix
)/.stamp trash
/.gitignore
65 $(TRACER
) $(SHELL
) $(SH_TEST_OPTS
) $@
$(TEST_OPTS
)