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