Fix building on Windows
[claws.git] / tests.mk
blobaa5a2810a61733f948eb2c5cbc1b6fd4ce84fae8
1 GTESTER = gtester
2 GTESTER_REPORT = gtester-report
4 # initialize variables for unconditional += appending
5 TEST_PROGS =
7 ### testing rules
9 # test: run all tests in cwd and subdirs
10 test: test-cwd test-recurse
11 # test-cwd: run tests in cwd
12 test-cwd: ${TEST_PROGS}
13 @[ -z "$(TEST_PROGS)" ] || { set -e; $(TESTS_ENVIRONMENT) ${GTESTER} --verbose ${TEST_PROGS}; }
15 # test-recurse: run tests in subdirs
16 test-recurse:
17 @ for subdir in $(SUBDIRS) ; do \
18 test "$$subdir" = "." \
19 -o "$$subdir" = "config" \
20 -o "$$subdir" = "doc" \
21 -o "$$subdir" = "manual" \
22 -o "$$subdir" = "m4" \
23 -o "$$subdir" = "po" \
24 -o "$$subdir" = "tools" \
25 || \
26 ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) test ) || exit $? ; \
27 done
28 # test-report: run tests in subdirs and generate report
29 # perf-report: run tests in subdirs with -m perf and generate report
30 # full-report: like test-report: with -m perf and -m slow
31 test-report perf-report full-report: ${TEST_PROGS}
32 @ ignore_logdir=true ; \
33 if test -z "$$GTESTER_LOGDIR" ; then \
34 GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
35 ignore_logdir=false ; \
36 fi ; \
37 for subdir in $(SUBDIRS) ; do \
38 test "$$subdir" = "." -o "$$subdir" = "po" -o "$$subdir" = "po-properties" || \
39 ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
40 done ; \
41 test -z "${TEST_PROGS}" || { \
42 case $@ in \
43 test-report) test_options="-k";; \
44 perf-report) test_options="-k -m=perf";; \
45 full-report) test_options="-k -m=perf -m=slow";; \
46 esac ; \
47 set -e; \
48 if test -z "$$GTESTER_LOGDIR" ; then \
49 ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
50 elif test -n "${TEST_PROGS}" ; then \
51 ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
52 fi ; \
53 }; \
54 $$ignore_logdir || { \
55 echo '<?xml version="1.0"?>' > $@.xml ; \
56 echo '<report-collection>' >> $@.xml ; \
57 for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
58 sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
59 done ; \
60 echo >> $@.xml ; \
61 echo '</report-collection>' >> $@.xml ; \
62 rm -rf "$$GTESTER_LOGDIR"/ ; \
63 ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
65 .PHONY: test test-cwd test-recurse test-report perf-report full-report
66 # run make test-cwd as part of make check
67 check-local: test-cwd