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"))')
20 T
= $(wildcard t
[0-9][0-9][0-9][0-9]-*.sh
)
24 # can't rely on "set -o pipefail" since we don't require bash or ksh93 :<
25 t_pfx
= trash
/$@
-$(RUBY_ENGINE
)-$(RUBY_VERSION
)
27 # TRACER = strace -f -o $(t_pfx).strace -s 100000
28 # TRACER = /usr/bin/time -o $(t_pfx).time
34 TEST_OPTS
+= --verbose
39 dd if
=/dev
/urandom bs
=1M count
=30 of
=$@.
$(pid
)
44 dependencies
:= socat curl
45 deps
:= $(addprefix .dep
+,$(dependencies
))
46 $(deps
): dep_bin
= $(lastword
$(subst +, ,$@
))
48 @which
$(dep_bin
) > $@.
$(pid
) 2>/dev
/null ||
:
49 @
test -s
$@.
$(pid
) || \
50 { echo
>&2 "E '$(dep_bin)' not found in PATH=$(PATH)"; exit
1; }
54 test_prefix
:= $(CURDIR
)/..
/test/$(RUBY_ENGINE
)-$(RUBY_VERSION
)
55 $(test_prefix
)/.stamp
:
56 $(MAKE
) -C .. test-install
58 $(T
): export RUBY
:= $(RUBY
)
59 $(T
): export RAKE
:= $(RAKE
)
60 $(T
): export PATH
:= $(test_prefix
)/bin
:$(PATH
)
61 $(T
): export RUBYLIB
:= $(test_prefix
)/lib
:$(RUBYLIB
)
62 $(T
): dep
$(test_prefix
)/.stamp trash
/.gitignore
63 $(TRACER
) $(SHELL
) $(SH_TEST_OPTS
) $@
$(TEST_OPTS
)