>From 3d883eb844af817f12f6b6a1999db7bad0f5820a Mon Sep 17 00:00:00 2001
From: Murray Cumming <murrayc@murrayc.com>
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

