summaryrefslogtreecommitdiff
path: root/mk/mkc.minitest.mk
blob: e62be8ab790cc28046a86f3a4d6ab1dd088e238c (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
# Copyright (c) 2009-2013 by Aleksey Cheusov
#
# See LICENSE file in the distribution.
############################################################

TEST_PREREQS ?= all

.PHONY : test
test: ${TEST_PREREQS}
	@echo 'Testing ${.CURDIR}... ' 1>&2; \
	set -e; cd ${.CURDIR}; \
	tmp_out=${.OBJDIR}/${.CURDIR:T}.test.out; \
	${RM} -f $$tmp_out; \
	${MAKE} ${MAKEFLAGS} test_output > $$tmp_out.tmp; \
	mv $$tmp_out.tmp $$tmp_out; \
	if test -f ${.CURDIR}/expect.${OPSYS}.out; then \
		expect=${.CURDIR}/expect.${OPSYS}.out; \
	else \
		expect=${.CURDIR}/expect.out; \
	fi; \
	diff $$expect $$tmp_out && \
	echo '      succeeded' 1>&2 || \
	{ echo '      FAILED' 1>&2; false; }

CLEANFILES   +=		${.OBJDIR}/${.CURDIR:T}.test.out
#DISTCLEANFILES+=	${.OBJDIR}/${.CURDIR:T}.test.out.tmp