1 # GTK+ - The GIMP Toolkit
3 GTESTER = gtester # for non-GLIB packages
5 # initialize variables for unconditional += appending
11 # Xvfb based test rules
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
22 # test: run all tests in cwd and subdirs
25 test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} ; \
27 @ for subdir in $(SUBDIRS) ; do \
28 test "$$subdir" = "." -o "$$subdir" = "po" -o "$$subdir" = "po-properties" || \
29 ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
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 @ ignore_logdir=true ; \
36 if test -z "$$GTESTER_LOGDIR" ; then \
37 GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
38 ignore_logdir=false ; \
40 for subdir in $(SUBDIRS) ; do \
41 test "$$subdir" = "." -o "$$subdir" = "po" -o "$$subdir" = "po-properties" || \
42 ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
44 test -z "${TEST_PROGS}" || { \
46 test-report) test_options="-k";; \
47 perf-report) test_options="-k -m=perf";; \
48 full-report) test_options="-k -m=perf -m=slow";; \
51 if test -z "$$GTESTER_LOGDIR" ; then \
52 ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
53 elif test -n "${TEST_PROGS}" ; then \
54 ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
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 ; \
65 echo '</report-collection>' >> $@.xml ; \
66 rm -rf "$$GTESTER_LOGDIR"/ ; \
68 .PHONY: test test-report perf-report full-report
69 # run make test as part of make check