On Mon, 2011-07-25 at 16:58 +0200, Murray Cumming wrote: > > At the least there can be a test that there is at least one backend. > > Also, maybe we can test for the expected backends based on the > configure > options? > > > A unit test might be able to check that some well-known backends > (like > > the file backend) is listed, but anything beyond that is difficult. > It > > would have caught this issue, though. > > Yes, I think it would be useful.
This patch adds a "make check" test that just checks whether SyncSource::backendsInfo() is an empty string. Obviously, we would want to add more specific API than just backendsInfo() to check for specific backends. However, I've added an ifdef there because, of course, we should expect that to be empty when ENABLE_MODULES is not defined (when using --disable-shared), because the SyncSource code checks for that: https://meego.gitorious.org/meego-middleware/syncevolution/blobs/dbus-server-reorganization/src/syncevo/SyncSource.cpp#line261 So I guess this isn't really a test case for the problem that you are discussing. What "backends" _should_ be available when using --disable-shared? And is every backend a source backend? -- [email protected] www.murrayc.com www.openismus.com
>From 3d883eb844af817f12f6b6a1999db7bad0f5820a Mon Sep 17 00:00:00 2001 From: Murray Cumming <[email protected]> Date: Tue, 26 Jul 2011 09:15:40 +0200 Subject: [PATCH] Add a "make check" test to check that some backends exist. --- test/Makefile.am | 16 ++++++++++++++++ test/test_backends_available.cpp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 0 deletions(-) create mode 100644 test/test_backends_available.cpp diff --git a/test/Makefile.am b/test/Makefile.am index 149d91a..b2d80fe 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -28,3 +28,19 @@ EXTRA_DIST = \ syncevo-phone-config.py \ $(wildcard testcases/*.patch) \ synccompare.pl + + + +check_PROGRAMS = test_backends_available + +TESTS = $(check_PROGRAMS) + +# TODO: Create libs and cflags variables that both the main build and the tests +# can use instead of repeating this. +tests_ldadd = $(SYNCEVOLUTION_LDADD) $(top_builddir)/src/syncevo/libsyncevolution.la $(GLIB_LIBS) $(GTHREAD_LIBS) $(GOBJECT_LIBS) $(LIBS) +tests_cxxflags = -I$(top_srcdir) $(BACKEND_CPPFLAGS) + + +test_backends_available_SOURCES = test_backends_available.cpp +test_backends_available_LDADD = $(tests_ldadd) +test_backends_available_CXXFLAGS = $(tests_cxxflags) diff --git a/test/test_backends_available.cpp b/test/test_backends_available.cpp new file mode 100644 index 0000000..db2d68e --- /dev/null +++ b/test/test_backends_available.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2011 Intel Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#include <syncevo/SyncSource.h> +#include <cstdlib> + +int main(int argc, char* argv[]) +{ + //Check that at least one backend is available: + if(SyncEvo::SyncSource::backendsInfo().empty()) + return EXIT_FAILURE; + + return EXIT_SUCCESS; +} + -- 1.7.4.1
_______________________________________________ SyncEvolution mailing list [email protected] http://lists.syncevolution.org/listinfo/syncevolution
