Statistics
| Revision:

root / trunk / Makefile.decl @ 1845

History | View | Annotate | Download (2.8 KB)

1
GTESTER        = gtester
2
GTESTER_REPORT = gtester-report
3

                
4
# initialize variables for unconditional += appending
5
EXTRA_DIST =
6
TEST_PROGS =
7

                
8
### testing rules
9

                
10
# test: run all tests in cwd and subdirs
11
test: test-nonrecursive
12
 @for subdir in $(SUBDIRS) . ; do \
13
   test "$$subdir" = "." -o "$$subdir" = "po" || \
14
   ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
15
 done
16

                
17
# test-nonrecursive: run tests only in cwd
18
test-nonrecursive: ${TEST_PROGS}
19
 @test -z "${TEST_PROGS}" || MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) ${GTESTER} --verbose ${TEST_PROGS}
20

                
21
# test-report: run tests in subdirs and generate report
22
# perf-report: run tests in subdirs with -m perf and generate report
23
# full-report: like test-report: with -m perf and -m slow
24
test-report perf-report full-report:     ${TEST_PROGS}
25
 @test -z "${TEST_PROGS}" || { \
26
   case $@ in \
27
   test-report) test_options="-k";; \
28
   perf-report) test_options="-k -m=perf";; \
29
   full-report) test_options="-k -m=perf -m=slow";; \
30
   esac ; \
31
   if test -z "$$GTESTER_LOGDIR" ; then        \
32
     ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
33
   elif test -n "${TEST_PROGS}" ; then \
34
     ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
35
   fi ; \
36
   exit 0; \
37
 }
38
 @ ignore_logdir=true ; \
39
   if test -z "$$GTESTER_LOGDIR" ; then \
40
     GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
41
     ignore_logdir=false ; \
42
   fi ; \
43
   if test -d "$(top_srcdir)/.git" ; then \
44
     REVISION=`git describe` ; \
45
   elif test -d "$(top_srcdir)/.svn" ; then \
46
     REVISION=`svnversion -n` ; \
47
   else \
48
     REVISION=$(VERSION) ; \
49
   fi ; \
50
   for subdir in $(SUBDIRS) . ; do \
51
     test "$$subdir" = "." -o "$$subdir" = "po" || \
52
     ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
53
   done ; \
54
   $$ignore_logdir || { \
55
     echo ''              > [email protected] ; \
56
     echo ''               >> [email protected] ; \
57
     echo ''                            >> [email protected] ; \
58
     echo '  $(PACKAGE)'   >> [email protected] ; \
59
     echo '  $(VERSION)'   >> [email protected] ; \
60
     echo "  $$REVISION" >> [email protected] ; \
61
     echo ''                           >> [email protected] ; \
62
     for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
63
       sed '1,1s/^?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> [email protected] ; \
64
     done ; \
65
     echo >> [email protected] ; \
66
     echo '' >> [email protected] ; \
67
     rm -rf "$$GTESTER_LOGDIR"/ ; \
68
     ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} [email protected] >[email protected] ; \
69
   }
70
.PHONY: test test-report perf-report full-report test-nonrecursive
71

                
72
# run tests in cwd as part of make check
73
check-local: test-nonrecursive
74