gtester: Run tests only once on 'make check'

The gtester makefile runs 'make test' on 'make check' and also recurses
on 'make test'.  automake recurses on 'make check'.

This means that every level of recursive make that we go through results
in the tests running twice as many times.  If you type 'make check' at
the toplevel, for example, tests in gio/tests/ run 4 times.

Fix that by introducing a 'test-nonrecursive' target and using that one
from 'make check'.  'make test', 'make test-report', etc. are still
recursive.
This commit is contained in:
Ryan Lortie 2010-08-06 15:28:58 -04:00
parent b91f9274d9
commit d96b7c5c8a

View File

@ -11,15 +11,20 @@ TEST_PROGS =
### testing rules ### testing rules
# test: run all tests in cwd and subdirs # test: run all tests in cwd and subdirs
test: ${TEST_PROGS} test: test-nonrecursive
if OS_UNIX if OS_UNIX
@test -z "${TEST_PROGS}" || MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) ${GTESTER} --verbose ${TEST_PROGS}
@ for subdir in $(SUBDIRS) . ; do \ @ for subdir in $(SUBDIRS) . ; do \
test "$$subdir" = "." -o "$$subdir" = "po" || \ test "$$subdir" = "." -o "$$subdir" = "po" || \
( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
done done
endif endif
# test-nonrecursive: run tests only in cwd
test-nonrecursive: ${TEST_PROGS}
if OS_UNIX
@test -z "${TEST_PROGS}" || MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) ${GTESTER} --verbose ${TEST_PROGS}
endif
# test-report: run tests in subdirs and generate report # test-report: run tests in subdirs and generate report
# perf-report: run tests in subdirs with -m perf and generate report # perf-report: run tests in subdirs with -m perf and generate report
# full-report: like test-report: with -m perf and -m slow # full-report: like test-report: with -m perf and -m slow
@ -60,7 +65,7 @@ test-report perf-report full-report: ${TEST_PROGS}
rm -rf "$$GTESTER_LOGDIR"/ ; \ rm -rf "$$GTESTER_LOGDIR"/ ; \
${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \ ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
} }
.PHONY: test test-report perf-report full-report .PHONY: test test-report perf-report full-report test-nonrecursive
.PHONY: lcov genlcov lcov-clean .PHONY: lcov genlcov lcov-clean
# use recursive makes in order to ignore errors during check # use recursive makes in order to ignore errors during check
@ -83,5 +88,5 @@ lcov-clean:
-rm -rf glib-lcov.info glib-lcov -rm -rf glib-lcov.info glib-lcov
-find -name '*.gcda' -print | xargs rm -find -name '*.gcda' -print | xargs rm
# run make test as part of make check # run tests in cwd as part of make check
check-local: test check-local: test-nonrecursive