chiark / gitweb /
dgit: Crash if we forgot to set $do_split_brain
[dgit.git] / tests / Makefile
1 # usage: tests/using-intree make -f tests/Makefile
2 # optionally setting
3 #   TESTSCRIPTS='tests/tests/foo tests/tests/bar')
4 #   DGIT_TEST_RETRY_COUNT=<a smallish integer>
5
6 TESTSCRIPTS ?= $(shell tests/enumerate-tests)
7 TESTNAMES := $(notdir $(TESTSCRIPTS))
8
9 all: $(foreach t,$(TESTNAMES),tests/tmp/$t.ok)
10         @echo "ALL PASSED$${DGIT_TESTS_PROGRESSIVE+ AT SOME POINT}"
11
12 tests/tmp/%.ok: tests/tests/%
13 ifeq ($(DGIT_TEST_RETRY_COUNT),)
14         $(DGIT_TEST_RUN_PFX) tests/tests/$* >tests/tmp/$*.log 2>&1
15 else
16         @for retry in $$( seq 1 $(DGIT_TEST_RETRY_COUNT) ); do          \
17                 echo "[$$retry] $*";                                    \
18         $(DGIT_TEST_RUN_PFX) tests/tests/$* >tests/tmp/$*.$$retry.log 2>&1; \
19                 rc=$$?;                                                 \
20                 if [ $$rc = 0 ]; then exit 0; fi;                       \
21                 echo >&2 "[$$retry] $* TEST FAILED $$rc";               \
22         done; exit $$rc
23 endif
24         @touch $@