From 6f293994f8f9c260401fd76a189c7461b1b5f994 Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Tue, 27 Mar 2012 16:54:01 -0500 Subject: Added coverage tooling. --- Makefile.am | 2 ++ Makefile.am.coverage | 48 +++++++++++++++++++++++++++++ configure.ac | 14 +++++++++ m4/gcov.m4 | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/Makefile.am | 2 ++ 5 files changed, 152 insertions(+) create mode 100644 Makefile.am.coverage create mode 100644 m4/gcov.m4 diff --git a/Makefile.am b/Makefile.am index e19101d..583bb5f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,3 +46,5 @@ dist-hook: else \ echo Failed to generate AUTHORS: not a branch >&2; \ fi + +include $(top_srcdir)/Makefile.am.coverage diff --git a/Makefile.am.coverage b/Makefile.am.coverage new file mode 100644 index 0000000..fb97747 --- /dev/null +++ b/Makefile.am.coverage @@ -0,0 +1,48 @@ + +# Coverage targets + +.PHONY: clean-gcno clean-gcda \ + coverage-html generate-coverage-html clean-coverage-html \ + coverage-gcovr generate-coverage-gcovr clean-coverage-gcovr + +clean-local: clean-gcno clean-coverage-html clean-coverage-gcovr + +if HAVE_GCOV + +clean-gcno: + @echo Removing old coverage instrumentation + -find -name '*.gcno' -print | xargs -r rm + +clean-gcda: + @echo Removing old coverage results + -find -name '*.gcda' -print | xargs -r rm + +coverage-html: clean-gcda + -$(MAKE) $(AM_MAKEFLAGS) -k check + $(MAKE) $(AM_MAKEFLAGS) generate-coverage-html + +generate-coverage-html: + @echo Collecting coverage data + $(LCOV) --directory $(top_builddir) --capture --output-file coverage.info --no-checksum --compat-libtool + LANG=C $(GENHTML) --prefix $(top_builddir) --output-directory coveragereport --title "Code Coverage" --legend --show-details coverage.info + +clean-coverage-html: clean-gcda + -$(LCOV) --directory $(top_builddir) -z + -rm -rf coverage.info coveragereport + +if HAVE_GCOVR + +coverage-gcovr: clean-gcda + -$(MAKE) $(AM_MAKEFLAGS) -k check + $(MAKE) $(AM_MAKEFLAGS) generate-coverage-gcovr + +generate-coverage-gcovr: + @echo Generating coverage GCOVR report + $(GCOVR) -x -r $(top_builddir) -o $(top_builddir)/coverage.xml + +clean-coverage-gcovr: clean-gcda + -rm -rf $(top_builddir)/coverage.xml + +endif # HAVE_GCOVR + +endif # HAVE_GCOV diff --git a/configure.ac b/configure.ac index 7c067e9..f38947d 100644 --- a/configure.ac +++ b/configure.ac @@ -215,6 +215,19 @@ AC_ARG_ENABLE([tests], [enable_tests=yes]) AM_CONDITIONAL([WANT_TESTS], [test "x$enable_tests" != "xno"]) +########################### +# gcov coverage reporting +########################### + +m4_include([m4/gcov.m4]) +AC_TDD_GCOV +AM_CONDITIONAL([HAVE_GCOV], [test "x$ac_cv_check_gcov" = xyes]) +AM_CONDITIONAL([HAVE_LCOV], [test "x$ac_cv_check_lcov" = xyes]) +AM_CONDITIONAL([HAVE_GCOVR], [test "x$ac_cv_check_gcovr" = xyes]) +AC_SUBST(COVERAGE_CFLAGS) +AC_SUBST(COVERAGE_CXXFLAGS) +AC_SUBST(COVERAGE_LDFLAGS) + ########################### # Files ########################### @@ -256,4 +269,5 @@ Libappindicator Configuration: GTK+ Version: $with_gtk Tests: $enable_tests Mono tests: $have_nunit + gcov: $use_gcov ]) diff --git a/m4/gcov.m4 b/m4/gcov.m4 new file mode 100644 index 0000000..3163584 --- /dev/null +++ b/m4/gcov.m4 @@ -0,0 +1,86 @@ +# Checks for existence of coverage tools: +# * gcov +# * lcov +# * genhtml +# * gcovr +# +# Sets ac_cv_check_gcov to yes if tooling is present +# and reports the executables to the variables LCOV, GCOVR and GENHTML. +AC_DEFUN([AC_TDD_GCOV], +[ + AC_ARG_ENABLE(gcov, + AS_HELP_STRING([--enable-gcov], + [enable coverage testing with gcov]), + [use_gcov=$enableval], [use_gcov=no]) + + if test "x$use_gcov" = "xyes"; then + # we need gcc: + if test "$GCC" != "yes"; then + AC_MSG_ERROR([GCC is required for --enable-gcov]) + fi + + # Check if ccache is being used + AC_CHECK_PROG(SHTOOL, shtool, shtool) + case `$SHTOOL path $CC` in + *ccache*[)] gcc_ccache=yes;; + *[)] gcc_ccache=no;; + esac + + if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then + AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.]) + fi + + lcov_version_list="1.6 1.7 1.8 1.9" + AC_CHECK_PROG(LCOV, lcov, lcov) + AC_CHECK_PROG(GENHTML, genhtml, genhtml) + + if test "$LCOV"; then + AC_CACHE_CHECK([for lcov version], glib_cv_lcov_version, [ + glib_cv_lcov_version=invalid + lcov_version=`$LCOV -v 2>/dev/null | $SED -e 's/^.* //'` + for lcov_check_version in $lcov_version_list; do + if test "$lcov_version" = "$lcov_check_version"; then + glib_cv_lcov_version="$lcov_check_version (ok)" + fi + done + ]) + else + lcov_msg="To enable code coverage reporting you must have one of the following lcov versions installed: $lcov_version_list" + AC_MSG_ERROR([$lcov_msg]) + fi + + case $glib_cv_lcov_version in + ""|invalid[)] + lcov_msg="You must have one of the following versions of lcov: $lcov_version_list (found: $lcov_version)." + AC_MSG_ERROR([$lcov_msg]) + LCOV="exit 0;" + ;; + esac + + if test -z "$GENHTML"; then + AC_MSG_ERROR([Could not find genhtml from the lcov package]) + fi + + ac_cv_check_gcov=yes + ac_cv_check_lcov=yes + + # Remove all optimization flags from CFLAGS + changequote({,}) + CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'` + changequote([,]) + + # Add the special gcc flags + COVERAGE_CFLAGS="-O0 -fprofile-arcs -ftest-coverage" + COVERAGE_CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage" + COVERAGE_LDFLAGS="-lgcov" + + # Check availability of gcovr + AC_CHECK_PROG(GCOVR, gcovr, gcovr) + if test -z "$GCOVR"; then + ac_cv_check_gcovr=no + else + ac_cv_check_gcovr=yes + fi + +fi +]) # AC_TDD_GCOV diff --git a/src/Makefile.am b/src/Makefile.am index a4bd27a..a267f1f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -68,12 +68,14 @@ libappindicator_la_SOURCES = \ gen-notification-watcher.xml.c libappindicator_la_LDFLAGS = \ + $(COVERAGE_LDFLAGS) \ -version-info 1:0:0 \ -no-undefined \ -export-symbols-regex "^[^_d].*" libappindicator_la_CFLAGS = \ $(LIBRARY_CFLAGS) \ + $(COVERAGE_CFLAGS) \ -Wall -Werror \ -DG_LOG_DOMAIN=\"libappindicator\" -- cgit v1.2.3 From b894548cd9498d8a96743ca292287c3746d3545e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 16 Apr 2012 13:50:43 -0500 Subject: If we don't have a title set, use the application name to output the title --- src/app-indicator.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/app-indicator.c b/src/app-indicator.c index 0d6450c..2e98b48 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -1123,7 +1123,18 @@ bus_get_prop (GDBusConnection * connection, const gchar * sender, const gchar * } else if (g_strcmp0(property, "AttentionIconName") == 0) { return g_variant_new_string(priv->attention_icon_name ? priv->attention_icon_name : ""); } else if (g_strcmp0(property, "Title") == 0) { - return g_variant_new_string(priv->title ? priv->title : ""); + const gchar * output = NULL; + if (priv->title == NULL) { + const gchar * name = g_get_application_name(); + if (name != NULL) { + output = name; + } else { + output = ""; + } + } else { + output = priv->title; + } + return g_variant_new_string(output); } else if (g_strcmp0(property, "IconThemePath") == 0) { return g_variant_new_string(priv->icon_theme_path ? priv->icon_theme_path : ""); } else if (g_strcmp0(property, "Menu") == 0) { -- cgit v1.2.3 From 086dae17154b4da70d39cbf62a4cdd766ea1b132 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Sun, 10 Jun 2012 09:32:04 +0200 Subject: make building mono extension optional, so we can build on archs that do not have mono --- bindings/Makefile.am | 6 ++++-- configure.ac | 30 +++++++++++++++++++----------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/bindings/Makefile.am b/bindings/Makefile.am index 8e621e4..d1f6d73 100644 --- a/bindings/Makefile.am +++ b/bindings/Makefile.am @@ -1,10 +1,12 @@ if USE_GTK3 SUBDIRS = \ - mono \ vala else SUBDIRS = \ - mono \ python \ vala endif + +if HAS_MONO +SUBDIRS += mono +endif diff --git a/configure.ac b/configure.ac index 1a34310..ba9071d 100644 --- a/configure.ac +++ b/configure.ac @@ -106,10 +106,11 @@ AM_CONDITIONAL(HAVE_VALAC, [test "x$VALAC" != "x"]) MONO_REQUIRED_VERSION=1.0 PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false) +AM_CONDITIONAL(HAS_MONO, [test "x$has_mono" = "xtrue"]) AC_PATH_PROG(AL, al, no) if test "x$AL" = "xno" ; then - AC_MSG_ERROR([No al tool found. You need to install Mono.]) + AC_MSG_NOTICE([No al tool found. You need to install Mono.]) fi if test "x$has_mono" = "xtrue" ; then @@ -126,12 +127,12 @@ if test "x$has_mono" = "xtrue" ; then fi if test "x$CSC" = "xno" ; then - AC_MSG_ERROR([No Mono compiler found.]) + AC_MSG_NOTICE([No Mono compiler found.]) fi AC_PATH_PROG(GACUTIL, gacutil, no) if test "x$GACUTIL" = "xno" ; then - AC_MSG_ERROR([No gacutil tool found]) + AC_MSG_NOTICE([No gacutil tool found]) fi AC_SUBST(RUNTIME) @@ -143,9 +144,9 @@ AC_SUBST(GENERATED_SOURCES) GLIB_SHARP_REQ_VERSION=2.12.1 GTK_SHARP_REQ_VERSION=2.12 -PKG_CHECK_MODULES(GTK_SHARP, gtk-sharp-2.0 >= $GTK_SHARP_REQ_VERSION) +PKG_CHECK_MODULES(GTK_SHARP, gtk-sharp-2.0 >= $GTK_SHARP_REQ_VERSION, has_gtksharp=true, has_gtksharp=false) -PKG_CHECK_MODULES(GAPI, gapi-2.0 >= $GLIB_SHARP_REQ_VERSION) +PKG_CHECK_MODULES(GAPI, gapi-2.0 >= $GLIB_SHARP_REQ_VERSION, has_gapi=true, has_gapi=false) AC_PATH_PROG(GAPI_PARSER, gapi2-parser, no) AC_SUBST(GAPI_PARSER) AC_PATH_PROG(GAPI_CODEGEN, gapi2-codegen, no) @@ -238,12 +239,6 @@ src/Makefile src/appindicator-0.1.pc src/appindicator3-0.1.pc bindings/Makefile -bindings/mono/Makefile -bindings/mono/appindicator-sharp.dll.config -bindings/mono/appindicator-sharp-0.1.pc -bindings/mono/app-indicator.sources.xml -bindings/mono/examples/Makefile -bindings/mono/examples/indicator-example bindings/python/Makefile bindings/python/appindicator.override bindings/vala/Makefile @@ -255,6 +250,18 @@ docs/reference/Makefile docs/reference/version.xml docs/reference/libappindicator-docs.sgml ]) + +if test "x$has_mono" = "xtrue" ; then + AC_CONFIG_FILES([ + bindings/mono/Makefile + bindings/mono/appindicator-sharp.dll.config + bindings/mono/appindicator-sharp-0.1.pc + bindings/mono/app-indicator.sources.xml + bindings/mono/examples/Makefile + bindings/mono/examples/indicator-example + ]) +fi + AC_OUTPUT ########################### @@ -267,6 +274,7 @@ Libappindicator Configuration: Prefix: $prefix GTK+ Version: $with_gtk + Mono: $has_mono Tests: $enable_tests Mono tests: $have_nunit gcov: $use_gcov -- cgit v1.2.3 From 96fc7f90f40b8835d5ab1fbd4169fc35aa17cf18 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Sun, 10 Jun 2012 10:03:43 +0200 Subject: don't include build-time filenames in comments of the enum header files If we do, the header files may be different on each build. This is especially harmful when building multiple times for multiple architectures and expecting the files to be identical. --- src/app-indicator-enum-types.c.in | 2 +- src/app-indicator-enum-types.h.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app-indicator-enum-types.c.in b/src/app-indicator-enum-types.c.in index e200396..26276dc 100644 --- a/src/app-indicator-enum-types.c.in +++ b/src/app-indicator-enum-types.c.in @@ -32,7 +32,7 @@ License version 3 and version 2.1 along with this program. If not, see /*** END file-header ***/ /*** BEGIN file-production ***/ -#include "@filename@" +#include "@basename@" /*** END file-production ***/ /*** BEGIN value-header ***/ diff --git a/src/app-indicator-enum-types.h.in b/src/app-indicator-enum-types.h.in index a055d71..33e501f 100644 --- a/src/app-indicator-enum-types.h.in +++ b/src/app-indicator-enum-types.h.in @@ -44,7 +44,7 @@ G_END_DECLS /*** END file-tail ***/ /*** BEGIN file-production ***/ -/* Enumerations from file: "@filename@" */ +/* Enumerations from file: "@basename@" */ /*** END file-production ***/ /*** BEGIN value-header ***/ -- cgit v1.2.3 From f2744fa7a2ec60767c0fa4b4e358dac86a867ad1 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 11 Jul 2012 12:28:57 -0500 Subject: bump version to 12.10.0 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ba9071d..ee03390 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([libappindicator], - [0.4.92], + [12.10.0], [http://bugs.launchpad.net/libappindicator], [libappindicator], [http://launchpad.net/libappindicator]) -- cgit v1.2.3