[gnome-logs/wip/test: 31/44] Fix segfault and connect mock journal API with UI
- From: Rashi Aswani <aswanirashi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-logs/wip/test: 31/44] Fix segfault and connect mock journal API with UI
- Date: Sun, 16 Aug 2015 20:49:58 +0000 (UTC)
commit 302e1016cc1121a0e8a12e0690d51eb9c76b903d
Author: Rashi Aswani <aswanirashi19 gmail com>
Date: Wed Jul 8 02:57:16 2015 +0530
Fix segfault and connect mock journal API with UI
tests/gl-mock-journal.c | 24 +++++++++++++-----------
tests/gnome-logs-test.c | 13 ++++++-------
2 files changed, 19 insertions(+), 18 deletions(-)
---
diff --git a/tests/gl-mock-journal.c b/tests/gl-mock-journal.c
index 9827639..2f246c0 100644
--- a/tests/gl-mock-journal.c
+++ b/tests/gl-mock-journal.c
@@ -44,6 +44,12 @@ struct _GlMockJournalEntry
G_DEFINE_TYPE (GlMockJournalEntry, gl_mock_journal_entry, G_TYPE_OBJECT)
+/* "_BOOT_ID=" contains 9 characters, and 33 more characters is needed to
+ * store the string formated from a 128-bit ID. The ID will be formatted as
+ * 32 lowercase hexadecimal digits and be terminated by a NUL byte. So an
+ * array of with a size 42 is need. */
+static char match[42] = "_BOOT_ID=";
+
typedef struct
{
gint fd;
@@ -62,7 +68,7 @@ gl_mock_journal_error_quark (void)
static void
gl_mock_journal_get_boots (GlMockJournal *journal)
-{
+{
}
GArray *
@@ -71,18 +77,12 @@ gl_mock_journal_get_boot_ids (GlMockJournal *journal)
GlMockJournalPrivate *priv;
priv = gl_mock_journal_get_instance_private (journal);
-
+ priv->boot_ids = g_array_new (FALSE, FALSE, sizeof (GArray));
+ guint64 boot_id = 12;
+ priv->boot_ids = g_array_append_val (priv->boot_ids, boot_id);
return priv->boot_ids;
}
-static gboolean
-on_journal_changed (gint fd,
- GIOCondition condition,
- GlJournal *self)
-{
- return G_SOURCE_CONTINUE;
-}
-
static void
gl_mock_journal_finalize (GObject *object)
{
@@ -101,14 +101,16 @@ gl_mock_journal_finalize (GObject *object)
g_free (boot_id->boot_match);
}
g_array_free (priv->boot_ids, TRUE);
+
}
static void
gl_mock_journal_class_init (GlMockJournalClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ /* GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = gl_mock_journal_finalize;
+*/
}
static void
diff --git a/tests/gnome-logs-test.c b/tests/gnome-logs-test.c
index b84f239..ca60090 100644
--- a/tests/gnome-logs-test.c
+++ b/tests/gnome-logs-test.c
@@ -47,11 +47,8 @@ check_log_message (void)
int
main (int argc, char** argv)
{
- g_test_init (&argc, &argv, NULL);
-
- g_test_add_func ("/util/check_log_message", check_log_message);
-
GtkApplication *application;
+ int status;
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (PACKAGE_TARNAME, "UTF-8");
@@ -59,8 +56,10 @@ main (int argc, char** argv)
g_set_prgname (PACKAGE_TARNAME);
application = gl_application_new ();
- g_application_run (G_APPLICATION (application), argc, argv);
+ status = g_application_run (G_APPLICATION (application), argc, argv);
+ g_test_init (&argc, &argv, NULL);
+ g_test_add_func ("/util/check_log_message", check_log_message);
g_object_unref (application);
-
- return g_test_run ();
+
+ return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]