tests: do not assume "." is in $LOAD_PATH anymore
[ruby-mogilefs-client.git] / GNUmakefile
blobee9c647640347f92de94dc03d7b039740ab21e58
1 # use GNU Make to run tests in parallel, and without depending on Rubygems
2 all:: test
4 T := $(wildcard test/test*.rb)
5 TO := $(subst .rb,.log,$(T))
7 test: $(T)
8 @cat $(TO) | ruby test/aggregate.rb
9 @$(RM) $(TO)
10 clean:
11 $(RM) $(TO) $(addsuffix +,$(TO))
14 ifndef V
15 quiet_pre = @echo '* $@';
16 quiet_post = >$(t) 2>&1
17 else
18 # we can't rely on -o pipefail outside of bash 3+,
19 # so we use a stamp file to indicate success and
20 # have rm fail if the stamp didn't get created
21 stamp = $@$(log_suffix).ok
22 quiet_pre = @echo $(ruby) $@ $(TEST_OPTS); ! test -f $(stamp) && (
23 quiet_post = && > $(stamp) )>&2 | tee $(t); rm $(stamp) 2>/dev/null
24 endif
25 ruby = ruby
26 run_test = $(quiet_pre) setsid $(ruby) -w $@ $(TEST_OPTS) $(quiet_post) || \
27 (sed "s,^,$(extra): ," >&2 < $(t); exit 1)
29 $(T): t = $(subst .rb,.log,$@)
30 $(T): export RUBYLIB := $(CURDIR)/lib:$(RUBYLIB)
31 $(T):
32 $(run_test)
34 # using make instead of rake since Rakefile takes too long to load
35 manifest: Manifest.txt
36 Manifest.txt:
37 git ls-files > $@+
38 cmp $@+ $@ || mv $@+ $@
39 $(RM) -f $@+
41 package: manifest
42 git diff --exit-code HEAD^0
43 $(RM) -r pkg/
44 rake fix_perms
45 rake package
47 libs := $(wildcard lib/*.rb lib/*/*.rb)
48 flay_flags =
49 flog_flags =
50 flay: $(libs)
51 flay $(flay_flags) $^
52 flog: $(libs)
53 flog $(flog_flags) $^
54 .PHONY: $(T) Manifest.txt