1.2.2
by Mathieu Trudel-Lapierre
Import upstream version 1.0.0 |
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}" || G_DEBUG=gc-friendly 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 |
}
|
|
37 |
@ ignore_logdir=true ; \ |
|
38 |
if test -z "$$GTESTER_LOGDIR" ; then \ |
|
39 |
GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \ |
|
40 |
ignore_logdir=false ; \
|
|
41 |
fi ; \
|
|
42 |
if test -d "$(top_srcdir)/.git" ; then \ |
|
43 |
REVISION=`git describe` ; \
|
|
44 |
else \
|
|
45 |
REVISION=$(VERSION) ; \
|
|
46 |
fi ; \
|
|
47 |
for subdir in $(SUBDIRS) . ; do \
|
|
48 |
test "$$subdir" = "." -o "$$subdir" = "po" || \ |
|
49 |
( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
|
|
50 |
done ; \
|
|
51 |
$$ignore_logdir || { \
|
|
52 |
echo '<?xml version="1.0"?>' > $@.xml ; \ |
|
53 |
echo '<report-collection>' >> $@.xml ; \
|
|
54 |
echo '<info>' >> $@.xml ; \
|
|
55 |
echo ' <package>$(PACKAGE)</package>' >> $@.xml ; \
|
|
56 |
echo ' <version>$(VERSION)</version>' >> $@.xml ; \
|
|
57 |
echo " <revision>$$REVISION</revision>" >> $@.xml ; \ |
|
58 |
echo '</info>' >> $@.xml ; \
|
|
59 |
for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \ |
|
60 |
sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \ |
|
61 |
done ; \
|
|
62 |
echo >> $@.xml ; \
|
|
63 |
echo '</report-collection>' >> $@.xml ; \
|
|
64 |
rm -rf "$$GTESTER_LOGDIR"/ ; \ |
|
65 |
${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \ |
|
66 |
}
|
|
67 |
.PHONY: test test-report perf-report full-report test-nonrecursive
|
|
68 |
||
69 |
.PHONY: lcov genlcov lcov-clean
|
|
70 |
# use recursive makes in order to ignore errors during check
|
|
71 |
lcov:
|
|
72 |
-$(MAKE) $(AM_MAKEFLAGS) -k check
|
|
73 |
$(MAKE) $(AM_MAKEFLAGS) genlcov
|
|
74 |
||
75 |
# we have to massage the lcov.info file slightly to hide the effect of libtool
|
|
76 |
# placing the objects files in the .libs/ directory separate from the *.c
|
|
77 |
# we also have to delete tests/.libs/libmoduletestplugin_*.gcda
|
|
78 |
genlcov:
|
|
79 |
rm -f $(top_builddir)/tests/.libs/libmoduletestplugin_*.gcda
|
|
80 |
$(LTP) --directory $(top_builddir) --capture --output-file glib-lcov.info --test-name GLIB_PERF --no-checksum --compat-libtool
|
|
81 |
LANG=C $(LTP_GENHTML) --prefix $(top_builddir) --output-directory glib-lcov --title "GLib Code Coverage" --legend --show-details glib-lcov.info |
|
82 |
@echo "file://$(abs_top_builddir)/glib-lcov/index.html" |
|
83 |
||
84 |
lcov-clean: |
|
85 |
-$(LTP) --directory $(top_builddir) -z |
|
86 |
-rm -rf glib-lcov.info glib-lcov |
|
87 |
-find -name '*.gcda' -print | xargs rm |
|
88 |
||
89 |
# run tests in cwd as part of make check |
|
90 |
check-local: test-nonrecursive |
|
91 |