tests: fix a small lie
[dconf.git] / Makefile.gtester
blobfdc00103b292d5a95714ae87bc61ea9649fecec3
1 # initialize variables for unconditional += appending
2 TEST_PROGS =
4 ### testing rules
6 # test: run all tests in cwd and subdirs
7 test: test-nonrecursive
8         @ for subdir in $(SUBDIRS) . ; do \
9             test "$$subdir" = "." -o "$$subdir" = "po" || \
10             ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
11           done
13 # test-nonrecursive: run tests only in cwd
14 test-nonrecursive: ${TEST_PROGS}
15         @test -z "${TEST_PROGS}" || G_DEBUG=gc-friendly MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) gtester --verbose ${TEST_PROGS}
17 # test-report: run tests in subdirs and generate report
18 # perf-report: run tests in subdirs with -m perf and generate report
19 # full-report: like test-report: with -m perf and -m slow
20 test-report perf-report full-report:    ${TEST_PROGS}
21         @test -z "${TEST_PROGS}" || { \
22           case $@ in \
23           test-report) test_options="-k";; \
24           perf-report) test_options="-k -m=perf";; \
25           full-report) test_options="-k -m=perf -m=slow";; \
26           esac ; \
27           if test -z "$$GTESTER_LOGDIR" ; then  \
28             gtester --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
29           elif test -n "${TEST_PROGS}" ; then \
30             gtester --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
31           fi ; \
32         }
33         @ ignore_logdir=true ; \
34           if test -z "$$GTESTER_LOGDIR" ; then \
35             GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
36             ignore_logdir=false ; \
37           fi ; \
38           if test -d "$(top_srcdir)/.git" ; then \
39             REVISION=`git describe` ; \
40           else \
41             REVISION=$(VERSION) ; \
42           fi ; \
43           for subdir in $(SUBDIRS) . ; do \
44             test "$$subdir" = "." -o "$$subdir" = "po" || \
45             ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
46           done ; \
47           $$ignore_logdir || { \
48             echo '<?xml version="1.0"?>'              > $@.xml ; \
49             echo '<report-collection>'               >> $@.xml ; \
50             echo '<info>'                            >> $@.xml ; \
51             echo '  <package>$(PACKAGE)</package>'   >> $@.xml ; \
52             echo '  <version>$(VERSION)</version>'   >> $@.xml ; \
53             echo "  <revision>$$REVISION</revision>" >> $@.xml ; \
54             echo '</info>'                           >> $@.xml ; \
55             for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
56               sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
57             done ; \
58             echo >> $@.xml ; \
59             echo '</report-collection>' >> $@.xml ; \
60             rm -rf "$$GTESTER_LOGDIR"/ ; \
61             gtester-report --version 2>/dev/null 1>&2 ; test "$$?" != 0 || gtester-report $@.xml >$@.html ; \
62           }
63 .PHONY: test test-report perf-report full-report test-nonrecursive
65 # run tests in cwd as part of make check
66 check-local: test-nonrecursive