1 # GLIB - Library of useful C routines
3 #GTESTER = gtester # for non-GLIB packages
4 GTESTER = $(top_builddir)/glib/gtester # for the GLIB package
5 GTESTER_REPORT = $(top_builddir)/glib/gtester-report # for the GLIB package
7 # initialize variables for unconditional += appending
13 # test: run all tests in cwd and subdirs
14 test: test-nonrecursive
16 @ for subdir in $(SUBDIRS) . ; do \
17 test "$$subdir" = "." -o "$$subdir" = "po" || \
18 ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
21 # test-nonrecursive: run tests only in cwd
22 test-nonrecursive: ${TEST_PROGS}
23 @test -z "${TEST_PROGS}" || G_DEBUG=gc-friendly MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) ${GTESTER} --verbose ${TEST_PROGS}
28 # test-report: run tests in subdirs and generate report
29 # perf-report: run tests in subdirs with -m perf and generate report
30 # full-report: like test-report: with -m perf and -m slow
31 test-report perf-report full-report: ${TEST_PROGS}
32 @test -z "${TEST_PROGS}" || { \
34 test-report) test_options="-k";; \
35 perf-report) test_options="-k -m=perf";; \
36 full-report) test_options="-k -m=perf -m=slow";; \
38 if test -z "$$GTESTER_LOGDIR" ; then \
39 ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
40 elif test -n "${TEST_PROGS}" ; then \
41 ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
44 @ ignore_logdir=true ; \
45 if test -z "$$GTESTER_LOGDIR" ; then \
46 GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
47 ignore_logdir=false ; \
49 if test -d "$(top_srcdir)/.git" ; then \
50 REVISION=`git describe` ; \
52 REVISION=$(VERSION) ; \
54 for subdir in $(SUBDIRS) . ; do \
55 test "$$subdir" = "." -o "$$subdir" = "po" || \
56 ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
58 $$ignore_logdir || { \
59 echo '<?xml version="1.0"?>' > $@.xml ; \
60 echo '<report-collection>' >> $@.xml ; \
61 echo '<info>' >> $@.xml ; \
62 echo ' <package>$(PACKAGE)</package>' >> $@.xml ; \
63 echo ' <version>$(VERSION)</version>' >> $@.xml ; \
64 echo " <revision>$$REVISION</revision>" >> $@.xml ; \
65 echo '</info>' >> $@.xml ; \
66 for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
67 sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
70 echo '</report-collection>' >> $@.xml ; \
71 rm -rf "$$GTESTER_LOGDIR"/ ; \
72 ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
74 .PHONY: test test-report perf-report full-report test-nonrecursive
76 .PHONY: lcov genlcov lcov-clean
77 # use recursive makes in order to ignore errors during check
79 -$(MAKE) $(AM_MAKEFLAGS) -k check
80 $(MAKE) $(AM_MAKEFLAGS) genlcov
82 # we have to massage the lcov.info file slightly to hide the effect of libtool
83 # placing the objects files in the .libs/ directory separate from the *.c
84 # we also have to delete tests/.libs/libmoduletestplugin_*.gcda
86 rm -f $(top_builddir)/tests/.libs/libmoduletestplugin_*.gcda
87 $(LTP) --directory $(top_builddir) --capture --output-file glib-lcov.info --test-name GLIB_PERF --no-checksum --compat-libtool
88 LANG=C $(LTP_GENHTML) --prefix $(top_builddir) --output-directory glib-lcov --title "GLib Code Coverage" --legend --show-details glib-lcov.info
89 @echo "file://$(abs_top_builddir)/glib-lcov/index.html"
92 -$(LTP) --directory $(top_builddir) -z
93 -rm -rf glib-lcov.info glib-lcov
94 -find -name '*.gcda' -print | xargs rm
96 # run tests in cwd as part of make check
97 check-local: test-nonrecursive