1 # we can run tests in parallel with GNU make
6 rainbows_lib
:= $(shell cd ..
/lib
&& pwd
)
8 ifeq ($(RUBY_VERSION
),)
9 RUBY_VERSION
:= $(shell $(ruby
) -e
'puts RUBY_VERSION')
13 RUBYLIB
:= $(rainbows_lib
)
15 RUBYLIB
:= $(rainbows_lib
):$(RUBYLIB
)
19 T
= $(wildcard t
[0-9][0-9][0-9][0-9]-*.sh
)
23 # can't rely on "set -o pipefail" since we don't require bash or ksh93 :<
24 t_pfx
= trash
/$@
-$(RUBY_VERSION
)
25 t_code
= $(t_pfx
).code
27 # TRACER = strace -f -o $(t_pfx).strace -s 100000
28 # TRACER = /usr/bin/time -o $(t_pfx).time
29 t_run
= $(TRACER
) $(SHELL
) $(SH_TEST_OPTS
) $@
31 # prefix stdout messages with ':', and stderr messages with '!'
32 t_wrap
= ( ( ( echo
42 > $(t_code
); \
34 echo
$$?
> $(t_code
) ) \
35 | sed
's/^/$(pfx):/' 1>&3 ) 2>&1 \
36 | sed
's/^/$(pfx)!/' 1>&2 ) 3>&1
39 quiet_pre
= @echo
'* $@';
40 quiet_post
= > $(t_log
) 2>&1; exit
$$(cat
$(t_code
))
46 quiet_pre
= @echo
'* $@';
47 quiet_post
= 2>&1 | .
/bin
/utee
$(t_log
); exit
$$(cat
$(t_code
))
51 run_test
= $(quiet_pre
) ( $(t_wrap
) ) $(quiet_post
)
53 test-bin-
$(RUBY_VERSION
)/rainbows
: ruby_bin
= $(shell which
$(ruby
))
54 test-bin-
$(RUBY_VERSION
)/rainbows
: ..
/bin
/rainbows
57 $(ruby
) -i
-p
-e
'$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $@
+
58 cmp
$@
+ $@
2>/dev
/null || mv
$@
+ $@
61 req_random_blob
:= t3100-revactor-tee-input
63 dd if
=/dev
/urandom bs
=1M count
=10 of
=$@
+
66 $(addsuffix .sh
,$(req_random_blob
)): random_blob
68 $(T
): trash
/.gitignore
69 $(T
): export ruby
:= $(ruby
)
70 $(T
): export PATH
:= $(CURDIR
)/test-bin-
$(RUBY_VERSION
):$(PATH
)
71 $(T
): test-bin-
$(RUBY_VERSION
)/rainbows
79 $(RM
) -r trash
/*.log trash
/*.code test-bin-
$(RUBY_VERSION
)