-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (51 loc) · 1.29 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Copyright (C) 2015 Craig Phillips. All rights reserved.
all:
@true
verbose:
@true
debug:
@true
export BUILDROOT:= $(shell readlink -m BUILDROOT)
export PATH:= $(shell readlink -f bin):$(PATH)
SILENT:= $(if $(filter verbose,$(MAKECMDGOALS)),,@)
DEBUG:= $(if $(filter debug,$(MAKECMDGOALS)),1,)
ifneq (,$(SILENT))
define fn_silent
( t=`mktemp` ; \
e=0 ; \
if ! ( $1 ) 1>$$t.out 2>$$t.err ; then \
e=1 ; \
cat $$t.err ; \
fi ; \
rm -f $$t.* ; \
exit $$e ; )
endef
else
define fn_silent
( t=`mktemp` ; \
e=0 ; \
( $1 ) 1>$$t.out 2>&1 || e=$$? ; \
cat $$t.out ; \
rm -f $$t.* ; \
exit $$e ; )
endef
endif
V:= $(if $(SILENT),,-v)
tests:= $(wildcard tests/*/test.sh)
run_test_targets:= $(tests:tests/%/test.sh=run_test_%)
run_tests: $(run_test_targets)
junit.xml: $(BUILDROOT)/junit.xml $(if $(CIRCLE_TEST_REPORTS),$(CIRCLE_TEST_REPORTS)/junit.xml)
$(CIRCLE_TEST_REPORTS)/junit.xml: $(BUILDROOT)/junit.xml
@rm -f $@
@cp $V $< $@
$(BUILDROOT)/junit.xml: $(run_test_targets)
@rm -f $@
@bash tests/generate_junit.sh >$@
clean_pyc:
@find bin lib -name '*.pyc' -exec rm $V -f {} \;
clean: clean_pyc
@rm $V -rf $(BUILDROOT)
$(run_test_targets): run_test_% : tests/%/test.sh
@$(call fn_silent,echo "Running test $*")
@rm $V -rf $(BUILDROOT)/$*
@TEST_DEBUG=$(DEBUG) bash tests/run_test.sh $*