[tests] Merged Makefile.decl in the test framework
[adg.git] / build / Makefile.am.gtester
blobaef85bf326caa8e91ef5976609a33b0efb563014
1 ## Adapted Makefile.decl found in glib-2.23.2
2 EXTRA_DIST=
3 TEST_PROGS=
6 # test: run all tests in cwd and subdirs
7 test: ${TEST_PROGS}
8 if OS_UNIX
9         @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS}
10         @ for subdir in $(SUBDIRS) . ; do \
11             test "$$subdir" = "." -o \
12                  "$$subdir" = "po" -o \
13                  "$$subdir" = "po-properties" || \
14             ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
15           done
16 endif
18 # test-report: run tests in subdirs and generate report
19 # perf-report: run tests in subdirs with -m perf and generate report
20 # full-report: like test-report: with -m perf and -m slow
21 test-report perf-report full-report:    ${TEST_PROGS}
22         @test -z "${TEST_PROGS}" || { \
23           case $@ in \
24           test-report) test_options="-k";; \
25           perf-report) test_options="-k -m=perf";; \
26           full-report) test_options="-k -m=perf -m=slow";; \
27           esac ; \
28           if test -z "$$GTESTER_LOGDIR" ; then  \
29             ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
30           elif test -n "${TEST_PROGS}" ; then \
31             ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
32           fi ; \
33         }
34         @ ignore_logdir=true ; \
35           if test -z "$$GTESTER_LOGDIR" ; then \
36             GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
37             ignore_logdir=false ; \
38           fi ; \
39           for subdir in $(SUBDIRS) . ; do \
40             test "$$subdir" = "." -o "$$subdir" = "po" || \
41             ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
42           done ; \
43           $$ignore_logdir || { \
44             echo '<?xml version="1.0"?>' > $@.xml ; \
45             echo '<report-collection>'  >> $@.xml ; \
46             for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
47               sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
48             done ; \
49             echo >> $@.xml ; \
50             echo '</report-collection>' >> $@.xml ; \
51             rm -rf "$$GTESTER_LOGDIR"/ ; \
52             ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
53           }
55 .PHONY: test test-report perf-report full-report
57 check-local: test