diff options
author | Philip Withnall <philip@tecnocode.co.uk> | 2009-08-20 22:53:21 +0100 |
---|---|---|
committer | Philip Withnall <philip@tecnocode.co.uk> | 2009-12-29 00:01:17 +0000 |
commit | 30728e6de85c13f3839e36a7bc4c92551a3c9a25 (patch) | |
tree | 7da77e31d1dd6fd7a9cf6d054ad75be55ca2c8eb /gtester.mk | |
parent | ab9dc1cc20a61895f6d674018de3ade6cc515108 (diff) | |
download | libgdata-30728e6de85c13f3839e36a7bc4c92551a3c9a25.tar.gz |
[build] Reorganised to use non-recursive automake and added gcov support
Reorganised to use non-recursive automake for everything except API
documentation and translations. As a consequence of this reorganisation, two
private header files which were mistakenly installed before are no longer
installed (this will not be considered an API break). The introspection and
gtester include files have been updated.
Support for code coverage checking for the test suite has been added too,
using gcov. It can be invoked by `make gcov`, and will output a file called
"gcov-report.txt" in the main source directory with the results of the
checks.
Diffstat (limited to 'gtester.mk')
-rw-r--r-- | gtester.mk | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/gtester.mk b/gtester.mk new file mode 100644 index 00000000..13061933 --- /dev/null +++ b/gtester.mk @@ -0,0 +1,60 @@ +# GLIB - Library of useful C routines +# From http://git.gnome.org/browse/glib/tree/Makefile.decl + +GTESTER = gtester +GTESTER_REPORT = gtester-report + +# initialize variables for unconditional += appending +EXTRA_DIST = +TEST_PROGS = + +### testing rules + +# test: run all tests in cwd and subdirs +test: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} + @ for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done + +# test-report: run tests in subdirs 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 +test-report perf-report full-report: ${TEST_PROGS} + @test -z "${TEST_PROGS}" || { \ + case $@ in \ + test-report) test_options="-k";; \ + perf-report) test_options="-k -m=perf";; \ + full-report) test_options="-k -m=perf -m=slow";; \ + esac ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \ + elif test -n "${TEST_PROGS}" ; then \ + ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \ + fi ; \ + } + @ ignore_logdir=true ; \ + if test -z "$$GTESTER_LOGDIR" ; then \ + GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \ + ignore_logdir=false ; \ + fi ; \ + for subdir in $(SUBDIRS) . ; do \ + test "$$subdir" = "." -o "$$subdir" = "po" || \ + ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ + done ; \ + $$ignore_logdir || { \ + echo '<?xml version="1.0"?>' > $@.xml ; \ + echo '<report-collection>' >> $@.xml ; \ + for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \ + sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \ + done ; \ + echo >> $@.xml ; \ + echo '</report-collection>' >> $@.xml ; \ + rm -rf "$$GTESTER_LOGDIR"/ ; \ + ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \ + } +.PHONY: test test-report perf-report full-report +# run make test as part of make check +check-local: test + |