1 # GLIB - Library of useful C routines
3 GTESTER = gtester # for non-GLIB packages
4 GTESTER_REPORT = gtester-report # for the GLIB package
6 # initialize variables for unconditional += appending
12 # test: run all tests in cwd and subdirs
13 test: test-nonrecursive
14 @ for subdir in $(SUBDIRS) . ; do \
15 test "$$subdir" = "." -o "$$subdir" = "po" || \
16 ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
19 # test-nonrecursive: run tests only in cwd
20 test-nonrecursive: ${TEST_PROGS}
21 @test -z "${TEST_PROGS}" || ${TEST_ENVIRONMENT} ${GTESTER} --verbose ${TEST_PROGS}
23 # test-report: run tests in subdirs and generate report
24 # perf-report: run tests in subdirs with -m perf and generate report
25 # full-report: like test-report: with -m perf and -m slow
26 test-report perf-report full-report: ${TEST_PROGS}
27 @test -z "${TEST_PROGS}" || { \
29 test-report) test_options="-k";; \
30 perf-report) test_options="-k -m=perf";; \
31 full-report) test_options="-k -m=perf -m=slow";; \
33 if test -z "$$GTESTER_LOGDIR" ; then \
34 ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
35 elif test -n "${TEST_PROGS}" ; then \
36 ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
39 @ ignore_logdir=true ; \
40 if test -z "$$GTESTER_LOGDIR" ; then \
41 GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
42 ignore_logdir=false ; \
44 if test -d "$(top_srcdir)/.git" ; then \
45 REVISION=`git describe` ; \
47 REVISION=$(VERSION) ; \
49 for subdir in $(SUBDIRS) . ; do \
50 test "$$subdir" = "." -o "$$subdir" = "po" || \
51 ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
53 $$ignore_logdir || { \
54 echo '<?xml version="1.0"?>' > $@.xml ; \
55 echo '<report-collection>' >> $@.xml ; \
56 echo '<info>' >> $@.xml ; \
57 echo ' <package>$(PACKAGE)</package>' >> $@.xml ; \
58 echo ' <version>$(VERSION)</version>' >> $@.xml ; \
59 echo " <revision>$$REVISION</revision>" >> $@.xml ; \
60 echo '</info>' >> $@.xml ; \
61 for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
62 sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
65 echo '</report-collection>' >> $@.xml ; \
66 rm -rf "$$GTESTER_LOGDIR"/ ; \
67 ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
69 .PHONY: test test-report perf-report full-report test-nonrecursive
71 .PHONY: lcov genlcov lcov-clean
72 # use recursive makes in order to ignore errors during check
74 find $(top_builddir) -name '*.gcda' -delete
75 -$(MAKE) $(AM_MAKEFLAGS) -k check
76 $(MAKE) $(AM_MAKEFLAGS) genlcov
79 $(LTP) --directory $(top_builddir) --capture --output-file glib-lcov.info --test-name GLIB_PERF --no-checksum --compat-libtool
80 LANG=C $(LTP_GENHTML) --prefix $(top_builddir) --output-directory glib-lcov --title "GLib Code Coverage" --legend --show-details glib-lcov.info
83 -$(LTP) --directory $(top_builddir) -z
84 -rm -rf glib-lcov.info glib-lcov
85 -find -name '*.gcda' -print | xargs rm
87 # run tests in cwd as part of make check
88 check-local: test-nonrecursive