|
|
407148 |
From 85c4031696add9797e2334ced20678edcd96c869 Mon Sep 17 00:00:00 2001
|
|
|
407148 |
From: Mart Raudsepp <leio@gentoo.org>
|
|
|
407148 |
Date: Wed, 19 Dec 2018 16:22:21 +0200
|
|
|
407148 |
Subject: [PATCH 1/2] tests: Allocate gvariant data from the heap to guarantee
|
|
|
407148 |
alignment
|
|
|
407148 |
|
|
|
407148 |
On glib-2-58 branch we don't have !455, thus we need aligned data
|
|
|
407148 |
for the gvariant tests to not fail on i686.
|
|
|
407148 |
|
|
|
407148 |
Fixes #1626
|
|
|
407148 |
---
|
|
|
407148 |
glib/tests/gvariant.c | 15 ++++++++++++---
|
|
|
407148 |
1 file changed, 12 insertions(+), 3 deletions(-)
|
|
|
407148 |
|
|
|
407148 |
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
|
|
|
407148 |
index 6e417f6c1..a7b19826d 100644
|
|
|
407148 |
--- a/glib/tests/gvariant.c
|
|
|
407148 |
+++ b/glib/tests/gvariant.c
|
|
|
407148 |
@@ -4664,6 +4664,7 @@ test_stack_dict_init (void)
|
|
|
407148 |
static void
|
|
|
407148 |
test_normal_checking_tuples (void)
|
|
|
407148 |
{
|
|
|
407148 |
+ gpointer aligned_data;
|
|
|
407148 |
const guint8 data[] = {
|
|
|
407148 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
|
|
|
407148 |
'a', '(', 'a', 'o', 'a', 'o', 'a', 'a', 'o', 'a', 'a', 'o', ')'
|
|
|
407148 |
@@ -4672,13 +4673,15 @@ test_normal_checking_tuples (void)
|
|
|
407148 |
GVariant *variant = NULL;
|
|
|
407148 |
GVariant *normal_variant = NULL;
|
|
|
407148 |
|
|
|
407148 |
- variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, data, size,
|
|
|
407148 |
+ aligned_data = g_memdup (data, size); /* guarantee alignment */
|
|
|
407148 |
+ variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, aligned_data, size,
|
|
|
407148 |
FALSE, NULL, NULL);
|
|
|
407148 |
g_assert_nonnull (variant);
|
|
|
407148 |
|
|
|
407148 |
normal_variant = g_variant_get_normal_form (variant);
|
|
|
407148 |
g_assert_nonnull (normal_variant);
|
|
|
407148 |
|
|
|
407148 |
+ g_free (aligned_data);
|
|
|
407148 |
g_variant_unref (normal_variant);
|
|
|
407148 |
g_variant_unref (variant);
|
|
|
407148 |
}
|
|
|
407148 |
@@ -4790,6 +4793,7 @@ test_recursion_limits_array_in_variant (void)
|
|
|
407148 |
static void
|
|
|
407148 |
test_normal_checking_array_offsets (void)
|
|
|
407148 |
{
|
|
|
407148 |
+ gpointer aligned_data;
|
|
|
407148 |
const guint8 data[] = {
|
|
|
407148 |
0x07, 0xe5, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
|
|
|
407148 |
'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'g',
|
|
|
407148 |
@@ -4798,13 +4802,15 @@ test_normal_checking_array_offsets (void)
|
|
|
407148 |
GVariant *variant = NULL;
|
|
|
407148 |
GVariant *normal_variant = NULL;
|
|
|
407148 |
|
|
|
407148 |
- variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, data, size,
|
|
|
407148 |
+ aligned_data = g_memdup (data, size); /* guarantee alignment */
|
|
|
407148 |
+ variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, aligned_data, size,
|
|
|
407148 |
FALSE, NULL, NULL);
|
|
|
407148 |
g_assert_nonnull (variant);
|
|
|
407148 |
|
|
|
407148 |
normal_variant = g_variant_get_normal_form (variant);
|
|
|
407148 |
g_assert_nonnull (normal_variant);
|
|
|
407148 |
|
|
|
407148 |
+ g_free (aligned_data);
|
|
|
407148 |
g_variant_unref (normal_variant);
|
|
|
407148 |
g_variant_unref (variant);
|
|
|
407148 |
}
|
|
|
407148 |
@@ -4838,6 +4844,7 @@ test_normal_checking_tuple_offsets (void)
|
|
|
407148 |
static void
|
|
|
407148 |
test_normal_checking_empty_object_path (void)
|
|
|
407148 |
{
|
|
|
407148 |
+ gpointer aligned_data;
|
|
|
407148 |
const guint8 data[] = {
|
|
|
407148 |
0x20, 0x20, 0x00, 0x00, 0x00, 0x00,
|
|
|
407148 |
'(', 'h', '(', 'a', 'i', 'a', 'b', 'i', 'o', ')', ')',
|
|
|
407148 |
@@ -4846,13 +4853,15 @@ test_normal_checking_empty_object_path (void)
|
|
|
407148 |
GVariant *variant = NULL;
|
|
|
407148 |
GVariant *normal_variant = NULL;
|
|
|
407148 |
|
|
|
407148 |
- variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, data, size,
|
|
|
407148 |
+ aligned_data = g_memdup (data, size); /* guarantee alignment */
|
|
|
407148 |
+ variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, aligned_data, size,
|
|
|
407148 |
FALSE, NULL, NULL);
|
|
|
407148 |
g_assert_nonnull (variant);
|
|
|
407148 |
|
|
|
407148 |
normal_variant = g_variant_get_normal_form (variant);
|
|
|
407148 |
g_assert_nonnull (normal_variant);
|
|
|
407148 |
|
|
|
407148 |
+ g_free (aligned_data);
|
|
|
407148 |
g_variant_unref (normal_variant);
|
|
|
407148 |
g_variant_unref (variant);
|
|
|
407148 |
}
|
|
|
407148 |
--
|
|
|
407148 |
2.19.1
|
|
|
407148 |
|
|
|
6de84d |
From 4ef58e5661849317a1110c9b93957f2c608677dd Mon Sep 17 00:00:00 2001
|
|
|
6de84d |
From: Simon McVittie <smcv@collabora.com>
|
|
|
6de84d |
Date: Thu, 3 Jan 2019 08:21:40 +0000
|
|
|
6de84d |
Subject: [PATCH 2/2] gvariant test: Also force alignment for tuple test data
|
|
|
6de84d |
|
|
|
6de84d |
glib!552 (commit 9eed22b3) fixed this for the tests that failed on i686,
|
|
|
6de84d |
but this additional test failed on Debian's s390x port
|
|
|
6de84d |
(IBM z/Architecture, 64-bit big-endian).
|
|
|
6de84d |
|
|
|
6de84d |
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|
|
6de84d |
---
|
|
|
6de84d |
glib/tests/gvariant.c | 7 +++++--
|
|
|
6de84d |
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
6de84d |
|
|
|
6de84d |
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
|
|
|
6de84d |
index a7b19826d..c4a996c1f 100644
|
|
|
6de84d |
--- a/glib/tests/gvariant.c
|
|
|
6de84d |
+++ b/glib/tests/gvariant.c
|
|
|
6de84d |
@@ -4820,6 +4820,7 @@ test_normal_checking_array_offsets (void)
|
|
|
6de84d |
static void
|
|
|
6de84d |
test_normal_checking_tuple_offsets (void)
|
|
|
6de84d |
{
|
|
|
6de84d |
+ gpointer aligned_data;
|
|
|
6de84d |
const guint8 data[] = {
|
|
|
6de84d |
0x07, 0xe5, 0x00, 0x07, 0x00, 0x07,
|
|
|
6de84d |
'(', 'a', 's', 'a', 's', 'a', 's', 'a', 's', 'a', 's', 'a', 's', ')',
|
|
|
6de84d |
@@ -4828,13 +4829,15 @@ test_normal_checking_tuple_offsets (void)
|
|
|
6de84d |
GVariant *variant = NULL;
|
|
|
6de84d |
GVariant *normal_variant = NULL;
|
|
|
6de84d |
|
|
|
6de84d |
- variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, data, size,
|
|
|
6de84d |
- FALSE, NULL, NULL);
|
|
|
6de84d |
+ aligned_data = g_memdup (data, size); /* guarantee alignment */
|
|
|
6de84d |
+ variant = g_variant_new_from_data (G_VARIANT_TYPE_VARIANT, aligned_data,
|
|
|
6de84d |
+ size, FALSE, NULL, NULL);
|
|
|
6de84d |
g_assert_nonnull (variant);
|
|
|
6de84d |
|
|
|
6de84d |
normal_variant = g_variant_get_normal_form (variant);
|
|
|
6de84d |
g_assert_nonnull (normal_variant);
|
|
|
6de84d |
|
|
|
6de84d |
+ g_free (aligned_data);
|
|
|
6de84d |
g_variant_unref (normal_variant);
|
|
|
6de84d |
g_variant_unref (variant);
|
|
|
6de84d |
}
|
|
|
6de84d |
--
|
|
|
6de84d |
2.19.1
|