gnucash master: Multiple changes pushed
John Ralls
jralls at code.gnucash.org
Sat Jan 17 19:32:18 EST 2015
Updated via https://github.com/Gnucash/gnucash/commit/46a3c5fb (commit)
via https://github.com/Gnucash/gnucash/commit/60b86ce8 (commit)
from https://github.com/Gnucash/gnucash/commit/128bfb6b (commit)
commit 46a3c5fb8943a1050f713e9937d72150d2cd30cb
Author: John Ralls <jralls at ceridwen.us>
Date: Sat Jan 17 17:22:07 2015 -0800
More dithering with Clang error messages.
This reverts the bits in qof that were originally changed in 02acf2b
because those changes applied to the C version of the messages but
not to the C++ version.
diff --git a/src/libqof/qof/test/test-gnc-date.c b/src/libqof/qof/test/test-gnc-date.c
index 9238ab2..c2fc38d 100644
--- a/src/libqof/qof/test/test-gnc-date.c
+++ b/src/libqof/qof/test/test-gnc-date.c
@@ -87,7 +87,7 @@ test_gnc_localtime (void)
// difference between g_date_time and tm->tm_wday)
};
guint ind;
-#if defined(__clang__) && __clang_major__ < 6
+#if defined(__clang__)
#define _func "struct tm *gnc_localtime_r(const time64 *, struct tm *)"
#else
#define _func "tm* gnc_localtime_r(const time64*, tm*)"
@@ -159,7 +159,7 @@ test_gnc_gmtime (void)
#endif
};
guint ind;
-#if defined(__clang__) && __clang_major__ < 6
+#if defined(__clang__)
#define _func "struct tm *gnc_gmtime(const time64 *)"
#else
#define _func "tm* gnc_gmtime(const time64*)"
@@ -1741,7 +1741,7 @@ test_gnc_timespec_to_iso8601_buff (void)
gchar *end;
gchar *logdomain = "qof";
guint loglevel = G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL;
-#if defined(__clang__) && __clang_major__ < 6
+#if defined(__clang__)
#define _func "char *gnc_timespec_to_iso8601_buff(Timespec, char *)"
#else
#define _func "char* gnc_timespec_to_iso8601_buff(Timespec, char*)"
diff --git a/src/libqof/qof/test/test-qofbook.c b/src/libqof/qof/test/test-qofbook.c
index bc2f701..81c3cae 100644
--- a/src/libqof/qof/test/test-qofbook.c
+++ b/src/libqof/qof/test/test-qofbook.c
@@ -601,7 +601,7 @@ test_book_foreach_collection( Fixture *fixture, gconstpointer pData )
QofIdType my_type = "my_type", my_type2 = "my_type2";
guint param = (guint) g_test_rand_int();
/* GLib assertion messages which aren't filtered to make clang's output like gcc's */
-#if defined(__clang__) && __clang_major__ < 6
+#if defined(__clang__)
#define _func "void qof_book_foreach_collection(const QofBook *, QofCollectionForeachCB, gpointer)"
#else
#define _func "void qof_book_foreach_collection(const QofBook*, QofCollectionForeachCB, gpointer)"
commit 60b86ce80f392e39fe6960a900be8f7f6719695c
Author: John Ralls <jralls at ceridwen.us>
Date: Sat Jan 17 13:21:40 2015 -0800
Adjust gtest config & make for shared library use.
Because that's how Fedora packages it.
Also make it a default-if-found so there's no extra config required
on Debian and Fedora work-alikes.
Note that it won't work on Fedora18 because they provide a library for
gmock and it's a different version from gtest.
diff --git a/configure.ac b/configure.ac
index add19e9..2c9529e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -766,22 +766,40 @@ AM_CONDITIONAL(WITH_GOOGLE_PROFILER, [test x$enable_google_profile = xyes])
### Google Test and Mock Support: https://code.google.com/p/googletest/ and
### https://code.google.com/p/googlemock/
### ---------------------------------------------------------------------------
-enable_google_test=no
ac_cv_gmock_root=""
ac_cv_gmock_headers=""
ac_cv_gtest_root=""
ac_cv_gtest_headers=""
+ac_cv_gtest_libs=""
+ac_cv_gmock_libs=""
+
AC_ARG_ENABLE( google-test,
- [AS_HELP_STRING([--enable-google-test], [build the Google Test and Google Mock static libraries and enable C++ Unit Tests])],
- [enable_google_test=yes])
-if test x$enable_google_test = xyes; then
- AC_CHECK_FILES([/usr/src/gtest/src/gtest-all.cc /usr/src/gmock/src/gmock-all.cc /usr/include/gtest/gtest.h /usr/include/gmock/gmock.h],
- [ac_cv_gtest_system_install=yes],[ac_cv_gtest_system_install=no])
+ [AS_HELP_STRING([--disable-google-test], [do not build the Google Test and Google Mock static libraries and enable C++ Unit Tests])],,[enable_google_test=yes])
+if test x$enable_google_test != xno; then
+ AC_CHECK_LIB([gtest_main], [main],
+ [AC_CHECK_FILES([/usr/src/gmock/gmock-all.cc
+ /usr/include/gtest/gtest.h
+ /usr/include/gmock/gmock.h],
+ [ac_cv_gtest_system_install=yes] [ac_cv_have_gtest_libs=yes],
+ [ac_cv_gtest_system_install=no])],
+ [AC_CHECK_FILES([/usr/src/gtest/src/gtest-all.cc
+ /usr/src/gtest/gtest-main.cc
+ /usr/src/gmock/src/gmock-all.cc
+ /usr/include/gtest/gtest.h
+ /usr/include/gmock/gmock.h],
+ [ac_cv_gtest_system_install=yes] [ac_cv_have_gtest_libs=no],
+ [ac_cv_gtest_system_install=no])]
+ )
fi
-if test x$ac_cv_file__usr_include_gmock_gmock_h = xyes -a x$ac_cv_file__usr_include_gtest_gtest_h = xyes -a x$ac_cv_file__usr_src_gmock_src_gmock_all_cc = xyes -a x$ac_cv_file__usr_src_gtest_src_gtest_all_cc = xyes; then
- ac_cv_gtest_system_install=yes
-else
- ac_cv_gtest_system_install=no
+if test x$ac_cv_file__usr_include_gmock_gmock_h = xyes -a x$ac_cv_file__usr_include_gtest_gtest_h = xyes; then
+ if test x$ac_cv_file__usr_src_gmock_src_gmock_all_cc = xyes -a x$ac_cv_file__usr_src_gtest_src_gtest_all_cc = xyes; then
+ ac_cv_gtest_system_install=yes
+ elif test "x$ac_cv_have_gtest_libs" = xyes; then
+ ac_cv_gtest_system_install=yes
+ ac_cv_gtest_libs="-lgtest -lgtest_main"
+ else
+ ac_cv_gtest_system_install=no
+ fi
fi
AC_ARG_WITH([gtest-root],
@@ -810,7 +828,7 @@ if test x$enable_google_test = xyes; then
ac_cv_gtest_root=""
fi
fi
- if test -z "$ac_cv_gtest_root"; then
+ if test -z "$ac_cv_gtest_root" -a -z "$ac_cv_gtest_libs"; then
AC_MSG_RESULT([No gtest-root])
enable_google_test=no
else
@@ -834,13 +852,28 @@ if test x$enable_google_test = xyes; then
ac_cv_gtest_headers=$ac_cv_gtest_root/include
fi
fi
- if test -n "$ac_cv_gmock_root" -a -r "$ac_cv_gmock_root/src/gmock-all.cc"; then
+
+ dnl Fedora installs gmock sources in /usr/src/gmock without a src
+ dnl subdir, unlike Debian or the distribution tarball, so we have to
+ dnl make GMOCK_ROOT include src if it's there.
+
+ if test -n "$ac_cv_gmock_root" -a -r "$ac_cv_gmock_root/gmock-all.cc"; then
+ ac_cv_gmock_src_path="$ac_cv_gmock_root"
+ AC_MSG_WARN([Skipped setting ac_cv_gmock_root, value $ac_cv_gmock_root])
+ elif test -n "$ac_cv_gmock_root" -a -r "$ac_cv_gmock_root/src/gmock-all.cc"; then
+ ac_cv_gmock_src_path="$ac_cv_gmock_root/src"
AC_MSG_WARN([Skipped setting ac_cv_gmock_root, value $ac_cv_gmock_root])
else
if test -n "${GMOCK_ROOT}" -a -r "${GMOCK_ROOT}/src/gmock-all.cc"; then
- ac_cv_gmock_root=${GMOCK_ROOT}
+ ac_cv_gmock_src_path=${GMOCK_ROOT}/src
elif test "x$ac_cv_gtest_system_install" = "xyes"; then
- ac_cv_gmock_root="/usr/src/gmock"
+ if test "x$ac_cv_file__usr_src_gmock_src_gmock_all_cc" = xyes; then
+ ac_cv_gmock_src_path="/usr/src/gmock/src"
+ elif test "x$ac_cv_file__usr_src_gmock_gmock_all_cc" = xyes; then
+ ac_cv_gmock_src_path="/usr/src/gmock"
+ else
+ ac_cv_gmock_root=""
+ fi
else
ac_cv_gmock_root=""
fi
@@ -866,19 +899,21 @@ if test x$enable_google_test = xyes; then
enable_google_test=no
fi
else
- ac_cv_gmock_headers=$ac_cv_gmock_root/include
+ ac_cv_gmock_headers="$ac_cv_gmock_root/include"
fi
fi
if test "x$enable_google_test" = "xyes"; then
AC_MSG_RESULT([Yes])
fi
fi
-AC_SUBST([GTEST_ROOT], [$ac_cv_gtest_root])
+AC_SUBST([GTEST_LIBS], [$ac_cv_gtest_libs])
+AC_SUBST([GTEST_SRC], [$ac_cv_gtest_root])
AC_SUBST([GTEST_HEADERS], [$ac_cv_gtest_headers])
-AC_SUBST([GMOCK_ROOT], [$ac_cv_gmock_root])
+AC_SUBST([GMOCK_SRC_PATH], [$ac_cv_gmock_src_path])
+AC_SUBST([GMOCK_SRC], [$ac_cv_gmock_root])
AC_SUBST([GMOCK_HEADERS], [$ac_cv_gmock_headers])
AM_CONDITIONAL([WITH_GOOGLE_TEST], [test "x$enable_google_test" = "xyes"])
-
+AM_CONDITIONAL([GOOGLE_TEST_LIBS], [test "x$ac_cv_gtest_libs" != "x"])
### --------------------------------------------------------------------------
### Register2
AC_ARG_ENABLE( register2,
diff --git a/src/libqof/qof/test/Makefile.am b/src/libqof/qof/test/Makefile.am
index 6cdcae5..05174d6 100644
--- a/src/libqof/qof/test/Makefile.am
+++ b/src/libqof/qof/test/Makefile.am
@@ -38,15 +38,16 @@ test_kvp_value_SOURCES = \
$(top_srcdir)/$(MODULEPATH)/kvp-value.cpp \
test-kvp-value.cpp \
test-kvp-frame.cpp
-
-nodist_test_kvp_value_SOURCES = \
- ${GTEST_ROOT}/src/gtest_main.cc
-
test_kvp_value_LDADD = \
$(top_builddir)/$(MODULEPATH)/libgnc-qof.la \
- $(top_builddir)/src/test-core/libgtest.a \
- $(GLIB_LIBS) \
+ $(GLIB_LIBS) \
+ $(GTEST_LIBS) \
$(BOOST_LDFLAGS)
+if !GOOGLE_TEST_LIBS
+nodist_test_kvp_value_SOURCES = \
+ ${GTEST_SRC}/src/gtest_main.cc
+test_kvp_value_LDADD += $(top_builddir)/src/test-core/libgtest.a
+endif
test_kvp_value_CPPFLAGS = \
-I$(GTEST_HEADERS) \
@@ -54,20 +55,23 @@ test_kvp_value_CPPFLAGS = \
$(BOOST_CPPFLAGS) \
$(GLIB_CFLAGS)
+check_PROGRAMS += test-kvp-value
+
test_gnc_int128_SOURCES = \
$(top_srcdir)/${MODULEPATH}/gnc-int128.cpp \
gtest-gnc-int128.cpp
-
-nodist_test_gnc_int128_SOURCES = \
- ${GTEST_ROOT}/src/gtest_main.cc
-
test_gnc_int128_CPPFLAGS = \
-I${GTEST_HEADERS} \
${GLIB_CFLAGS}
test_gnc_int128_LDADD = \
${GLIB_LIBS} \
- $(top_builddir)/src/test-core/libgtest.a
+ $(GTEST_LIBS)
+if !GOOGLE_TEST_LIBS
+nodist_test_gnc_int128_SOURCES = \
+ ${GTEST_SRC}/src/gtest_main.cc
+test_gnc_int128_LDADD += $(top_builddir)/src/test-core/libgtest.a
+endif
check_PROGRAMS += test-gnc-int128
endif
diff --git a/src/test-core/Makefile.am b/src/test-core/Makefile.am
index 636c582..3c0c06e 100644
--- a/src/test-core/Makefile.am
+++ b/src/test-core/Makefile.am
@@ -80,13 +80,17 @@ _unittest_support_la_LIBADD = \
endif
if WITH_GOOGLE_TEST
+if GOOGLE_TEST_LIBS
+noinst_LIBRARIES = libgmock.a
+else
noinst_LIBRARIES = \
libgtest.a \
libgmock.a
-nodist_libgtest_a_SOURCES = ${GTEST_ROOT}/src/gtest-all.cc
-nodist_libgmock_a_SOURCES = ${GMOCK_ROOT}/src/gmock-all.cc
-libgtest_a_CPPFLAGS = ${AM_CPPFLAGS} -I${GTEST_HEADERS} -I${GTEST_ROOT}
-libgmock_a_CPPFLAGS = ${libgtest_a_CPPFLAGS} -I${GMOCK_HEADERS} -I${GMOCK_ROOT}
+nodist_libgtest_a_SOURCES = ${GTEST_SRC}/src/gtest-all.cc
+libgtest_a_CPPFLAGS = ${AM_CPPFLAGS} -I${GTEST_HEADERS} -I${GTEST_SRC}
+endif
+nodist_libgmock_a_SOURCES = ${GMOCK_SRC_PATH}/gmock-all.cc
+libgmock_a_CPPFLAGS = ${libgtest_a_CPPFLAGS} -I${GMOCK_HEADERS} -I${GMOCK_SRC}
endif
gncscmmoddir = ${GNC_SCM_INSTALL_DIR}/gnucash
Summary of changes:
configure.ac | 71 +++++++++++++++++++++++++++----------
src/libqof/qof/test/Makefile.am | 26 ++++++++------
src/libqof/qof/test/test-gnc-date.c | 6 ++--
src/libqof/qof/test/test-qofbook.c | 2 +-
src/test-core/Makefile.am | 12 ++++---
5 files changed, 80 insertions(+), 37 deletions(-)
More information about the gnucash-changes
mailing list