Updated Spanish translation
[anjuta.git] / gtester.mk
blob6c24bfb8d630f0068a0817c1b4740068957fa721
1 # GLIB - Library of useful C routines
3 GTESTER = gtester # for non-GLIB packages
4 GTESTER_REPORT = gtester-report # for non-GLIB packages
5 NULL =
7 # initialize variables for unconditional += appending
8 BUILT_SOURCES =
9 BUILT_EXTRA_DIST =
10 CLEANFILES = *.log *.trs
11 DISTCLEANFILES =
12 MAINTAINERCLEANFILES =
13 EXTRA_DIST =
14 TEST_PROGS =
16 noinst_LTLIBRARIES =
17 noinst_PROGRAMS =
18 noinst_SCRIPTS =
19 noinst_DATA =
21 check_LTLIBRARIES =
22 check_PROGRAMS =
23 check_SCRIPTS =
24 check_DATA =
26 TESTS =
28 ### testing rules
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 $? ; \
35 done
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}" || { \
46 case $@ in \
47 test-report) test_options="-k";; \
48 perf-report) test_options="-k -m=perf";; \
49 full-report) test_options="-k -m=perf -m=slow";; \
50 esac ; \
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} ; \
55 fi ; \
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 ; \
61 fi ; \
62 if test -d "$(top_srcdir)/.git" ; then \
63 REVISION=`git describe` ; \
64 else \
65 REVISION=$(VERSION) ; \
66 fi ; \
67 for subdir in $(SUBDIRS) . ; do \
68 test "$$subdir" = "." -o "$$subdir" = "po" || \
69 ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
70 done ; \
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 ; \
81 done ; \
82 echo >> $@.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
91 lcov:
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
98 genlcov:
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"
104 lcov-clean:
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; \
117 mv $@.tmp $@)