Rules.mk 1.96 KB
Newer Older
1 2 3 4 5 6 7 8
include mk/header.mk

SHARNESS_$(d) = $(d)/lib/sharness/sharness.sh

T_$(d) = $(sort $(wildcard $(d)/t[0-9][0-9][0-9][0-9]-*.sh))

DEPS_$(d) := test/bin/random test/bin/multihash test/bin/pollEndpoint \
	   test/bin/iptb test/bin/go-sleep test/bin/random-files \
9 10
	   test/bin/go-timeout test/bin/hang-fds test/bin/ma-pipe-unidir \
	   test/bin/cid-fmt
11 12 13 14
DEPS_$(d) += cmd/ipfs/ipfs
DEPS_$(d) += $(d)/clean-test-results
DEPS_$(d) += $(SHARNESS_$(d))

15 16 17 18 19 20 21 22 23 24 25 26 27 28
ifeq ($(OS),Linux)
PLUGINS_DIR_$(d) := $(d)/plugins/
ORGIN_PLUGINS_$(d) := $(plugin/plugins_plugins_so)
PLUGINS_$(d) := $(addprefix $(PLUGINS_DIR_$(d)),$(notdir $(ORGIN_PLUGINS_$(d))))

$(PLUGINS_$(d)): $(ORGIN_PLUGINS_$(d))
	@mkdir -p $(@D)
	cp -f plugin/plugins/$(@F) $@

ifneq ($(TEST_NO_PLUGIN),1)
DEPS_$(d) += $(PLUGINS_$(d))
endif
endif

29 30 31 32
export MAKE_SKIP_PATH=1

$(T_$(d)): $$(DEPS_$(d)) # use second expansion so coverage can inject dependency
	@echo "*** $@ ***"
33 34 35
ifeq ($(CONTINUE_ON_S_FAILURE),1)
	-@(cd $(@D) && ./$(@F)) 2>&1
else
36
	@(cd $(@D) && ./$(@F)) 2>&1
37
endif
38 39 40 41 42 43 44
.PHONY: $(T_$(d))

$(d)/aggregate: $(T_$(d))
	@echo "*** $@ ***"
	@(cd $(@D) && ./lib/test-aggregate-results.sh)
.PHONY: $(d)/aggregate

Łukasz Magiera's avatar
Łukasz Magiera committed
45 46 47
$(d)/test-results/sharness.xml: export TEST_GENERATE_JUNIT=1
$(d)/test-results/sharness.xml: test_sharness_expensive
	@echo "*** $@ ***"
48
	@(cd $(@D)/.. && ./lib/gen-junit-report.sh)
Łukasz Magiera's avatar
Łukasz Magiera committed
49

50 51 52 53 54 55 56 57 58
$(d)/clean-test-results:
	rm -rf $(@D)/test-results
.PHONY: $(d)/clean-test-results

CLEAN += $(wildcard $(d)/test-results/*)

$(SHARNESS_$(d)): $(d) ALWAYS
	@clonedir=$(dir $(@D)) $</lib/install-sharness.sh

59 60 61 62
$(d)/deps: $(SHARNESS_$(d)) $$(DEPS_$(d)) # use second expansion so coverage can inject dependency
.PHONY: $(d)/deps

test_sharness_deps: $(d)/deps
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
.PHONY: test_sharness_deps

test_sharness_short: $(d)/aggregate
.PHONY: test_sharness_short


test_sharness_expensive: export TEST_EXPENSIVE=1
test_sharness_expensive: test_sharness_short
.PHONY: test_sharness_expensive

TEST += test_sharness_expensive
TEST_SHORT += test_sharness_short


include mk/footer.mk