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