compilation: fixes + installation of client-test + version bump
Removed a spurious package check for synthesis which was reintroduced during the recent code cleanup and merging. Fixed compilation with --enable-unit-tests and/or --enable-integration-tests. CPPUnit header files were not included properly. When at least one of these enable options is used, client-test is built as part of the normal "make all" and installed in bindir as part of "make install". The test files go into the docdir.
This commit is contained in:
parent
73afb09d76
commit
d1a2631e28
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,6 +2,7 @@
|
|||
/.dotest
|
||||
/Makefile.am
|
||||
aclocal.m4
|
||||
m4
|
||||
autom4te.cache
|
||||
config.guess
|
||||
config.h.in
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
SUBDIRS = src test
|
||||
|
||||
EXTRA_DIST = HACKING description configure-pre.in configure-post.in autogen.sh Makefile-gen.am Doxyfile
|
||||
|
|
|
@ -29,5 +29,5 @@ sed -e "s;@CONFIG_SUBS@;$SUBS;" \
|
|||
libtoolize -c
|
||||
aclocal
|
||||
autoheader
|
||||
automake -a -c
|
||||
automake -a -c -Wno-portability
|
||||
autoconf
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
dnl -*- mode: Autoconf; -*-
|
||||
dnl Invoke autogen.sh to produce a configure script.
|
||||
|
||||
AC_INIT([syncevolution], [0.9-alpha-2009-03-02])
|
||||
AC_INIT([syncevolution], [0.9alpha20090313])
|
||||
AM_INIT_AUTOMAKE([tar-ustar])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
define([SYNTHESISSRC_REPO], [])
|
||||
dnl Specify git revisions/branches without prefix, i.e., without 'origin'.
|
||||
dnl We'll sort that out below.
|
||||
|
@ -13,9 +14,6 @@ AC_LIBTOOL_DLOPEN
|
|||
dnl default device type (see AC_DEFINE below)
|
||||
DEVICE_TYPE=desktop
|
||||
|
||||
# options to be used when configuring client library
|
||||
CLIENT_CONFIGURE_OPTIONS=
|
||||
|
||||
AC_ARG_WITH(synthesis-src,
|
||||
AS_HELP_STRING([--with-synthesis-src=<base directory|svn URL|git URL>],
|
||||
[Specifies location of the Synthesis root directory.
|
||||
|
@ -83,28 +81,21 @@ AC_ARG_ENABLE(maemo,
|
|||
MODIFY_SYNCCOMPARE='-e "s/use encoding/#use encoding/;" -e "s/:utf8//;"'])
|
||||
AC_SUBST(MODIFY_SYNCCOMPARE)
|
||||
|
||||
PKG_CHECK_MODULES(SYNTHESIS, "synthesis")
|
||||
|
||||
AC_CHECK_HEADERS(signal.h dlfcn.h)
|
||||
|
||||
# cppunit needed?
|
||||
if test $enable_unit_tests == "yes" || test $enable_integration_tests == yes; then
|
||||
CPPUNIT_CXXFLAGS=`cppunit-config --cflags` || AC_MSG_ERROR("cppunit-config --cflags failed - is it installed?")
|
||||
CPPUNIT_LDFLAGS=`cppunit-config --libs` || AC_MSG_ERROR("cppunit-config --libs failed - is it installed?")
|
||||
CPPUNIT_TESTS=client-test
|
||||
fi
|
||||
AC_SUBST(CPPUNIT_CXXFLAGS)
|
||||
AC_SUBST(CPPUNIT_LDFLAGS)
|
||||
AC_SUBST(CPPUNIT_TESTS)
|
||||
|
||||
if test $enable_unit_tests == "yes"; then
|
||||
CLIENT_CONFIGURE_OPTIONS="$CLIENT_CONFIGURE_OPTIONS --enable-unit-tests"
|
||||
if test "$enable_unit_tests" = "yes"; then
|
||||
AC_DEFINE(ENABLE_UNIT_TESTS, 1, [enable unit tests inside the library's source code])
|
||||
fi
|
||||
if test $enable_integration_tests == "yes"; then
|
||||
CLIENT_CONFIGURE_OPTIONS="$CLIENT_CONFIGURE_OPTIONS --enable-integration-tests"
|
||||
AC_DEFINE(ENABLE_INTEGRATION_TESTS, 1, [enable unit tests outside of the library's source code])
|
||||
fi
|
||||
AM_CONDITIONAL([ENABLE_UNIT_TESTS], [test "$enable_unit_tests" = "yes"])
|
||||
AM_CONDITIONAL([ENABLE_TESTING], [test "$enable_unit_tests" = "yes" || test "$enable_integration_tests" = "yes" ])
|
||||
|
||||
if test $enable_static_cxx == "yes"; then
|
||||
LIBS="$LIBS -L."
|
||||
|
|
|
@ -4,6 +4,8 @@ DIST_SUBDIRS = core $(BACKENDS)
|
|||
|
||||
AM_CPPFLAGS = $(SUBDIRS:%=-I$(srcdir)/%) -I$(srcdir)/../test $(BACKEND_CPPFLAGS) $(GLIB_CFLAGS)
|
||||
|
||||
EXTRA_PROGRAMS =
|
||||
TESTS =
|
||||
bin_PROGRAMS = syncevolution
|
||||
bin_SCRIPTS = synccompare
|
||||
SYNCEVOLUTION_DEP =
|
||||
|
@ -12,10 +14,7 @@ else
|
|||
SYNCEVOLUTION_LDADD += $(SYNCSOURCES)
|
||||
SYNCEVOLUTION_DEP += $(SYNCSOURCES)
|
||||
endif
|
||||
EXTRA_PROGRAMS = client-test
|
||||
EXTRA_DIST = shlibs.local Makefile-gen.am syncevolution.xml
|
||||
check_PROGRAMS = @CPPUNIT_TESTS@
|
||||
TESTS = @CPPUNIT_TESTS@
|
||||
|
||||
DISTCLEANFILES = synccompare
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
@ -48,7 +47,7 @@ endif
|
|||
CORE_CXXFLAGS = $(SYNTHESIS_CFLAGS)
|
||||
CORE_LDADD = $(SYNCEVOLUTION_LDADD) core/libsyncevolution.la $(GLIB_LIBS) $(LIBS)
|
||||
CORE_DEP = $(SYNCEVOLUTION_DEP) core/libsyncevolution.la $(SYNTHESIS_DEP)
|
||||
CORE_LDFLAGS = -uSyncEvolution_Module_Version -Wl,--export-dynamic
|
||||
CORE_LD_FLAGS = -uSyncEvolution_Module_Version -Wl,--export-dynamic
|
||||
|
||||
# put link to static c++ library into current directory, needed if compiling with --enable-static-c++
|
||||
libstdc++.a :
|
||||
|
@ -62,7 +61,7 @@ syncevolution_SOURCES = \
|
|||
# if linking statically against them, empty otherwise;
|
||||
# either way this does not lead to a dependency on those libs - done explicitly
|
||||
syncevolution_LDADD = $(CORE_LDADD)
|
||||
syncevolution_LDFLAGS = $(CORE_LDFLAGS)
|
||||
syncevolution_LDFLAGS = $(CORE_LD_FLAGS)
|
||||
syncevolution_CXXFLAGS = $(SYNCEVOLUTION_CXXFLAGS) $(CORE_CXXFLAGS)
|
||||
syncevolution_DEPENDENCIES = $(EXTRA_LTLIBRARIES) $(CORE_DEP) # $(SYNTHESIS_DEP)
|
||||
|
||||
|
@ -123,17 +122,13 @@ CLIENT_LIB_TEST_FILES = \
|
|||
testcases/ical20.ics \
|
||||
testcases/imemo20.ics \
|
||||
testcases/itodo20.ics
|
||||
nodist_client_test_SOURCES = $(CLIENT_LIB_TEST_FILES)
|
||||
client_test_CPPFLAGS = -DHAVE_CONFIG_H -DENABLE_INTEGRATION_TESTS -DENABLE_UNIT_TESTS $(AM_CPPFLAGS)
|
||||
client_test_CXXFLAGS = `cppunit-config --cflags` $(SYNCEVOLUTION_CXXFLAGS) $(CORE_CXXFLAGS)
|
||||
client_test_LDFLAGS = `cppunit-config --libs` `nm core/.libs/libsyncevolution.a | grep funambolAutoRegisterRegistry | sed -e 's/.* /-u /'` $(CORE_LDFLAGS)
|
||||
client_test_LDFLAGS = `cppunit-config --libs` `nm core/.libs/libsyncevolution.a | grep funambolAutoRegisterRegistry | sed -e 's/.* /-u /'` $(CORE_LD_FLAGS)
|
||||
client_test_LDADD = $(CORE_LDADD)
|
||||
client_test_DEPENDENCIES = # $(SYNTHESIS_DEP)
|
||||
# These dependencies are intentionally a bit too broad:
|
||||
# they ensure that all files are in place to *run* client-test,
|
||||
# but in particular the "all" dependency causes a rebuild
|
||||
# even if the actual input files haven't changed.
|
||||
client_test_DEPENDENCIES = all $(EXTRA_LTLIBRARIES) $(CORE_DEP) $(CLIENT_LIB_TEST_FILES) synccompare
|
||||
# they ensure that all files are in place to *run* client-test.
|
||||
client_test_DEPENDENCIES = $(EXTRA_LTLIBRARIES) $(CORE_DEP) $(CLIENT_LIB_TEST_FILES) synccompare
|
||||
|
||||
# copy test files because client-test expects them here
|
||||
|
||||
|
@ -142,6 +137,22 @@ $(filter testcases/%, $(filter $(LOCAL_TEST_FILES), $(CLIENT_LIB_TEST_FILES))) :
|
|||
mkdir -p testcases
|
||||
cp $< $@
|
||||
|
||||
# distribute test system?
|
||||
if ENABLE_TESTING
|
||||
# yes: install client-test in bindir, test files in datadir
|
||||
TESTS += client-test
|
||||
bin_PROGRAMS += client-test
|
||||
nobase_dist_doc_DATA = $(CLIENT_LIB_TEST_FILES)
|
||||
else
|
||||
# The "all" dependency causes a rebuild even if the actual input files
|
||||
# haven't changed. If client-test is part of the regular targets built
|
||||
# by "all", then it must not depend on all!
|
||||
EXTRA_PROGRAMS += client-test
|
||||
nodist_client_test_SOURCES = $(CLIENT_LIB_TEST_FILES)
|
||||
client_test_DEPENDENCIES += all
|
||||
endif
|
||||
|
||||
|
||||
# special target for testing with valgrind
|
||||
valgrind : test
|
||||
valgrind --leak-check=yes --suppressions=valgrind.supp ./test
|
||||
|
|
|
@ -7,6 +7,11 @@ SYNCEVOLUTION_CXXFLAGS = @SYNCEVOLUTION_CXXFLAGS@
|
|||
SYNCEVOLUTION_LDADD = @SYNCEVOLUTION_LDADD@
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
if ENABLE_UNIT_TESTS
|
||||
SYNCEVOLUTION_CXXFLAGS += $(CPPUNIT_CXXFLAGS)
|
||||
SYNCEVOLUTION_LDADD += $(CPPUNIT_LDFLAGS)
|
||||
endif
|
||||
|
||||
if ENABLE_MODULES
|
||||
pkglib_LTLIBRARIES = libsyncevolution.la
|
||||
else
|
||||
|
@ -78,7 +83,7 @@ CORE_SOURCES = \
|
|||
|
||||
|
||||
libsyncevolution_la_SOURCES = $(CORE_SOURCES)
|
||||
libsyncevolution_la_LIBADD = @EPACKAGE_LIBS@ @GLIB_LIBS@ $(TRANSPORT_LIBS) @LIBS@ $(SYNTHESIS_LIBS)
|
||||
libsyncevolution_la_LIBADD = @EPACKAGE_LIBS@ @GLIB_LIBS@ $(TRANSPORT_LIBS) @LIBS@ $(SYNTHESIS_LIBS) $(SYNCEVOLUTION_LDADD)
|
||||
libsyncevolution_la_CXXFLAGS = $(TRANSPORT_CFLAGS) $(SYNCEVOLUTION_CXXFLAGS) $(SYNTHESIS_CFLAGS)
|
||||
|
||||
SyncEvolutionXML.c: $(srcdir)/../syncevolution.xml
|
||||
|
|
|
@ -650,6 +650,7 @@ void SyncEvolutionCmdline::usage(bool full, const string &error, const string &p
|
|||
}
|
||||
|
||||
#ifdef ENABLE_UNIT_TESTS
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
/** simple line-by-line diff */
|
||||
static string diffStrings(const string &lhs, const string &rhs)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* Copyright (C) 2008 Patrick Ohly
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "SyncEvolutionUtil.h"
|
||||
#include "EvolutionSyncClient.h"
|
||||
#include "TransportAgent.h"
|
||||
|
@ -20,6 +21,7 @@
|
|||
#include <dirent.h>
|
||||
|
||||
#ifdef ENABLE_UNIT_TESTS
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
CPPUNIT_REGISTRY_ADD_TO_DEFAULT("SyncEvolution");
|
||||
#endif
|
||||
|
||||
|
|
|
@ -105,12 +105,28 @@ class ReadDir {
|
|||
* object files which are not normally linked into the test
|
||||
* binary, are included in the test suite under the group
|
||||
* "SyncEvolution".
|
||||
*
|
||||
* Use it like this:
|
||||
* @verbatim
|
||||
#include <config.h>
|
||||
#ifdef ENABLE_UNIT_TESTS
|
||||
# include <cppunit/extensions/HelperMacros.h>
|
||||
class Foo : public CppUnit::TestFixture {
|
||||
CPPUNIT_TEST_SUITE(foo);
|
||||
CPPUNIT_TEST(testBar);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
void testBar();
|
||||
};
|
||||
# SYNCEVOLUTION_TEST_SUITE_REGISTRATION(classname)
|
||||
#endif
|
||||
@endverbatim
|
||||
*/
|
||||
#define SYNCEVOLUTION_TEST_SUITE_REGISTRATION( ATestFixtureType ) \
|
||||
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( ATestFixtureType, "SyncEvolution" ); \
|
||||
extern "C" { int funambolAutoRegisterRegistry ## ATestFixtureType = 12345; }
|
||||
|
||||
|
||||
std::string StringPrintf(const char *format, ...)
|
||||
#ifdef __GNUC__
|
||||
__attribute__((format(printf, 1, 2)))
|
||||
|
|
Loading…
Reference in a new issue