[gnome-keyring] Move gkr_location stuff into daemon component.
- From: Stefan Walter <stefw src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-keyring] Move gkr_location stuff into daemon component.
- Date: Mon, 11 May 2009 21:40:28 -0400 (EDT)
commit cd4f164f26188719e8130b94b7eca6e7f8772696
Author: Stef Walter <stef memberwebs com>
Date: Sun May 10 16:08:50 2009 +0000
Move gkr_location stuff into daemon component.
It's only used in the daemon component. Also update tests of location stuff.
Also remove common component all together.
---
Makefile.am | 1 -
common/.gitignore | 4 -
common/Makefile.am | 37 -------
common/tests/.gitignore | 4 -
common/tests/Makefile.am | 15 ---
configure.in | 2 -
daemon/Makefile.am | 1 -
daemon/gkr-daemon-ops.c | 3 +-
daemon/keyrings/gkr-keyring-login.c | 3 +-
daemon/keyrings/gkr-keyring.c | 3 +-
daemon/keyrings/gkr-keyrings.c | 6 +-
daemon/keyrings/tests/Makefile.am | 3 +-
daemon/keyrings/tests/unit-test-keyring-file.c | 4 +-
daemon/keyrings/tests/unit-test-keyring-login.c | 4 +-
daemon/ui/gkr-ask-request.c | 4 +-
daemon/util/Makefile.am | 6 +-
{common => daemon/util}/gkr-location-watch.c | 0
{common => daemon/util}/gkr-location-watch.h | 0
{common => daemon/util}/gkr-location.c | 0
{common => daemon/util}/gkr-location.h | 0
daemon/util/tests/Makefile.am | 8 +-
.../util}/tests/unit-test-location-watch.c | 107 ++++++++++--------
{common => daemon/util}/tests/unit-test-location.c | 114 +++++++++++++-------
pkcs11/rpc-layer/Makefile.am | 5 +-
24 files changed, 161 insertions(+), 173 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 3f69cd4..d3c0270 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,7 +15,6 @@ SUBDIRS = \
gp11 \
egg \
gcr \
- common \
library \
pkcs11 \
daemon \
diff --git a/common/.gitignore b/common/.gitignore
deleted file mode 100644
index 6f16bde..0000000
--- a/common/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/Makefile
-/Makefile.in
-/.libs
-/.*
diff --git a/common/Makefile.am b/common/Makefile.am
deleted file mode 100644
index de0a6f3..0000000
--- a/common/Makefile.am
+++ /dev/null
@@ -1,37 +0,0 @@
-
-noinst_LTLIBRARIES = \
- libgkr-common.la
-
-INCLUDES = \
- -I$(top_srcdir)
- -I$(top_builddir)
-
-# --------------------------------------------------------------------
-# COMMON STUFF COMPILED INTO DAEMON COMPONENTS
-
-libgkr_common_la_CFLAGS = \
- -DPREFIX=\""$(prefix)"\" \
- -DBINDIR=\""$(bindir)"\" \
- -DLIBEXECDIR=\""$(libexecdir)"\" \
- -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- $(DAEMON_CFLAGS) \
- $(GTK_CFLAGS) \
- $(GLIB_CFLAGS)
-
-libgkr_common_la_SOURCES = \
- gkr-location.c gkr-location.h \
- gkr-location-watch.c gkr-location-watch.h
-
-libgkr_common_la_LIBADD = \
- $(top_builddir)/egg/libegg.la \
- $(top_builddir)/egg/libegg-dbus.la \
- $(GTHREAD_LIBS) \
- $(GLIB_LIBS)
-
-if WITH_TESTS
-TESTS_DIR = tests
-else
-TESTS_DIR =
-endif
-
-SUBDIRS = . $(TESTS_DIR)
diff --git a/common/tests/.gitignore b/common/tests/.gitignore
deleted file mode 100644
index 3eb8071..0000000
--- a/common/tests/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/Makefile
-/Makefile.in
-/.*
-/run-*-test*
diff --git a/common/tests/Makefile.am b/common/tests/Makefile.am
deleted file mode 100644
index b2d8574..0000000
--- a/common/tests/Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
-UNIT_AUTO = \
- unit-test-location.c \
- unit-test-location-watch.c
-
-UNIT_PROMPT =
-
-UNIT_LIBS = \
- $(top_builddir)/egg/libegg.la \
- $(top_builddir)/egg/libegg-dbus.la \
- $(top_builddir)/common/libgkr-common.la
-
-UNIT_FLAGS = \
- -DEXTERNAL_TEST
-
-include $(top_srcdir)/tests/test.make
diff --git a/configure.in b/configure.in
index d795e74..e80a3dd 100644
--- a/configure.in
+++ b/configure.in
@@ -541,8 +541,6 @@ AC_SUBST(BINDIR)
AC_OUTPUT([
Makefile
-common/Makefile
-common/tests/Makefile
daemon/Makefile
daemon/gnome-keyring-daemon.desktop.in
daemon/data/Makefile
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 664f0db..c8cb29e 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -40,7 +40,6 @@ gnome_keyring_daemon_LDADD = \
$(top_builddir)/pkcs11/ssh-store/libgck-ssh-store.la \
$(top_builddir)/pkcs11/user-store/libgck-user-store.la \
$(top_builddir)/pkcs11/gck/libgck.la \
- $(top_builddir)/common/libgkr-common.la \
$(top_builddir)/gp11/libgp11.la \
$(top_builddir)/egg/libegg-dbus.la \
$(DAEMON_LIBS) \
diff --git a/daemon/gkr-daemon-ops.c b/daemon/gkr-daemon-ops.c
index 4d18fca..26bb430 100644
--- a/daemon/gkr-daemon-ops.c
+++ b/daemon/gkr-daemon-ops.c
@@ -24,8 +24,6 @@
#include "gkr-daemon.h"
-#include "common/gkr-location.h"
-
#include "egg/egg-buffer.h"
#include "egg/egg-secure-memory.h"
@@ -42,6 +40,7 @@
#include "ui/gkr-ask-daemon.h"
#include "util/gkr-daemon-util.h"
+#include "util/gkr-location.h"
#include <unistd.h>
#include <errno.h>
diff --git a/daemon/keyrings/gkr-keyring-login.c b/daemon/keyrings/gkr-keyring-login.c
index b9688ef..4c912de 100644
--- a/daemon/keyrings/gkr-keyring-login.c
+++ b/daemon/keyrings/gkr-keyring-login.c
@@ -29,7 +29,6 @@
#include "gkr-keyring-item.h"
#include "gkr-keyrings.h"
-#include "common/gkr-location.h"
#include "egg/egg-secure-memory.h"
#include "library/gnome-keyring.h"
@@ -37,6 +36,8 @@
#include "ui/gkr-ask-daemon.h"
#include "ui/gkr-ask-request.h"
+#include "util/gkr-location.h"
+
#include <glib.h>
#include <glib/gi18n.h>
diff --git a/daemon/keyrings/gkr-keyring.c b/daemon/keyrings/gkr-keyring.c
index a22a523..977937d 100644
--- a/daemon/keyrings/gkr-keyring.c
+++ b/daemon/keyrings/gkr-keyring.c
@@ -30,12 +30,13 @@
#include "gkr-keyrings.h"
#include "egg/egg-buffer.h"
-#include "common/gkr-location.h"
#include "egg/egg-secure-memory.h"
#include "library/gnome-keyring-private.h"
#include "library/gnome-keyring-proto.h"
+#include "util/gkr-location.h"
+
#include <glib.h>
#include <glib/gi18n.h>
diff --git a/daemon/keyrings/gkr-keyrings.c b/daemon/keyrings/gkr-keyrings.c
index 495f643..a8ad4d2 100644
--- a/daemon/keyrings/gkr-keyrings.c
+++ b/daemon/keyrings/gkr-keyrings.c
@@ -26,13 +26,13 @@
#include "gkr-keyrings.h"
-#include "common/gkr-location.h"
-#include "common/gkr-location-watch.h"
-
#include "egg/egg-cleanup.h"
#include "library/gnome-keyring-proto.h"
+#include "util/gkr-location.h"
+#include "util/gkr-location-watch.h"
+
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
diff --git a/daemon/keyrings/tests/Makefile.am b/daemon/keyrings/tests/Makefile.am
index b61a7e7..705dd18 100644
--- a/daemon/keyrings/tests/Makefile.am
+++ b/daemon/keyrings/tests/Makefile.am
@@ -11,7 +11,8 @@ UNIT_LIBS = \
$(top_builddir)/daemon/ui/libgkr-ui.la \
$(top_builddir)/daemon/util/libgkr-daemon-util.la \
$(top_builddir)/library/libgnome-keyring-common.la \
- $(top_builddir)/common/libgkr-common.la
+ $(top_builddir)/egg/libegg-dbus.la \
+ $(top_builddir)/egg/libegg.la
EXTRA_DIST = test-data
diff --git a/daemon/keyrings/tests/unit-test-keyring-file.c b/daemon/keyrings/tests/unit-test-keyring-file.c
index 8d1557c..12eaa36 100644
--- a/daemon/keyrings/tests/unit-test-keyring-file.c
+++ b/daemon/keyrings/tests/unit-test-keyring-file.c
@@ -25,14 +25,14 @@
#include "run-auto-test.h"
-#include "common/gkr-location.h"
-
#include "egg/egg-secure-memory.h"
#include "keyrings/gkr-keyring.h"
#include "library/gnome-keyring-private.h"
+#include "util/gkr-location.h"
+
#include <glib.h>
#include <string.h>
diff --git a/daemon/keyrings/tests/unit-test-keyring-login.c b/daemon/keyrings/tests/unit-test-keyring-login.c
index c6d1864..a8403eb 100644
--- a/daemon/keyrings/tests/unit-test-keyring-login.c
+++ b/daemon/keyrings/tests/unit-test-keyring-login.c
@@ -25,13 +25,13 @@
#include "run-auto-test.h"
-#include "common/gkr-location.h"
-
#include "keyrings/gkr-keyrings.h"
#include "keyrings/gkr-keyring-login.h"
#include "ui/gkr-ask-daemon.h"
+#include "util/gkr-location.h"
+
#include <glib.h>
#include <memory.h>
diff --git a/daemon/ui/gkr-ask-request.c b/daemon/ui/gkr-ask-request.c
index 6ee6043..4f952dc 100644
--- a/daemon/ui/gkr-ask-request.c
+++ b/daemon/ui/gkr-ask-request.c
@@ -28,8 +28,6 @@
#include "gkr-ask-marshal.h"
#include "gkr-ask-daemon.h"
-#include "common/gkr-location.h"
-
#include "daemon/util/gkr-daemon-async.h"
#include "egg/egg-secure-memory.h"
@@ -38,6 +36,8 @@
#include "library/gnome-keyring-private.h"
#include "library/gnome-keyring-proto.h"
+#include "util/gkr-location.h"
+
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
diff --git a/daemon/util/Makefile.am b/daemon/util/Makefile.am
index 0c904d1..e69ec16 100644
--- a/daemon/util/Makefile.am
+++ b/daemon/util/Makefile.am
@@ -15,8 +15,10 @@ INCLUDES= \
libgkr_daemon_util_la_SOURCES = \
gkr-daemon-async.c gkr-daemon-async.h \
- gkr-daemon-util.c gkr-daemon-util.h
-
+ gkr-daemon-util.c gkr-daemon-util.h \
+ gkr-location.c gkr-location.h \
+ gkr-location-watch.c gkr-location-watch.h
+
libgkr_daemon_util_la_LIBADD = \
$(GLIB_LIBS) \
$(GOBJECT_LIBS)
diff --git a/common/gkr-location-watch.c b/daemon/util/gkr-location-watch.c
similarity index 100%
rename from common/gkr-location-watch.c
rename to daemon/util/gkr-location-watch.c
diff --git a/common/gkr-location-watch.h b/daemon/util/gkr-location-watch.h
similarity index 100%
rename from common/gkr-location-watch.h
rename to daemon/util/gkr-location-watch.h
diff --git a/common/gkr-location.c b/daemon/util/gkr-location.c
similarity index 100%
rename from common/gkr-location.c
rename to daemon/util/gkr-location.c
diff --git a/common/gkr-location.h b/daemon/util/gkr-location.h
similarity index 100%
rename from common/gkr-location.h
rename to daemon/util/gkr-location.h
diff --git a/daemon/util/tests/Makefile.am b/daemon/util/tests/Makefile.am
index a2fe165..250fbb1 100644
--- a/daemon/util/tests/Makefile.am
+++ b/daemon/util/tests/Makefile.am
@@ -1,11 +1,13 @@
UNIT_AUTO = \
- unit-test-async.c
+ unit-test-async.c \
+ unit-test-location.c \
+ unit-test-location-watch.c
UNIT_PROMPT =
UNIT_LIBS = \
+ $(top_builddir)/daemon/util/libgkr-daemon-util.la \
$(top_builddir)/egg/libegg.la \
- $(top_builddir)/egg/libegg-dbus.la \
- $(top_builddir)/daemon/util/libgkr-daemon-util.la
+ $(top_builddir)/egg/libegg-dbus.la
include $(top_srcdir)/tests/gtest.make
diff --git a/common/tests/unit-test-location-watch.c b/daemon/util/tests/unit-test-location-watch.c
similarity index 66%
rename from common/tests/unit-test-location-watch.c
rename to daemon/util/tests/unit-test-location-watch.c
index 6256df0..adb130c 100644
--- a/common/tests/unit-test-location-watch.c
+++ b/daemon/util/tests/unit-test-location-watch.c
@@ -28,7 +28,7 @@
#include "run-auto-test.h"
-#include "common/gkr-location-watch.h"
+#include "util/gkr-location-watch.h"
#include <glib/gstdio.h>
@@ -63,36 +63,42 @@ static guint n_locations_removed = 0;
static GQuark last_location_removed = 0;
static void
-location_added (GkrLocationWatch *watch, GQuark loc, CuTest *cu)
+location_added (GkrLocationWatch *watch, GQuark loc, gpointer unused)
{
- CuAssert (cu, "should be a non-null quark", loc != 0);
- CuAssert (cu, "should be a valid quark", g_quark_to_string (loc) != NULL);
+ /* "should be a non-null quark" */
+ g_assert_cmpint (loc, !=, 0);
+ /* "should be a valid quark" */
+ g_assert (g_quark_to_string (loc) != NULL);
++n_locations_added;
last_location_added = loc;
}
static void
-location_changed (GkrLocationWatch *watch, GQuark loc, CuTest *cu)
+location_changed (GkrLocationWatch *watch, GQuark loc, gpointer unused)
{
- CuAssert (cu, "should be a non-null quark", loc != 0);
- CuAssert (cu, "should be a valid quark", g_quark_to_string (loc) != NULL);
+ /* "should be a non-null quark" */
+ g_assert_cmpint (loc, !=, 0);
+ /* "should be a valid quark" */
+ g_assert (g_quark_to_string (loc) != NULL);
++n_locations_changed;
last_location_changed = loc;
}
static void
-location_removed (GkrLocationWatch *watch, GQuark loc, CuTest *cu)
+location_removed (GkrLocationWatch *watch, GQuark loc, gpointer unused)
{
- CuAssert (cu, "should be a non-null quark", loc != 0);
- CuAssert (cu, "should be a valid quark", g_quark_to_string (loc) != NULL);
+ /* "should be a non-null quark" */
+ g_assert_cmpint (loc, !=, 0);
+ /* "should be a valid quark" */
+ g_assert (g_quark_to_string (loc) != NULL);
++n_locations_removed;
last_location_removed = loc;
}
-void unit_test_location_watch (CuTest *cu)
+DEFINE_TEST(location_watch)
{
GQuark loc;
@@ -100,9 +106,9 @@ void unit_test_location_watch (CuTest *cu)
sleep (1);
the_watch = gkr_location_watch_new (NULL, 0, SUBDIR, WILDCARD, NULL);
- g_signal_connect (the_watch, "location-added", G_CALLBACK (location_added), cu);
- g_signal_connect (the_watch, "location-removed", G_CALLBACK (location_removed), cu);
- g_signal_connect (the_watch, "location-changed", G_CALLBACK (location_changed), cu);
+ g_signal_connect (the_watch, "location-added", G_CALLBACK (location_added), NULL);
+ g_signal_connect (the_watch, "location-removed", G_CALLBACK (location_removed), NULL);
+ g_signal_connect (the_watch, "location-changed", G_CALLBACK (location_changed), NULL);
/* Make a test directory */
loc = gkr_location_from_child (GKR_LOCATION_VOLUME_LOCAL, SUBDIR);
@@ -114,21 +120,21 @@ void unit_test_location_watch (CuTest *cu)
/* A watch for an empty directory, should have no responses */
gkr_location_watch_refresh (the_watch, FALSE);
- CuAssertIntEquals(cu, 0, n_locations_added);
- CuAssertIntEquals(cu, 0, n_locations_changed);
- CuAssertIntEquals(cu, 0, n_locations_removed);
+ g_assert_cmpint (0, ==, n_locations_added);
+ g_assert_cmpint (0, ==, n_locations_changed);
+ g_assert_cmpint (0, ==, n_locations_removed);
g_mkdir_with_parents (test_dir, 0700);
/* Should still have no responses even though it exists */
gkr_location_watch_refresh (the_watch, FALSE);
- CuAssertIntEquals(cu, 0, n_locations_added);
- CuAssertIntEquals(cu, 0, n_locations_changed);
- CuAssertIntEquals(cu, 0, n_locations_removed);
+ g_assert_cmpint (0, ==, n_locations_added);
+ g_assert_cmpint (0, ==, n_locations_changed);
+ g_assert_cmpint (0, ==, n_locations_removed);
}
-void unit_test_location_file (CuTest *cu)
+DEFINE_TEST(location_file)
{
gboolean ret;
GQuark loc;
@@ -144,19 +150,21 @@ void unit_test_location_file (CuTest *cu)
last_location_added = last_location_changed = last_location_removed = 0;
ret = g_file_set_contents (test_file, DATA, strlen (DATA), NULL);
- CuAssertIntEquals (cu, ret, TRUE);
+ g_assert (ret == TRUE);
/* Now make sure that file is located */
gkr_location_watch_refresh (the_watch, FALSE);
- CuAssertIntEquals (cu, 1, n_locations_added);
- CuAssertIntEquals (cu, 0, n_locations_changed);
- CuAssertIntEquals (cu, 0, n_locations_removed);
+ g_assert_cmpint (1, ==, n_locations_added);
+ g_assert_cmpint (0, ==, n_locations_changed);
+ g_assert_cmpint (0, ==, n_locations_removed);
/* The added one should match our file */
loc = gkr_location_from_path (test_file);
- CuAssert (cu, "returned zero location", loc != 0);
- CuAssert (cu, "wrong location was signalled", loc == last_location_added);
+ /* "returned zero location" */
+ g_assert_cmpint (loc, !=, 0);
+ /* "wrong location was signalled" */
+ g_assert (loc == last_location_added);
@@ -167,16 +175,17 @@ void unit_test_location_file (CuTest *cu)
/* Shouldn't find the file again */
gkr_location_watch_refresh (the_watch, FALSE);
- CuAssertIntEquals(cu, 0, n_locations_added);
- CuAssertIntEquals(cu, 0, n_locations_changed);
- CuAssertIntEquals(cu, 0, n_locations_removed);
+ g_assert_cmpint (0, ==, n_locations_added);
+ g_assert_cmpint (0, ==, n_locations_changed);
+ g_assert_cmpint (0, ==, n_locations_removed);
/* But we should find the file if forced to */
gkr_location_watch_refresh (the_watch, TRUE);
- CuAssertIntEquals(cu, 0, n_locations_added);
- CuAssertIntEquals(cu, 1, n_locations_changed);
- CuAssertIntEquals(cu, 0, n_locations_removed);
- CuAssert (cu, "wrong location was signalled", loc == last_location_changed);
+ g_assert_cmpint (0, ==, n_locations_added);
+ g_assert_cmpint (1, ==, n_locations_changed);
+ g_assert_cmpint (0, ==, n_locations_removed);
+ /* "wrong location was signalled" */
+ g_assert (loc == last_location_changed);
@@ -184,14 +193,15 @@ void unit_test_location_file (CuTest *cu)
last_location_added = last_location_changed = last_location_removed = 0;
ret = g_file_set_contents (test_file, DATA, strlen (DATA), NULL);
- CuAssertIntEquals (cu, ret, TRUE);
+ g_assert (ret == TRUE);
/* File was updated */
gkr_location_watch_refresh (the_watch, FALSE);
- CuAssertIntEquals(cu, 0, n_locations_added);
- CuAssertIntEquals(cu, 1, n_locations_changed);
- CuAssertIntEquals(cu, 0, n_locations_removed);
- CuAssert (cu, "wrong location was signalled", loc == last_location_changed);
+ g_assert_cmpint (0, ==, n_locations_added);
+ g_assert_cmpint (1, ==, n_locations_changed);
+ g_assert_cmpint (0, ==, n_locations_removed);
+ /* "wrong location was signalled" */
+ g_assert (loc == last_location_changed);
@@ -203,13 +213,14 @@ void unit_test_location_file (CuTest *cu)
/* Now file should be removed */
gkr_location_watch_refresh (the_watch, FALSE);
- CuAssertIntEquals(cu, 0, n_locations_added);
- CuAssertIntEquals(cu, 0, n_locations_changed);
- CuAssertIntEquals(cu, 1, n_locations_removed);
- CuAssert (cu, "wrong location was signalled", loc == last_location_removed);
+ g_assert_cmpint (0, ==, n_locations_added);
+ g_assert_cmpint (0, ==, n_locations_changed);
+ g_assert_cmpint (1, ==, n_locations_removed);
+ /* "wrong location was signalled" */
+ g_assert (loc == last_location_removed);
}
-void unit_test_location_nomatch (CuTest *cu)
+DEFINE_TEST(location_nomatch)
{
gchar *file = g_build_filename (test_dir, "my-file.toot", NULL);
gboolean ret;
@@ -218,7 +229,7 @@ void unit_test_location_nomatch (CuTest *cu)
sleep (1);
ret = g_file_set_contents (file, DATA, strlen (DATA), NULL);
- CuAssertIntEquals (cu, ret, TRUE);
+ g_assert (ret == TRUE);
n_locations_added = n_locations_changed = n_locations_removed = 0;
last_location_added = last_location_changed = last_location_removed = 0;
@@ -226,9 +237,9 @@ void unit_test_location_nomatch (CuTest *cu)
/* Now make sure that file is not located */
gkr_location_watch_refresh (the_watch, FALSE);
- CuAssertIntEquals (cu, 0, n_locations_added);
- CuAssertIntEquals (cu, 0, n_locations_changed);
- CuAssertIntEquals (cu, 0, n_locations_removed);
+ g_assert_cmpint (0, ==, n_locations_added);
+ g_assert_cmpint (0, ==, n_locations_changed);
+ g_assert_cmpint (0, ==, n_locations_removed);
g_unlink (file);
}
diff --git a/common/tests/unit-test-location.c b/daemon/util/tests/unit-test-location.c
similarity index 57%
rename from common/tests/unit-test-location.c
rename to daemon/util/tests/unit-test-location.c
index 4e03908..19db709 100644
--- a/common/tests/unit-test-location.c
+++ b/daemon/util/tests/unit-test-location.c
@@ -27,7 +27,7 @@
#include "run-auto-test.h"
-#include "common/gkr-location.h"
+#include "util/gkr-location.h"
/*
* Each test looks like (on one line):
@@ -46,77 +46,96 @@
#define MEDIA_DEVICE2 "/media/DummyMount2"
#define MEDIA_SERIAL "MEDIA-0239482093"
-
-void unit_test_location_simple (CuTest* cu)
+DEFINE_TEST(location_simple)
{
gchar *path = g_build_filename (g_get_home_dir (), "blah", NULL);
gchar *path2;
GQuark loc, child;
loc = gkr_location_from_path (path);
- CuAssert (cu, "should return a non-zero loc quark", loc != 0);
+ /* "should return a non-zero loc quark" */
+ g_assert_cmpint (loc, !=, 0);
g_print ("quark: %s\n", g_quark_to_string (loc));
path2 = gkr_location_to_path (loc);
- CuAssert (cu, "should return non-null path", path2 != NULL);
- CuAssert (cu, "should return the same path", strcmp (path2, path) == 0);
+ /* "should return non-null path" */
+ g_assert (path2 != NULL);
+ /* "should return the same path" */
+ g_assert_cmpstr (path2, ==, path);
child = gkr_location_from_child (loc, "3");
- CuAssert (cu, "should return a non-zero loc quark", loc != 0);
+ /* "should return a non-zero loc quark" */
+ g_assert_cmpint (loc, !=, 0);
child = gkr_location_from_child (child, "2");
- CuAssert (cu, "should return a non-zero loc quark", loc != 0);
+ /* "should return a non-zero loc quark" */
+ g_assert_cmpint (loc, !=, 0);
g_print ("child quark: %s\n", g_quark_to_string (child));
path2 = gkr_location_to_path (child);
- CuAssert (cu, "should return non-null path", path2 != NULL);
-
- CuAssert (cu, "should be volume", gkr_location_is_volume (GKR_LOCATION_VOLUME_HOME));
- CuAssert (cu, "should not be volume", !gkr_location_is_volume (loc));
- CuAssert (cu, "should not be volume", !gkr_location_is_volume (child));
+ /* "should return non-null path" */
+ g_assert (path2 != NULL);
+
+ /* "should be volume" */
+ g_assert (gkr_location_is_volume (GKR_LOCATION_VOLUME_HOME));
+ /* "should not be volume" */
+ g_assert (!gkr_location_is_volume (loc));
+ /* "should not be volume" */
+ g_assert (!gkr_location_is_volume (child));
}
-void unit_test_location_trailing (CuTest* cu)
+DEFINE_TEST (location_trailing)
{
GQuark one, two, ref;
one = gkr_location_from_child (GKR_LOCATION_VOLUME_LOCAL, "/blah/");
- CuAssert (cu, "should return a non-zero quark", one != 0);
+ /* "should return a non-zero quark" */
+ g_assert_cmpint (one, !=, 0);
two = gkr_location_from_child (GKR_LOCATION_VOLUME_LOCAL, "blah//");
- CuAssert (cu, "should return a non-zero quark", two != 0);
+ /* "should return a non-zero quark" */
+ g_assert_cmpint (two, !=, 0);
ref = gkr_location_from_child (GKR_LOCATION_VOLUME_LOCAL, "blah");
- CuAssert (cu, "should return a non-zero quark", ref != 0);
+ /* "should return a non-zero quark" */
+ g_assert_cmpint (ref, !=, 0);
/* Should all be identical */
- CuAssert (cu, "stripping of leading and trailing slashes did not work", ref == one);
- CuAssert (cu, "stripping of leading and trailing slashes did not work", ref == two);
+ /* "stripping of leading and trailing slashes did not work" */
+ g_assert (ref == one);
+ /* "stripping of leading and trailing slashes did not work" */
+ g_assert (ref == two);
}
-void unit_test_location_parent (CuTest* cu)
+DEFINE_TEST(location_parent)
{
GQuark child, ref, parent;
ref = gkr_location_from_child (GKR_LOCATION_VOLUME_LOCAL, "first");
- CuAssert (cu, "should return a non-zero quark", ref != 0);
+ /* "should return a non-zero quark" */
+ g_assert_cmpint (ref, !=, 0);
child = gkr_location_from_child (ref, "second");
- CuAssert (cu, "should return a non-zero quark", child != 0);
+ /* "should return a non-zero quark" */
+ g_assert_cmpint (child, !=, 0);
parent = gkr_location_to_parent (child);
- CuAssert (cu, "should return a non-zero quark", parent != 0);
- CuAssert (cu, "parent location does not equal original", parent == ref);
+ /* "should return a non-zero quark" */
+ g_assert_cmpint (parent, !=, 0);
+ /* "parent location does not equal original" */
+ g_assert (parent == ref);
/* Should return the volume */
parent = gkr_location_to_parent (parent);
- CuAssert (cu, "should return a non-zero quark", parent != 0);
- CuAssert (cu, "parent of parent location does not equal volume", parent == GKR_LOCATION_VOLUME_LOCAL);
+ /* "should return a non-zero quark" */
+ g_assert_cmpint (parent, !=, 0);
+ /* "parent of parent location does not equal volume" */
+ g_assert (parent == GKR_LOCATION_VOLUME_LOCAL);
}
-void unit_test_location_media (CuTest* cu)
+DEFINE_TEST(location_media)
{
gchar *path = g_build_filename (MEDIA_DEVICE, "testo", NULL);
gchar *path2;
@@ -127,11 +146,14 @@ void unit_test_location_media (CuTest* cu)
MEDIA_SERIAL, MEDIA_DEVICE, "Test Media");
loc = gkr_location_from_path (path);
- CuAssert (cu, "should return a non-zero loc quark", loc != 0);
+ /* "should return a non-zero loc quark" */
+ g_assert_cmpint (loc, !=, 0);
path2 = gkr_location_to_path (loc);
- CuAssert (cu, "should return non-null path", path2 != NULL);
- CuAssert (cu, "should return the same path", strcmp (path2, path) == 0);
+ /* "should return non-null path" */
+ g_assert (path2 != NULL);
+ /* "should return the same path" */
+ g_assert_cmpstr (path2, ==, path);
/* Device is removed */
gkr_location_manager_unregister (gkr_location_manager_get (), MEDIA_SERIAL);
@@ -141,12 +163,14 @@ void unit_test_location_media (CuTest* cu)
MEDIA_SERIAL, MEDIA_DEVICE2, "Test Media");
path2 = gkr_location_to_path (loc);
- CuAssert (cu, "should return non-null path", path2 != NULL);
- CuAssert (cu, "should return a path at new prefix", strncmp (path2, MEDIA_DEVICE2, strlen (MEDIA_DEVICE2)) == 0);
+ /* "should return non-null path" */
+ g_assert (path2 != NULL);
+ /* "should return a path at new prefix" */
+ g_assert (strncmp (path2, MEDIA_DEVICE2, strlen (MEDIA_DEVICE2)) == 0);
}
-void unit_test_location_fileops (CuTest* cu)
+DEFINE_TEST(location_fileops)
{
const guchar *data = (guchar*)"TEST DATA FOR FILE";
guchar *result;
@@ -155,23 +179,31 @@ void unit_test_location_fileops (CuTest* cu)
GQuark loc;
loc = gkr_location_from_child (GKR_LOCATION_VOLUME_FILE, "/tmp/gkr-test-location-fileops");
- CuAssert (cu, "should return a non-zero quark", loc != 0);
+ /* "should return a non-zero quark" */
+ g_assert_cmpint (loc, !=, 0);
len = strlen ((gchar*)data);
ret = gkr_location_write_file (loc, data, len, NULL);
- CuAssert (cu, "should be successful writing to temp file", ret == TRUE);
+ /* "should be successful writing to temp file" */
+ g_assert (ret == TRUE);
ret = gkr_location_read_file (loc, &result, &n_result, NULL);
- CuAssert (cu, "should be successful reading from temp file", ret == TRUE);
- CuAssert (cu, "should have read same length as written", n_result == len);
- CuAssert (cu, "should have read same data as written", memcmp (data, result, len) == 0);
+ /* "should be successful reading from temp file" */
+ g_assert (ret == TRUE);
+ /* "should have read same length as written" */
+ g_assert (n_result == len);
+ /* "should have read same data as written" */
+ g_assert (memcmp (data, result, len) == 0);
ret = gkr_location_delete_file (loc, NULL);
- CuAssert (cu, "should have successfully deleted file", ret == TRUE);
+ /* "should have successfully deleted file" */
+ g_assert (ret == TRUE);
ret = gkr_location_read_file (loc, &result, &n_result, NULL);
- CuAssert (cu, "shouldn't be able to read from deleted file", ret == FALSE);
+ /* "shouldn't be able to read from deleted file" */
+ g_assert (ret == FALSE);
ret = gkr_location_delete_file (loc, NULL);
- CuAssert (cu, "should be able to successfully delete non-existant file", ret == TRUE);
+ /* "should be able to successfully delete non-existant file" */
+ g_assert (ret == TRUE);
}
diff --git a/pkcs11/rpc-layer/Makefile.am b/pkcs11/rpc-layer/Makefile.am
index 0f085f3..8b8af2f 100644
--- a/pkcs11/rpc-layer/Makefile.am
+++ b/pkcs11/rpc-layer/Makefile.am
@@ -20,6 +20,8 @@ libgck_rpc_layer_la_SOURCES = \
gck-rpc-util.c
libgck_rpc_layer_la_LIBADD = \
+ $(top_builddir)/egg/libegg-buffer.la \
+ $(top_builddir)/egg/libegg-creds.la \
$(GOBJECT_LIBS) \
$(GTHREAD_LIBS) \
$(GLIB_LIBS)
@@ -59,5 +61,6 @@ gck_rpc_daemon_standalone_SOURCES = \
gck_rpc_daemon_standalone_LDADD = \
-ldl libgck-rpc-layer.la \
- $(top_builddir)/common/libgkr-common.la
+ $(top_builddir)/egg/libegg-buffer.la \
+ $(top_builddir)/egg/libegg-creds.la
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]