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 isolate_libs
:= ..
/tmp
/isolate
/$(RUBY_ENGINE
)-$(RUBY_VERSION
).mk
21 $(isolate_libs
): ..
/script
/isolate_for_tests
22 @cd ..
&& $(RUBY
) script
/isolate_for_tests
23 -include $(isolate_libs
)
24 MYLIBS
:= $(RUBYLIB
):$(ISOLATE_LIBS
)
26 T
= $(wildcard t
[0-9][0-9][0-9][0-9]-*.sh
)
30 # can't rely on "set -o pipefail" since we don't require bash or ksh93 :<
31 t_pfx
= trash
/$@
-$(RUBY_ENGINE
)-$(RUBY_VERSION
)
33 # TRACER = strace -f -o $(t_pfx).strace -s 100000
34 # TRACER = /usr/bin/time -o $(t_pfx).time
40 TEST_OPTS
+= --verbose
45 dd if
=/dev
/urandom bs
=1M count
=30 of
=$@.
$(pid
)
52 $(T
): random_blob ssl-stamp
54 dependencies
:= socat curl
55 deps
:= $(addprefix .dep
+,$(dependencies
))
56 $(deps
): dep_bin
= $(lastword
$(subst +, ,$@
))
58 @which
$(dep_bin
) > $@.
$(pid
) 2>/dev
/null ||
:
59 @
test -s
$@.
$(pid
) || \
60 { echo
>&2 "E '$(dep_bin)' not found in PATH=$(PATH)"; exit
1; }
64 test_prefix
:= $(CURDIR
)/..
/test/$(RUBY_ENGINE
)-$(RUBY_VERSION
)
65 $(test_prefix
)/.stamp
:
66 $(MAKE
) -C .. test-install
68 $(T
): export RUBY
:= $(RUBY
)
69 $(T
): export RAKE
:= $(RAKE
)
70 $(T
): export PATH
:= $(test_prefix
)/bin
:$(PATH
)
71 $(T
): export RUBYLIB
:= $(test_prefix
)/lib
:$(MYLIBS
)
72 $(T
): dep
$(test_prefix
)/.stamp trash
/.gitignore
73 $(TRACER
) $(SHELL
) $(SH_TEST_OPTS
) $@
$(TEST_OPTS
)