]> Pileus Git - ~andy/gtk/blob - Makefile.decl
initialize automake variables EXTRA_DIST and TEST_PROGS for unconditional
[~andy/gtk] / Makefile.decl
1 # GTK+ - The GIMP Toolkit
2
3 GTESTER = gtester                       # for non-GLIB packages
4
5 # initialize variables for unconditional += appending
6 EXTRA_DIST =
7 TEST_PROGS =
8
9 ### testing rules
10
11 # Xvfb based test rules
12 XVFB = Xvfb
13 XVFB_START = \
14         ${XVFB} -help 2>/dev/null 1>&2 \
15         && XID=`for id in \`seq 101 199\` ; do test -e /tmp/.X$$id-lock || { echo $$id; exit 0; }; done; exit 1` \
16         && { ${XVFB} :$$XID -nolisten tcp -auth /dev/null >/dev/null 2>&1 & \
17                trap "kill -15 $$! " 0 HUP INT QUIT TRAP USR1 PIPE TERM ; } \
18         || { echo Failed to start Xvfb environment for testing; exit 1; } \
19         && set -e ; DISPLAY=:$$XID; export DISPLAY
20 # call as: $(XVFB_START) && someprogram
21
22 # test: run all tests in cwd and subdirs
23 test:   ${TEST_PROGS}
24         @$(XVFB_START) && { \
25           test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} ; \
26         }
27         @ for subdir in $(SUBDIRS) ; do \
28             test "$$subdir" = "." -o "$$subdir" = "po" -o "$$subdir" = "po-properties" || \
29             ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
30           done
31 # test-report: run tests in subdirs and generate report
32 # perf-report: run tests in subdirs with -m perf and generate report
33 # full-report: like test-report: with -m perf and -m slow
34 test-report perf-report full-report:    ${TEST_PROGS}
35         @test -z "${TEST_PROGS}" || { \
36           case $@ in \
37           test-report) test_options="-k";; \
38           perf-report) test_options="-k -m=perf";; \
39           full-report) test_options="-k -m=perf -m=slow";; \
40           esac ; \
41           $(XVFB_START) && { \
42             if test -z "$$GTESTER_LOGDIR" ; then \
43               ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
44             elif test -n "${TEST_PROGS}" ; then \
45               ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
46             fi ; \
47           } \
48         }
49         @ ignore_logdir=true ; \
50           if test -z "$$GTESTER_LOGDIR" ; then \
51             GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
52             ignore_logdir=false ; \
53           fi ; \
54           for subdir in $(SUBDIRS) ; do \
55             test "$$subdir" = "." -o "$$subdir" = "po" -o "$$subdir" = "po-properties" || \
56             ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
57           done ; \
58           $$ignore_logdir || { \
59             echo '<?xml version="1.0"?>' > $@.xml ; \
60             echo '<report-collection>'  >> $@.xml ; \
61             for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
62               sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
63             done ; \
64             echo >> $@.xml ; \
65             echo '</report-collection>' >> $@.xml ; \
66             rm -rf "$$GTESTER_LOGDIR"/ ; \
67           }
68 .PHONY: test test-report perf-report full-report
69 # run make test as part of make check
70 check-local: test