1 # GLIB - Library of useful C routines
3 GTESTER
= gtester
# for non-GLIB packages
4 GTESTER_REPORT
= gtester-report
# for non-GLIB packages
7 # initialize variables for unconditional += appending
10 CLEANFILES
= *.log
*.trs
12 MAINTAINERCLEANFILES
=
30 # test: run all tests in cwd and subdirs
31 test: test-nonrecursive
32 @ for subdir in
$(SUBDIRS
) .
; do \
33 test "$$subdir" = "." -o
"$$subdir" = "po" || \
34 ( cd
$$subdir && $(MAKE
) $(AM_MAKEFLAGS
) $@
) || exit
$?
; \
37 # test-nonrecursive: run tests only in cwd
38 test-nonrecursive
: ${TEST_PROGS}
39 @
test -z
"${TEST_PROGS}" || G_TEST_SRCDIR
="$(abs_srcdir)" G_TEST_BUILDDIR
="$(abs_builddir)" G_DEBUG
=gc-friendly MALLOC_CHECK_
=2 MALLOC_PERTURB_
=$$(($${RANDOM
:-256} % 256)) ${GTESTER} --verbose
${TEST_PROGS}
41 # test-report: run tests in subdirs and generate report
42 # perf-report: run tests in subdirs with -m perf and generate report
43 # full-report: like test-report: with -m perf and -m slow
44 test-report perf-report full-report
: ${TEST_PROGS}
45 @
test -z
"${TEST_PROGS}" ||
{ \
47 test-report
) test_options
="-k";; \
48 perf-report
) test_options
="-k -m=perf";; \
49 full-report
) test_options
="-k -m=perf -m=slow";; \
51 if
test -z
"$$GTESTER_LOGDIR" ; then \
52 G_TEST_SRCDIR
="$(abs_srcdir)" G_TEST_BUILDDIR
="$(abs_builddir)" ${GTESTER} --verbose
$$test_options -o test-report.xml
${TEST_PROGS} ; \
53 elif
test -n
"${TEST_PROGS}" ; then \
54 G_TEST_SRCDIR
="$(abs_srcdir)" G_TEST_BUILDDIR
="$(abs_builddir)" ${GTESTER} --verbose
$$test_options -o
`mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
57 @ ignore_logdir
=true
; \
58 if
test -z
"$$GTESTER_LOGDIR" ; then \
59 GTESTER_LOGDIR
=`mktemp -d "\`pwd\
`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR
; \
60 ignore_logdir
=false
; \
62 if
test -d
"$(top_srcdir)/.git" ; then \
63 REVISION
=`git describe` ; \
65 REVISION
=$(VERSION
) ; \
67 for subdir in
$(SUBDIRS
) .
; do \
68 test "$$subdir" = "." -o
"$$subdir" = "po" || \
69 ( cd
$$subdir && $(MAKE
) $(AM_MAKEFLAGS
) $@
) || exit
$?
; \
71 $$ignore_logdir ||
{ \
72 echo
'<?xml version="1.0"?>' > $@.xml
; \
73 echo
'<report-collection>' >> $@.xml
; \
74 echo
'<info>' >> $@.xml
; \
75 echo
' <package>$(PACKAGE)</package>' >> $@.xml
; \
76 echo
' <version>$(VERSION)</version>' >> $@.xml
; \
77 echo
" <revision>$$REVISION</revision>" >> $@.xml
; \
78 echo
'</info>' >> $@.xml
; \
79 for lf in
`ls -L "$$GTESTER_LOGDIR"/.` ; do \
80 sed
'1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml
; \
83 echo
'</report-collection>' >> $@.xml
; \
84 rm -rf
"$$GTESTER_LOGDIR"/ ; \
85 ${GTESTER_REPORT} --version
2>/dev
/null
1>&2 ; test "$$?" != 0 ||
${GTESTER_REPORT} $@.xml
>$@.html
; \
87 .PHONY
: test test-report perf-report full-report test-nonrecursive
89 .PHONY
: lcov genlcov lcov-clean
90 # use recursive makes in order to ignore errors during check
92 -$(MAKE
) $(AM_MAKEFLAGS
) -k
check
93 $(MAKE
) $(AM_MAKEFLAGS
) genlcov
95 # we have to massage the lcov.info file slightly to hide the effect of libtool
96 # placing the objects files in the .libs/ directory separate from the *.c
97 # we also have to delete tests/.libs/libmoduletestplugin_*.gcda
99 rm -f
$(top_builddir
)/tests
/.libs
/libmoduletestplugin_
*.gcda
100 $(LTP
) --directory
$(top_builddir
) --capture
--output-file glib-lcov.
info --test-name GLIB_PERF
--no-checksum
--compat-libtool
101 LANG
=C
$(LTP_GENHTML
) --prefix $(top_builddir
) --output-directory glib-lcov
--title
"GLib Code Coverage" --legend
--show-details glib-lcov.
info
102 @echo
"file://$(abs_top_builddir)/glib-lcov/index.html"
105 -$(LTP
) --directory
$(top_builddir
) -z
106 -rm -rf glib-lcov.
info glib-lcov
107 -find
-name
'*.gcda' -print | xargs
rm
109 # run tests in cwd as part of make check
110 check-local
: test-nonrecursive
113 %.
test: %$(EXEEXT
) Makefile
114 $(AM_V_GEN
) (echo
'[Test]' > $@.tmp
; \
115 echo
'Type=session' >> $@.tmp
; \
116 echo
'Exec=$(installed_testdir)/$<' >> $@.tmp
; \