[gspell] Add code coverage support for unit tests
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gspell] Add code coverage support for unit tests
- Date: Wed, 9 Mar 2016 10:09:13 +0000 (UTC)
commit b71a52018c760b32539753253d5f736e809f1c57
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Mar 9 10:58:14 2016 +0100
Add code coverage support for unit tests
Having green colors should be a good motivation to write more unit
tests. Let's see if it works.
Makefile.am | 3 +++
configure.ac | 5 +++++
gspell/Makefile.am | 23 +++++++++++++++++------
testsuite/Makefile.am | 2 ++
4 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index a998a5b..9926b37 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,6 +23,7 @@ MAINTAINERCLEANFILES = \
m4/ax_append_link_flags.m4 \
m4/ax_check_compile_flag.m4 \
m4/ax_check_link_flag.m4 \
+ m4/ax_code_coverage.m4 \
m4/ax_compiler_flags_cflags.m4 \
m4/ax_compiler_flags_gir.m4 \
m4/ax_compiler_flags_ldflags.m4 \
@@ -76,4 +77,6 @@ MAINTAINERCLEANFILES = \
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
+ CODE_COVERAGE_RULES@
+
-include $(top_srcdir)/git.mk
diff --git a/configure.ac b/configure.ac
index 90f19e3..3e25a92 100644
--- a/configure.ac
+++ b/configure.ac
@@ -127,6 +127,10 @@ GOBJECT_INTROSPECTION_CHECK([1.42.0])
AX_REQUIRE_DEFINED([VAPIGEN_CHECK])
VAPIGEN_CHECK
+# Code coverage for unit tests
+AX_REQUIRE_DEFINED([AX_CODE_COVERAGE])
+AX_CODE_COVERAGE()
+
# check for osx platform
AC_MSG_CHECKING([for Mac OS X platform])
case "$host" in
@@ -199,4 +203,5 @@ Configuration:
Compiler: ${CC}
GObject introspection: ${found_introspection}
Vala: ${enable_vala}
+ Code coverage: ${enable_code_coverage}
"
diff --git a/gspell/Makefile.am b/gspell/Makefile.am
index 80aba68..efbdeed 100644
--- a/gspell/Makefile.am
+++ b/gspell/Makefile.am
@@ -1,5 +1,7 @@
SUBDIRS = resources
+ CODE_COVERAGE_RULES@
+
AM_CPPFLAGS = \
-DDATADIR=\""$(datadir)"\" \
-DG_LOG_DOMAIN=\"gspell\" \
@@ -7,11 +9,10 @@ AM_CPPFLAGS = \
-I$(top_builddir) \
-I$(top_srcdir) \
$(WARN_CFLAGS) \
+ $(CODE_COVERAGE_CPPFLAGS) \
$(DEP_CFLAGS) \
$(GTK_MAC_CFLAGS)
-AM_LDFLAGS = $(WARN_LDFLAGS)
-
BUILT_SOURCES = \
gspell-resources.c
@@ -70,8 +71,13 @@ libgspell_core_la_SOURCES = \
nodist_libgspell_core_la_SOURCES = \
$(BUILT_SOURCES)
-libgspell_core_la_LDFLAGS = \
- -no-undefined
+libgspell_core_la_CFLAGS = \
+ $(CODE_COVERAGE_CFLAGS)
+
+libgspell_core_la_LDFLAGS = \
+ -no-undefined \
+ $(WARN_LDFLAGS) \
+ $(CODE_COVERAGE_LDFLAGS)
# The real library.
lib_LTLIBRARIES = libgspell-1.la
@@ -83,10 +89,15 @@ libgspell_1_la_LIBADD = \
$(DEP_LIBS) \
$(GTK_MAC_LIBS)
+libgspell_1_la_CFLAGS = \
+ $(CODE_COVERAGE_CFLAGS)
+
libgspell_1_la_LDFLAGS = \
-version-info $(GSPELL_LT_VERSION) \
-no-undefined \
- -export-symbols-regex "^gspell_.*"
+ -export-symbols-regex "^gspell_.*" \
+ $(WARN_LDFLAGS) \
+ $(CODE_COVERAGE_LDFLAGS)
libgspell_1_includedir = $(includedir)/gspell-1/gspell
libgspell_1_include_HEADERS = $(gspell_public_headers)
@@ -101,7 +112,7 @@ if OS_OSX
libgspell_1_la_LDFLAGS += \
-framework Cocoa
-libgspell_1_la_CFLAGS = \
+libgspell_1_la_CFLAGS += \
-xobjective-c
gspell_private_headers += \
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index 8f3b34d..06a56d4 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -1,3 +1,5 @@
+ CODE_COVERAGE_RULES@
+
AM_CPPFLAGS = \
-I$(top_srcdir) \
$(WARN_CFLAGS) \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]