summaryrefslogtreecommitdiff
path: root/test/Makefile.am
blob: 372f42bb0edc025feaaddc54c62f5ade29480e39 (plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
SUBDIRS = unit system regress .

MAKEFLAGS = -k

.PHONY: units systemtests regress regress0 regress1 regress2 regress3 regress4
units systemtests regress regress0 regress1 regress2 regress3 regress4:
	@$(MAKE) check-pre; \
	for dir in $(SUBDIRS); do \
		test $$dir = . || (cd $$dir && $(MAKE) $(AM_MAKEFLAGS) $@); \
	done; \
	$(MAKE) check-local

# synonyms for "check" in this directory
.PHONY: test
test: check

am__tty_colors = \
red=; grn=; lgn=; blu=; mag=; std=; \
test "X$(AM_COLOR_TESTS)" != Xno \
&& test "X$$TERM" != Xdumb \
&& { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \
&& { \
  red=''; \
  grn=''; \
  lgn=''; \
  blu=''; \
  mag=''; \
  std=''; \
}

subdirs_to_check = \
	system \
	unit

check-recursive: check-pre
.PHONY: check-pre
check-pre:
	@rm -f $(subdirs_to_check:=/test-suite.log)
	@find regress -name '*.trs' -exec rm {} \;

if HAVE_CXXTESTGEN
HANDLE_UNIT_TEST_SUMMARY = \
	if test -s "unit/test-suite.log"; then :; else \
		echo "$${red}Unit tests did not run; maybe there were compilation problems ?$$std"; \
	fi
else
HANDLE_UNIT_TEST_SUMMARY = \
	echo "$${mag}Unit tests not supported, since CxxTest wasn't found$$std"; \
	rm -f "unit/test-suite.log"
endif

if AUTOMAKE_1_11
# automake 1.11 version
check-local:
	@$(am__tty_colors); \
	echo $${blu}===============================  TESTING SUMMARY  =============================$$std; \
	$(HANDLE_UNIT_TEST_SUMMARY); \
	if test -s "system/test-suite.log"; then :; else \
		echo "$${red}System tests did not run; maybe there were compilation problems ?$$std"; \
	fi; \
	echo $${red}Upgrade to a newer version of Automake to get a more detailed summary; \
	echo $${blu}===============================  TESTING SUMMARY  =============================$$std
else
# automake 1.12 version
check-local:
	@$(am__tty_colors); \
	echo $${blu}===============================  TESTING SUMMARY  =============================$$std; \
	$(HANDLE_UNIT_TEST_SUMMARY); \
	if test -s "system/test-suite.log"; then :; else \
		echo "$${red}System tests did not run; maybe there were compilation problems ?$$std"; \
	fi; \
	for dir in $(subdirs_to_check); do \
		log=$$dir/test-suite.log; \
		if test -s "$$log"; then \
			status="`head -n 11 $$log | tail -7`"; \
			nicestatus="`echo $$status | sed 's/# [A-Z]*: 0 *//g;s/# \([A-Z]*\): \([0-9]*\)/\2 \1,/g;s/, *$$//;'`"; \
			if	echo "$$status" | grep -q '# FAIL:  0' && \
				echo "$$status" | grep -q '# XPASS: 0' && \
				echo "$$status" | grep -q '# ERROR: 0' && \
				echo "$$status" | grep -q '# SKIP:  0'; then \
				printf "$$grn%-30s in $$dir$$std\\n" "$$nicestatus"; \
			else \
				echo "$$red$$nicestatus"; \
				echo "    @abs_builddir@/$$log$$std"; \
			fi; \
		fi; \
	done; \
	for dir in `find regress -maxdepth 2 -not -empty -type d | sort`; do \
		if [[ "$$dir" =~ .*regress[0-4]$$ ]]; then \
			status_info=`grep -d skip ":test-result: " $$dir/*`; \
		else \
			status_info=`grep -r ":test-result: " $$dir`; \
		fi; \
		total=`echo "$$status_info" | grep ":test-result: " | wc -l`; \
		if [ $$total -ne 0 ]; then \
			status="$${std}$$total TOTAL"; \
			pass=`echo "$$status_info" | grep " PASS" | wc -l`; \
			if [ $$pass -ne 0 ]; then \
				status="$$status $${grn}$$pass PASS"; \
			fi; \
			fail=`echo "$$status_info" | grep " FAIL" | wc -l`; \
			if [ $$fail -ne 0 ]; then \
				status="$$status $${red}$$fail FAIL"; \
			fi; \
			xpass=`echo "$$status_info" | grep " XPASS" | wc -l`; \
			if [ $$xpass -ne 0 ]; then \
				status="$$status $${red}$$xpass XPASS"; \
			fi; \
			error=`echo "$$status_info" | grep " ERROR" | wc -l`; \
			if [ $$error -ne 0 ]; then \
				status="$$status $${red}$$error ERROR"; \
			fi; \
			skip=`echo "$$status_info" | grep " SKIP" | wc -l`; \
			if [ $$skip -ne 0 ]; then \
				status="$$status $${blu}$$skip SKIP"; \
			fi; \
			printf "$$grn%-30s in $$dir\\n" "$$status"; \
		fi; \
	done; \
	echo $${blu}===============================  TESTING SUMMARY  =============================$$std
endif
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback