[gnome-keyring] [dbus] Change daemon/dbus tests to use simpler gtester setup.



commit 94a664883c6cb1f81cb03fb897f65750e3eb5a6e
Author: Stef Walter <stefw collabora co uk>
Date:   Mon Feb 28 17:25:44 2011 +0100

    [dbus] Change daemon/dbus tests to use simpler gtester setup.

 .gitignore                           |    2 ++
 daemon/dbus/tests/Makefile.am        |   27 ++++++++++++++++++---------
 daemon/dbus/tests/test-secret-util.c |   20 ++++++++++++++++----
 3 files changed, 36 insertions(+), 13 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index ddafcf6..9d9b842 100644
--- a/.gitignore
+++ b/.gitignore
@@ -91,3 +91,5 @@ run-tests
 /egg/tests/test-secmem
 /egg/tests/test-spawn
 /egg/tests/test-symkey
+
+/daemon/dbus/tests/test-secret-util
diff --git a/daemon/dbus/tests/Makefile.am b/daemon/dbus/tests/Makefile.am
index cea737b..2b612ac 100644
--- a/daemon/dbus/tests/Makefile.am
+++ b/daemon/dbus/tests/Makefile.am
@@ -1,14 +1,23 @@
 
-# Test files should be listed in order they need to run
-TESTING_FILES = \
-	test-secret-util.c
+INCLUDES = \
+	-I$(top_srcdir)/daemon/dbus \
+	-DSRCDIR=$(srcdir) \
+	$(DAEMON_CFLAGS) \
+	$(GLIB_CFLAGS)
 
-TESTING_LIBS =  \
+LDADD =  \
 	$(top_builddir)/daemon/dbus/libgkd-dbus.la
 
-TESTING_FLAGS = \
-	$(DAEMON_CFLAGS) \
-	$(GOBJECT_CFLAGS) \
-	$(GLIB_CFLAGS)
+TEST_PROGS = \
+	test-secret-util
+
+check_PROGRAMS = $(TEST_PROGS)
+
+test: $(TEST_PROGS)
+	SRCDIR='$(srcdir)' gtester -k --verbose ${TEST_PROGS}
+
+check-local: test
 
-include $(top_srcdir)/testing/testing.make
+if WITH_TESTS
+all-local: $(check_PROGRAMS)
+endif
diff --git a/daemon/dbus/tests/test-secret-util.c b/daemon/dbus/tests/test-secret-util.c
index 7ed48e9..816caad 100644
--- a/daemon/dbus/tests/test-secret-util.c
+++ b/daemon/dbus/tests/test-secret-util.c
@@ -23,13 +23,14 @@
 
 #include "config.h"
 
-#include "test-suite.h"
-
-#include "dbus/gkd-secret-util.h"
+#include "gkd-secret-util.h"
 
 #include <glib.h>
 
-TESTING_TEST(secret_util_build_path)
+#include <string.h>
+
+static void
+test_build_path (void)
 {
 	const gchar *identifier = "par_d\xc3\xa9""faut";
 	gchar *result;
@@ -40,3 +41,14 @@ TESTING_TEST(secret_util_build_path)
 	g_assert_cmpstr (result, ==, "/path/par_5fd_c3_a9faut");
 	g_free (result);
 }
+
+
+int
+main (int argc, char **argv)
+{
+	g_test_init (&argc, &argv, NULL);
+
+	g_test_add_func ("/secret-util/build-path", test_build_path);
+
+	return g_test_run ();
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]