diff --git a/Makefile.am b/Makefile.am index ab91664e..695fd42d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -## Copyright (C) 2008-2018 Dirk-Jan C. Binnema +## Copyright (C) 2008-2020 Dirk-Jan C. Binnema ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -28,13 +28,7 @@ else mu4e= endif -# if BUILD_PERL -# perl=perl -# else -# perl= -# endif - -SUBDIRS=m4 man lib $(guile) mu $(mu4e) contrib toys # $(perl) +SUBDIRS=m4 man lib $(guile) mu $(mu4e) contrib toys ACLOCAL_AMFLAGS=-I m4 @@ -95,3 +89,9 @@ EXTRA_DIST= \ doc_DATA = \ NEWS.org + +include $(top_srcdir)/aminclude_static.am + +CODE_COVERAGE_IGNORE_PATTERN= \ + '/usr/*' \ + '*test-*' diff --git a/configure.ac b/configure.ac index 449c9bfd..cf2751b2 100644 --- a/configure.ac +++ b/configure.ac @@ -55,6 +55,9 @@ AX_VALGRIND_CHECK LT_INIT + +AX_CODE_COVERAGE + AC_PROG_AWK AC_CHECK_PROG(SORT,sort,sort) @@ -120,20 +123,20 @@ AS_IF([test "x$ac_cv_member_struct_dirent_d_ino" != "xyes"], AC_CHECK_FUNCS([memset memcpy realpath setlocale strerror getpass setsid]) AC_CHECK_FUNCS([vasprintf strptime]) -AC_CHECK_FUNC(timegm,[],[AC_MSG_ERROR([*** missing required function timegm])]) +AC_CHECK_FUNC(timegm,[],AC_MSG_ERROR([missing required function timegm])) # require pkg-config >= 0.28 (release in 2013; should be old enough...) # with that version, we don't need the AC_SUBST stuff after PKG_CHECK. m4_ifndef([PKG_PROG_PKG_CONFIG], [m4_fatal([please install pkg-config >= 0.28 before running autoconf/autogen])]) PKG_PROG_PKG_CONFIG(0.28) # latest version in buildroot -AS_IF([test -z "$PKG_CONFIG"],[ +AS_IF([test -z "$PKG_CONFIG"], AC_MSG_ERROR([ *** pkg-config with version >= 0.28 could not be found. *** *** Make sure it is in your path, or set the PKG_CONFIG environment variable *** to the full path to pkg-config.]) -]) +) # glib2? PKG_CHECK_MODULES(GLIB,glib-2.0 >= 2.38 gobject-2.0 gio-2.0) @@ -165,7 +168,7 @@ AS_IF([test "x$XAPIAN_CONFIG" = "xno"],[ AS_CASE([$xapian_version], [1.[[4-9]].[[0-9]]*], [AC_DEFINE([XAPIAN_HAVE_OP_WILDCARD],[1],[Xapian::Query::OP_WILDCARD?])], - [AC_MSG_ERROR([*** xapian version >= 1.4 needed, but version $xapian_version found.])]) + [AC_MSG_ERROR([*** xapian version >= 1.4 needed, but version $xapian_version found.])]) XAPIAN_CXXFLAGS="$($XAPIAN_CONFIG --cxxflags)" XAPIAN_LIBS="$($XAPIAN_CONFIG --libs)" @@ -252,12 +255,10 @@ AS_IF([test "x$PMCCABE" = "xno"],[ AC_CONFIG_FILES([ Makefile mu/Makefile -mu/tests/Makefile lib/Makefile lib/doxyfile lib/utils/Makefile lib/parser/Makefile -lib/tests/Makefile mu4e/Makefile mu4e/mu4e-meta.el guile/Makefile diff --git a/gtest.mk b/gtest.mk index 1d258881..159576ec 100644 --- a/gtest.mk +++ b/gtest.mk @@ -16,20 +16,19 @@ TEST_PROGS= -# + # NOTE: we set the locale/tz to some well-know values, so the tests # (at least when running under 'make check') run in a predictable # environment. There are specific tests different timezone, though. # - test: all $(TEST_PROGS) @export LC_ALL="en_US.utf8" @export TZ="Europe/Helsinki" - @test -z "$(TEST_PROGS)" || gtester --verbose $(TEST_PROGS) || exit $$?; \ - test -z "$(SUBDIRS)" || \ - for subdir in $(SUBDIRS); do \ - test "$$subdir" = "." || \ - (cd ./$$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $$? ; \ + @test -z "$(TEST_PROGS)" || gtester --verbose $(TEST_PROGS) || exit $$?; \ + test -z "$(SUBDIRS)" || \ + for subdir in $(SUBDIRS); do \ + test "$$subdir" = "." || \ + (cd ./$$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $$? ; \ done .PHONY: test gprof diff --git a/lib/parser/Makefile.am b/lib/parser/Makefile.am index 20b2a41d..07288081 100644 --- a/lib/parser/Makefile.am +++ b/lib/parser/Makefile.am @@ -1,4 +1,4 @@ -## Copyright (C) 2017-2019 Dirk-Jan C. Binnema +## Copyright (C) 2017-2020 Dirk-Jan C. Binnema ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -24,41 +24,22 @@ AM_CXXFLAGS= \ $(GLIB_CFLAGS) \ $(XAPIAN_CXXFLAGS) \ $(WARN_CXXFLAGS) \ - $(GCOV_CFLAGS) \ $(ASAN_CXXFLAGS) \ + $(CODE_COVERAGE_CFLAGS) \ -Wno-inline \ -Wno-switch-enum AM_CPPFLAGS= \ - $(GCOV_CFLAGS) + $(CODE_COVERAGE_CPPFLAGS) AM_LDFLAGS= \ $(ASAN_LDFLAGS) \ - $(WARN_LDFLAGS) \ - $(GCOV_LDADD) + $(WARN_LDFLAGS) noinst_PROGRAMS= \ tokenize \ parse -tokenize_SOURCES= \ - tokenize.cc - -tokenize_LDADD= \ - $(WARN_LDFLAGS) \ - $(GCOV_LDADD) \ - libmu-parser.la \ - ../utils/libmu-utils.la - -parse_SOURCES= \ - parse.cc - -parse_LDADD= \ - $(WARN_LDFLAGS) \ - $(GCOV_LDADD) \ - libmu-parser.la \ - ../utils/libmu-utils.la - noinst_LTLIBRARIES= \ libmu-parser.la @@ -76,12 +57,27 @@ libmu_parser_la_SOURCES= \ libmu_parser_la_LIBADD= \ $(WARN_LDFLAGS) \ $(GLIB_LIBS) \ - $(XAPIAN_LIBS) - + $(XAPIAN_LIBS) \ + ../utils/libmu-utils.la \ + $(CODE_COVERAGE_LIBS) VALGRIND_SUPPRESSIONS_FILES= \ ${top_srcdir}/mu.supp +tokenize_SOURCES= \ + tokenize.cc + +tokenize_LDADD= \ + $(WARN_LDFLAGS) \ + libmu-parser.la + +parse_SOURCES= \ + parse.cc + +parse_LDADD= \ + $(WARN_LDFLAGS) \ + libmu-parser.la + noinst_PROGRAMS+=$(TEST_PROGS) TEST_PROGS+= \ @@ -89,18 +85,15 @@ TEST_PROGS+= \ test_tokenizer_SOURCES= \ test-tokenizer.cc test_tokenizer_LDADD= \ - $(GCOV_LDADD) \ - libmu-parser.la \ - ../utils/libmu-utils.la + libmu-parser.la TEST_PROGS+= \ test-parser test_parser_SOURCES= \ test-parser.cc test_parser_LDADD= \ - $(GCOV_LDADD) \ - libmu-parser.la \ - ../utils/libmu-utils.la - + libmu-parser.la TESTS=$(TEST_PROGS) + +include $(top_srcdir)/aminclude_static.am diff --git a/lib/utils/Makefile.am b/lib/utils/Makefile.am index da174cb3..684993fc 100644 --- a/lib/utils/Makefile.am +++ b/lib/utils/Makefile.am @@ -20,17 +20,25 @@ AM_CFLAGS= \ $(WARN_CFLAGS) \ $(GLIB_CFLAGS) \ $(ASAN_CFLAGS) \ - -DMU_TESTMAILDIR=\"${abs_top_srcdir}/lib/tests/testdir\" \ - -DMU_TESTMAILDIR2=\"${abs_top_srcdir}/lib/tests/testdir2\" \ + $(CODE_COVERAGE_CFLAGS) \ + -DMU_TESTMAILDIR=\"${abs_top_srcdir}/lib/testdir\" \ + -DMU_TESTMAILDIR2=\"${abs_top_srcdir}/lib/testdir2\" \ -Wno-format-nonliteral \ -Wno-switch-enum \ -Wno-deprecated-declarations \ -Wno-inline +AM_CPPFLAGS= \ + $(CODE_COVERAGE_CPPFLAGS) + AM_CXXFLAGS= \ $(WARN_CXXFLAGS) \ $(GLIB_CFLAGS) \ - $(ASAN_CXXFLAGS) + $(ASAN_CXXFLAGS) \ + $(CODE_COVERAGE_CFLAGS) + +AM_LDFLAGS= \ + $(ASAN_LDFLAGS) noinst_LTLIBRARIES= \ libmu-utils.la @@ -49,10 +57,8 @@ libmu_utils_la_SOURCES= \ mu-utils.hh libmu_utils_la_LIBADD= \ - $(GLIB_LIBS) - -libmu_utils_la_LDFLAGS= \ - $(ASAN_LDFLAGS) + $(GLIB_LIBS) \ + $(CODE_COVERAGE_LIBS) noinst_PROGRAMS= \ $(TEST_PROGS) @@ -77,3 +83,7 @@ test_mu_str_SOURCES= \ test-mu-str.c test_mu_str_LDADD= \ libmu-utils.la + +TESTS=$(TEST_PROGS) + +include $(top_srcdir)/aminclude_static.am