Don't backport the test

This commit is contained in:
Debarshi Ray 2016-09-12 17:44:12 +02:00
parent 8bde6720a8
commit f5bc9e99ea

View File

@ -1,7 +1,7 @@
From 76e12748bd0e519caeeefd6e1ac7ce8086e63059 Mon Sep 17 00:00:00 2001 From 76e12748bd0e519caeeefd6e1ac7ce8086e63059 Mon Sep 17 00:00:00 2001
From: Ondrej Holy <oholy@redhat.com> From: Ondrej Holy <oholy@redhat.com>
Date: Thu, 11 Aug 2016 08:58:00 +0200 Date: Thu, 11 Aug 2016 08:58:00 +0200
Subject: [PATCH 1/2] core: Fix crashes on zero-length files Subject: [PATCH] core: Fix crashes on zero-length files
reached_eof is set too early and thus it may not be propagated properly reached_eof is set too early and thus it may not be propagated properly
in some cases, which may cause abortion when reading zero-length files. in some cases, which may cause abortion when reading zero-length files.
@ -40,74 +40,3 @@ index c8c1298f00f7..ce40f80f6249 100644
-- --
2.5.5 2.5.5
From 4b29a94a71317ffa9df282fef7f7be126687343a Mon Sep 17 00:00:00 2001
From: Ondrej Holy <oholy@redhat.com>
Date: Mon, 22 Aug 2016 12:02:44 +0200
Subject: [PATCH 2/2] tests: Add one more test for GDataBuffer
This test reproduces bug 769727.
https://bugzilla.gnome.org/show_bug.cgi?id=769727
---
gdata/tests/buffer.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/gdata/tests/buffer.c b/gdata/tests/buffer.c
index 02012d6cef75..c4e9d133bdc1 100644
--- a/gdata/tests/buffer.c
+++ b/gdata/tests/buffer.c
@@ -74,6 +74,41 @@ test_buffer_instant_eof (Fixture *f, gconstpointer user_data)
gdata_buffer_free (buffer);
}
+static gpointer
+test_buffer_thread_eof_func (gpointer user_data)
+{
+ GDataBuffer *buffer = user_data;
+
+ /* HACK: Wait for a while to be sure that gdata_buffer_pop_data() has
+ * been already called. */
+ g_usleep (G_USEC_PER_SEC / 2);
+
+ g_assert_false (gdata_buffer_push_data (buffer, NULL, 0));
+
+ return NULL;
+}
+
+/* The test needs to call gdata_buffer_push_data() from another thread only
+ * once gdata_buffer_pop_data() has reached its blocking loop. */
+static void
+test_buffer_thread_eof (Fixture *f, gconstpointer user_data)
+{
+ GDataBuffer *buffer = NULL; /* owned */
+ gboolean reached_eof = FALSE;
+ guint8 buf[1];
+
+ g_test_bug ("769727");
+
+ buffer = gdata_buffer_new ();
+
+ g_thread_new (NULL, test_buffer_thread_eof_func, buffer);
+ g_assert_cmpuint (gdata_buffer_pop_data (buffer, buf, sizeof (buf),
+ &reached_eof, NULL), ==, 0);
+ g_assert_true (reached_eof);
+
+ gdata_buffer_free (buffer);
+}
+
static void
test_buffer_basic (Fixture *f, gconstpointer user_data)
{
@@ -121,6 +156,8 @@ main (int argc, char *argv[])
set_up, test_buffer_construction, tear_down);
g_test_add ("/buffer/instant-eof", Fixture, NULL,
set_up, test_buffer_instant_eof, tear_down);
+ g_test_add ("/buffer/thread-eof", Fixture, NULL,
+ set_up, test_buffer_thread_eof, tear_down);
g_test_add ("/buffer/basic", Fixture, NULL,
set_up, test_buffer_basic, tear_down);
--
2.5.5