master
mk 71 lines 1.76 KB
Raw
1 include mk/header.mk
2
3 SHARNESS_$(d) = $(d)/lib/sharness/sharness.sh
4
5 T_$(d) = $(sort $(wildcard $(d)/t[0-9][0-9][0-9][0-9]-*.sh))
6
7 DEPS_$(d) := test/bin/multihash test/bin/pollEndpoint test/bin/iptb \
8 test/bin/go-sleep test/bin/random-data test/bin/random-files \
9 test/bin/go-timeout test/bin/hang-fds test/bin/ma-pipe-unidir \
10 test/bin/cid-fmt
11 DEPS_$(d) += cmd/ipfs/ipfs
12 DEPS_$(d) += $(d)/clean-test-results
13 DEPS_$(d) += $(SHARNESS_$(d))
14
15 ifeq ($(OS),Linux)
16 PLUGINS_DIR_$(d) := $(d)/plugins/
17 ORIGIN_PLUGINS_$(d) := $(plugin/plugins_plugins_so)
18 PLUGINS_$(d) := $(addprefix $(PLUGINS_DIR_$(d)),$(notdir $(ORIGIN_PLUGINS_$(d))))
19
20 $(PLUGINS_$(d)): $(ORIGIN_PLUGINS_$(d))
21 @mkdir -p $(@D)
22 cp -f plugin/plugins/$(@F) $@
23
24 ifneq ($(TEST_PLUGIN),0)
25 DEPS_$(d) += $(PLUGINS_$(d))
26 endif
27 endif
28
29 export MAKE_SKIP_PATH=1
30
31 $(T_$(d)): $$(DEPS_$(d)) # use second expansion so coverage can inject dependency
32 @echo "*** $@ ***"
33 ifeq ($(CONTINUE_ON_S_FAILURE),1)
34 -@(cd $(@D) && ./$(@F)) 2>&1
35 else
36 @(cd $(@D) && ./$(@F)) 2>&1
37 endif
38 .PHONY: $(T_$(d))
39
40 $(d)/aggregate: $(T_$(d))
41 @echo "*** $@ ***"
42 @(cd $(@D) && ./lib/test-aggregate-results.sh)
43 .PHONY: $(d)/aggregate
44
45 $(d)/test-results/sharness.xml: $(T_$(d))
46 @echo "*** $@ ***"
47 @(cd $(@D)/.. && ./lib/test-aggregate-junit-reports.sh)
48 .PHONY: $(d)/test-results/sharness.xml
49
50 $(d)/clean-test-results:
51 rm -rf $(@D)/test-results
52 .PHONY: $(d)/clean-test-results
53
54 CLEAN += $(wildcard $(d)/test-results/*)
55
56 $(SHARNESS_$(d)): $(d) ALWAYS
57 @clonedir=$(dir $(@D)) $</lib/install-sharness.sh
58
59 $(d)/deps: $(SHARNESS_$(d)) $$(DEPS_$(d)) # use second expansion so coverage can inject dependency
60 .PHONY: $(d)/deps
61
62 test_sharness_deps: $(d)/deps
63 .PHONY: test_sharness_deps
64
65 test_sharness: $(d)/aggregate
66 .PHONY: test_sharness
67
68 TEST += test_sharness
69
70
71 include mk/footer.mk