diff options
author | Jürg Billeter <j@bitron.ch> | 2009-09-26 21:58:39 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2009-09-26 23:19:36 +0200 |
commit | 331d4e8d2927eb912edd9b286568376149f60322 (patch) | |
tree | 48b7faf0bb769bdbde36318eea87caacc4a6c68b | |
parent | 4d4176547022421e24fda56041862bdf129dbd3c (diff) | |
download | vala-331d4e8d2927eb912edd9b286568376149f60322.tar.gz |
Add support for coverage analysis using gcov and lcov
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | Makefile.am | 20 | ||||
-rw-r--r-- | ccode/Makefile.am | 4 | ||||
-rw-r--r-- | codegen/Makefile.am | 4 | ||||
-rw-r--r-- | compiler/Makefile.am | 4 | ||||
-rw-r--r-- | configure.ac | 16 | ||||
-rw-r--r-- | gee/Makefile.am | 4 | ||||
-rw-r--r-- | vala/Makefile.am | 4 |
8 files changed, 56 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore index 42c1298fc..94ed5cc68 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,8 @@ ylwrap compile stamp-h1 *.pc + +*.gcda +*.gcno +coverage +lcov.info diff --git a/Makefile.am b/Makefile.am index e603ea9c8..0dfaa2061 100644 --- a/Makefile.am +++ b/Makefile.am @@ -36,10 +36,30 @@ DIST_SUBDIRS = \ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = vala-1.0.pc +.PHONY: bootstrap +bootstrap: all + find $(top_srcdir) -name "*.vala.stamp" | xargs rm -f + $(MAKE) $(AM_MAKEFLAGS) all VALAC=$(abs_top_builddir)/compiler/valac + .PHONY: test test: cd tests && $(MAKE) $(AM_MAKEFLAGS) check +#if ENABLE_COVERAGE +.PHONY: coverage coverage-report +coverage: + find $(top_srcdir) -name "*.gcda" | xargs rm -f + $(MAKE) $(AM_MAKEFLAGS) bootstrap + $(MAKE) $(AM_MAKEFLAGS) test + +coverage-report: coverage + lcov --directory $(top_srcdir) --capture --output-file $(top_builddir)/lcov.info + lcov --directory $(top_srcdir) --output-file $(top_builddir)/lcov.info --remove $(top_builddir)/lcov.info "*.c" "*.h" "*.vapi" + rm -r $(top_builddir)/coverage + $(mkdir_p) $(top_builddir)/coverage + genhtml --title "@PACKAGE_STRING@" --output-directory $(top_builddir)/coverage $(top_builddir)/lcov.info +#endif + dist-hook: gen-ChangeLog gen_start_date = 2009-02-25 diff --git a/ccode/Makefile.am b/ccode/Makefile.am index af79c1f96..fdc07bb2f 100644 --- a/ccode/Makefile.am +++ b/ccode/Makefile.am @@ -1,6 +1,7 @@ NULL = AM_CPPFLAGS = \ + $(COVERAGE_CFLAGS) \ -I$(top_srcdir)/gee \ $(GLIB_CFLAGS) \ $(NULL) @@ -76,10 +77,11 @@ ccodeinclude_HEADERS = \ $(NULL) ccode.vapi ccode.vala.stamp: $(libvalaccode_la_VALASOURCES) - $(VALAC) $(VALAFLAGS) -C --vapidir $(srcdir)/../vapi --pkg gobject-2.0 --vapidir ../gee --pkg gee -H valaccode.h --library ccode $^ + $(VALAC) $(COVERAGE_VALAFLAGS) $(VALAFLAGS) -C --vapidir $(srcdir)/../vapi --pkg gobject-2.0 --vapidir ../gee --pkg gee -H valaccode.h --library ccode $^ touch $@ libvalaccode_la_LIBADD = \ + $(COVERAGE_LIBS) \ $(GLIB_LIBS) \ $(NULL) diff --git a/codegen/Makefile.am b/codegen/Makefile.am index 8f9401f8b..902cf5d25 100644 --- a/codegen/Makefile.am +++ b/codegen/Makefile.am @@ -1,6 +1,7 @@ NULL = AM_CPPFLAGS = \ + $(COVERAGE_CFLAGS) \ -I$(top_srcdir)/gee \ -I$(top_srcdir)/ccode \ -I$(top_srcdir)/vala \ @@ -56,12 +57,13 @@ codegeninclude_HEADERS = \ $(NULL) codegen.vapi codegen.vala.stamp: $(libvala_la_VALASOURCES) - $(VALAC) $(VALAFLAGS) -C --vapidir $(srcdir)/../vapi --pkg gobject-2.0 --vapidir ../gee --pkg gee --vapidir ../ccode --pkg ccode --vapidir ../vala --pkg vala -H valacodegen.h --library codegen $^ + $(VALAC) $(COVERAGE_VALAFLAGS) $(VALAFLAGS) -C --vapidir $(srcdir)/../vapi --pkg gobject-2.0 --vapidir ../gee --pkg gee --vapidir ../ccode --pkg ccode --vapidir ../vala --pkg vala -H valacodegen.h --library codegen $^ touch $@ libvala_la_LDFLAGS = -no-undefined libvala_la_LIBADD = \ + $(COVERAGE_LIBS) \ $(GLIB_LIBS) \ ../vala/libvalacore.la \ $(NULL) diff --git a/compiler/Makefile.am b/compiler/Makefile.am index 4cbe5ba2c..45e4fd760 100644 --- a/compiler/Makefile.am +++ b/compiler/Makefile.am @@ -1,6 +1,7 @@ NULL = AM_CPPFLAGS = \ + $(COVERAGE_CFLAGS) \ -I$(top_srcdir)/gee \ -I$(top_srcdir)/ccode \ -I$(top_srcdir)/vala \ @@ -26,10 +27,11 @@ valac_SOURCES = \ $(NULL) valac.vala.stamp: $(valac_VALASOURCES) - $(VALAC) $(VALAFLAGS) -C --vapidir $(srcdir)/../vapi --pkg gobject-2.0 --vapidir ../gee --pkg gee --vapidir ../ccode --pkg ccode --vapidir ../vala --pkg vala --vapidir ../codegen --pkg codegen --pkg config $^ + $(VALAC) $(COVERAGE_VALAFLAGS) $(VALAFLAGS) -C --vapidir $(srcdir)/../vapi --pkg gobject-2.0 --vapidir ../gee --pkg gee --vapidir ../ccode --pkg ccode --vapidir ../vala --pkg vala --vapidir ../codegen --pkg codegen --pkg config $^ touch $@ valac_LDADD = \ + $(COVERAGE_LIBS) \ $(GLIB_LIBS) \ ../codegen/libvala.la \ $(NULL) diff --git a/configure.ac b/configure.ac index ec8b3810a..5b0b3cb46 100644 --- a/configure.ac +++ b/configure.ac @@ -29,6 +29,22 @@ AC_SUBST(CFLAGS) AC_SUBST(CPPFLAGS) AC_SUBST(LDFLAGS) +AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage], [Enable coverage analysis]), enable_coverage=$enableval, enable_coverage=no) +AM_CONDITIONAL(ENABLE_COVERAGE, test x$enable_coverage = xyes) + +if test "$enable_coverage" = "yes"; then + COVERAGE_VALAFLAGS="-g" + COVERAGE_CFLAGS="-fprofile-arcs -ftest-coverage" + COVERAGE_LIBS="-lgcov" +else + COVERAGE_VALAFLAGS= + COVERAGE_CFLAGS= + COVERAGE_LIBS= +fi +AC_SUBST(COVERAGE_VALAFLAGS) +AC_SUBST(COVERAGE_CFLAGS) +AC_SUBST(COVERAGE_LIBS) + AC_ARG_ENABLE(vapigen, AS_HELP_STRING([--enable-vapigen], [Enable VAPI generator]), enable_vapigen=$enableval, enable_vapigen=no) AM_CONDITIONAL(ENABLE_VAPIGEN, test x$enable_vapigen = xyes) diff --git a/gee/Makefile.am b/gee/Makefile.am index 85928fedf..ece430c97 100644 --- a/gee/Makefile.am +++ b/gee/Makefile.am @@ -1,6 +1,7 @@ NULL = AM_CPPFLAGS = \ + $(COVERAGE_CFLAGS) \ $(GLIB_CFLAGS) \ $(NULL) @@ -39,10 +40,11 @@ geeinclude_HEADERS = \ $(NULL) gee.vapi gee.vala.stamp: $(libgee_la_VALASOURCES) - $(VALAC) $(VALAFLAGS) -C --vapidir $(srcdir)/../vapi --pkg gobject-2.0 -H gee.h --library gee $^ + $(VALAC) $(COVERAGE_VALAFLAGS) $(VALAFLAGS) -C --vapidir $(srcdir)/../vapi --pkg gobject-2.0 -H gee.h --library gee $^ touch $@ libgee_la_LIBADD = \ + $(COVERAGE_LIBS) \ $(GLIB_LIBS) \ $(NULL) diff --git a/vala/Makefile.am b/vala/Makefile.am index e5bdde695..016d92414 100644 --- a/vala/Makefile.am +++ b/vala/Makefile.am @@ -1,6 +1,7 @@ NULL = AM_CPPFLAGS = \ + $(COVERAGE_CFLAGS) \ -I$(top_srcdir)/gee \ -I$(top_srcdir)/ccode \ $(GLIB_CFLAGS) \ @@ -165,10 +166,11 @@ valainclude_HEADERS = \ $(NULL) vala.vapi vala.vala.stamp: $(libvalacore_la_VALASOURCES) - $(VALAC) $(VALAFLAGS) -C --vapidir $(srcdir)/../vapi --pkg gobject-2.0 --vapidir ../gee --pkg gee --vapidir ../ccode --pkg ccode --pkg config -H vala.h --library vala $^ + $(VALAC) $(COVERAGE_VALAFLAGS) $(VALAFLAGS) -C --vapidir $(srcdir)/../vapi --pkg gobject-2.0 --vapidir ../gee --pkg gee --vapidir ../ccode --pkg ccode --pkg config -H vala.h --library vala $^ touch $@ libvalacore_la_LIBADD = \ + $(COVERAGE_LIBS) \ $(GLIB_LIBS) \ ../gee/libgee.la \ ../ccode/libvalaccode.la \ |