3
by Mikkel Kamstrup Erlandsen
Import a bunch of the testing stuff from lp:unity |
1 |
# GLIB - Library of useful C routines
|
5
by Mikkel Kamstrup Erlandsen
Make the unit tests run on 'make check' |
2 |
#
|
3 |
# This file is copied almost verbatim from the GLib-2.0 distribution
|
|
4 |
#
|
|
3
by Mikkel Kamstrup Erlandsen
Import a bunch of the testing stuff from lp:unity |
5 |
|
188.1.3
by Michal Hruby
Add infrastructure for pygi tests |
6 |
GTESTER = gtester |
7 |
GTESTER_REPORT = gtester-report |
|
3
by Mikkel Kamstrup Erlandsen
Import a bunch of the testing stuff from lp:unity |
8 |
|
9 |
# initialize variables for unconditional += appending
|
|
10 |
EXTRA_DIST = |
|
11 |
TEST_PROGS = |
|
12 |
||
13 |
### testing rules
|
|
14 |
||
5
by Mikkel Kamstrup Erlandsen
Make the unit tests run on 'make check' |
15 |
# test: run all tests in cwd and subdirs
|
188.1.3
by Michal Hruby
Add infrastructure for pygi tests |
16 |
test: test-nonrecursive |
17 |
@ for subdir in $(SUBDIRS) . ; do \ |
|
5
by Mikkel Kamstrup Erlandsen
Make the unit tests run on 'make check' |
18 |
test "$$subdir" = "." -o "$$subdir" = "po" || \ |
19 |
( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \ |
|
20 |
done
|
|
188.1.3
by Michal Hruby
Add infrastructure for pygi tests |
21 |
|
22 |
# test-nonrecursive: run tests only in cwd
|
|
23 |
test-nonrecursive: ${TEST_PROGS} |
|
24 |
@test -z "${TEST_PROGS}" || G_DEBUG=gc-friendly MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) ${GTESTER} --verbose ${TEST_PROGS} |
|
25 |
||
3
by Mikkel Kamstrup Erlandsen
Import a bunch of the testing stuff from lp:unity |
26 |
# test-report: run tests in subdirs and generate report
|
27 |
# perf-report: run tests in subdirs with -m perf and generate report
|
|
28 |
# full-report: like test-report: with -m perf and -m slow
|
|
29 |
test-report perf-report full-report: ${TEST_PROGS} |
|
30 |
@test -z "${TEST_PROGS}" || { \ |
|
31 |
case $@ in \ |
|
32 |
test-report) test_options="-k";; \ |
|
33 |
perf-report) test_options="-k -m=perf";; \ |
|
34 |
full-report) test_options="-k -m=perf -m=slow";; \ |
|
35 |
esac ; \ |
|
36 |
if test -z "$$GTESTER_LOGDIR" ; then \
|
|
37 |
${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
|
|
38 |
elif test -n "${TEST_PROGS}" ; then \
|
|
39 |
${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
|
|
40 |
fi ; \
|
|
41 |
}
|
|
42 |
@ ignore_logdir=true ; \ |
|
43 |
if test -z "$$GTESTER_LOGDIR" ; then \
|
|
44 |
GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
|
|
45 |
ignore_logdir=false ; \
|
|
46 |
fi ; \
|
|
188.1.3
by Michal Hruby
Add infrastructure for pygi tests |
47 |
REVISION=$(VERSION) ; \
|
48 |
for subdir in $(SUBDIRS) . ; do \
|
|
3
by Mikkel Kamstrup Erlandsen
Import a bunch of the testing stuff from lp:unity |
49 |
test "$$subdir" = "." -o "$$subdir" = "po" || \
|
50 |
( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
|
|
51 |
done ; \
|
|
52 |
$$ignore_logdir || { \
|
|
188.1.3
by Michal Hruby
Add infrastructure for pygi tests |
53 |
echo '<?xml version="1.0"?>' > $@.xml ; \
|
54 |
echo '<report-collection>' >> $@.xml ; \
|
|
55 |
echo '<info>' >> $@.xml ; \
|
|
56 |
echo ' <package>$(PACKAGE)</package>' >> $@.xml ; \
|
|
57 |
echo ' <version>$(VERSION)</version>' >> $@.xml ; \
|
|
58 |
echo " <revision>$$REVISION</revision>" >> $@.xml ; \
|
|
59 |
echo '</info>' >> $@.xml ; \
|
|
3
by Mikkel Kamstrup Erlandsen
Import a bunch of the testing stuff from lp:unity |
60 |
for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
|
61 |
sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
|
|
62 |
done ; \
|
|
63 |
echo >> $@.xml ; \
|
|
64 |
echo '</report-collection>' >> $@.xml ; \
|
|
65 |
rm -rf "$$GTESTER_LOGDIR"/ ; \
|
|
66 |
${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
|
|
67 |
}
|
|
188.1.3
by Michal Hruby
Add infrastructure for pygi tests |
68 |
.PHONY: test test-report perf-report full-report test-nonrecursive |
87.1.23
by Mikkel Kamstrup Erlandsen
Add headless testing mode with a new configure switch --enable-headless-tests which is off by default. This will require Xvfb and dbus-launch installed on the build machine. |
69 |
|
188.1.3
by Michal Hruby
Add infrastructure for pygi tests |
70 |
# run tests in cwd as part of make check
|
87.1.23
by Mikkel Kamstrup Erlandsen
Add headless testing mode with a new configure switch --enable-headless-tests which is off by default. This will require Xvfb and dbus-launch installed on the build machine. |
71 |
if ENABLE_HEADLESS_TESTS
|
72 |
check-local: test-headless |
|
191.1.1
by Michal Hruby
Fix headless tests |
73 |
|
74 |
LOG_PATH = headless-logs |
|
75 |
test-headless: |
|
76 |
set -e; \ |
|
205.1.2
by Michal Hruby
Auto pick display when invoking xvfb |
77 |
$(XVFB) -a make test-nonrecursive; \ |
193.2.4
by Pawel Stolowski
Use xvfb-run to launch headless tests via Xvfb. |
78 |
sleep 1; |
87.1.23
by Mikkel Kamstrup Erlandsen
Add headless testing mode with a new configure switch --enable-headless-tests which is off by default. This will require Xvfb and dbus-launch installed on the build machine. |
79 |
else
|
188.1.3
by Michal Hruby
Add infrastructure for pygi tests |
80 |
check-local: test-nonrecursive |
87.1.23
by Mikkel Kamstrup Erlandsen
Add headless testing mode with a new configure switch --enable-headless-tests which is off by default. This will require Xvfb and dbus-launch installed on the build machine. |
81 |
endif
|