Setup test code coverage with lcov
[platform/upstream/libgee.git] / tests / Makefile.am
1 include $(top_srcdir)/Makefile.decl
2
3 NULL =
4
5 AM_CPPFLAGS = \
6         -I$(top_srcdir)/gee \
7         $(GLIB_CFLAGS) \
8         $(NULL)
9
10 noinst_PROGRAMS = $(TEST_PROGS)
11
12 progs_ldadd = $(GLIB_LIBS) ../gee/libgee.la
13
14 BUILT_SOURCES = tests.vala.stamp
15
16 TEST_PROGS += tests
17 tests_VALASOURCES = \
18        testarraylist.vala \
19        testcase.vala \
20        testcollection.vala \
21        testhashmultimap.vala \
22        testhashmultiset.vala \
23        testlinkedlist.vala \
24        testlist.vala \
25        testmain.vala \
26        testmultimap.vala \
27        testmultiset.vala \
28        testreadonlycollection.vala \
29        testreadonlylist.vala \
30        $(NULL)
31
32 tests_SOURCES = tests.vala.stamp $(tests_VALASOURCES:.vala=.c)
33 tests.vala.stamp: $(tests_VALASOURCES)
34         $(VALAC) -C --basedir $(top_srcdir) --vapidir $(top_srcdir)/gee --pkg gee-1.0 $^
35         touch $@
36 tests_LDADD = $(progs_ldadd)
37 EXTRA_DIST += $(tests_VALASOURCES)
38
39 coverage-reset:
40         lcov --base-directory=@top_srcdir@ --directory @top_srcdir@/gee --zerocounters
41
42 coverage-report:
43         lcov --directory @top_srcdir@/gee \
44                 --capture \
45                 --output-file @top_builddir@/lcov.info
46
47         lcov --directory @top_srcdir@/gee \
48                 --output-file @top_builddir@/lcov.info \
49                 --remove @top_builddir@/lcov.info \
50                 /usr/include/\*
51
52         $(mkdir_p) @top_builddir@/tests/coverage
53         git_commit=`GIT_DIR=@top_srcdir@/.git git log -1 --pretty=format:%h 2>/dev/null`;\
54         genhtml --title "@PACKAGE_STRING@ $$git_commit" \
55                 --output-directory @top_builddir@/tests/coverage @top_builddir@/lcov.info
56         @echo
57         @echo 'lcov report can be found in:'
58         @echo 'file://@abs_top_builddir@/tests/coverage/index.html'
59         @echo
60
61 clean-local:
62         -rm -rf coverage
63
64 .PHONY: coverage-report
65
66 TEST_PROGS += testhashmap
67 testhashmap_VALASOURCES = testhashmap.vala
68 testhashmap_SOURCES = testhashmap.c
69 $(testhashmap_SOURCES): $(testhashmap_VALASOURCES)
70         $(VALAC) -C --basedir $(top_srcdir) --vapidir $(top_srcdir)/gee --pkg gee-1.0 $^
71         touch $@
72 testhashmap_LDADD = $(progs_ldadd)
73 EXTRA_DIST += $(testhashmap_VALASOURCES)
74
75 TEST_PROGS += testhashset
76 testhashset_VALASOURCES = testhashset.vala
77 testhashset_SOURCES = testhashset.c
78 $(testhashset_SOURCES): $(testhashset_VALASOURCES)
79         $(VALAC) -C --basedir $(top_srcdir) --vapidir $(top_srcdir)/gee --pkg gee-1.0 $^
80         touch $@
81 testhashset_LDADD = $(progs_ldadd)
82 EXTRA_DIST += $(testhashset_VALASOURCES)
83
84 TEST_PROGS += testtreeset
85 testtreeset_VALASOURCES = testtreeset.vala
86 testtreeset_SOURCES = testtreeset.c testtreeset.h
87 $(testtreeset_SOURCES): $(testtreeset_VALASOURCES)
88         $(VALAC) -C --basedir $(top_srcdir) --vapidir $(top_srcdir)/gee --pkg gee-1.0 $^
89         touch $@
90 testtreeset_LDADD = $(progs_ldadd)
91 EXTRA_DIST += $(testtreeset_VALASOURCES)
92
93 TEST_PROGS += testtreemap
94 testtreemap_VALASOURCES = testtreemap.vala
95 testtreemap_SOURCES = testtreemap.c testtreemap.h
96 $(testtreemap_SOURCES): $(testtreemap_VALASOURCES)
97         $(VALAC) -C --basedir $(top_srcdir) --vapidir $(top_srcdir)/gee --pkg gee-1.0 $^
98         touch $@
99 testtreemap_LDADD = $(progs_ldadd)
100 EXTRA_DIST += $(testtreemap_VALASOURCES)
101