summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2011-09-28 08:25:26 +0000
committerMartin Pitt <martin.pitt@ubuntu.com>2011-09-29 13:50:21 +0200
commita4446bc6644763c1ab2fea206624da2da5ce41c7 (patch)
treea5e2f988e7367521952b15595122d610cc69d62b
parentbba1d3b336ee9b0766e94a889e984d5503c700a0 (diff)
downloadgobject-introspection-a4446bc6644763c1ab2fea206624da2da5ce41c7.tar.gz
Bug 660338: Account for padding in struct size check
On some platform like armel or powerpc the compiler adds extra padding to structs. Make the test_size_of_struct_with_array_of_anon_unions() check more liberal by only requiring that the size of the struct is at least as big as expected. Also use g_assert_cmpuint() to make it easier to see the actual diff.
-rw-r--r--tests/repository/gitypelibtest.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/repository/gitypelibtest.c b/tests/repository/gitypelibtest.c
index de821e01..8356d930 100644
--- a/tests/repository/gitypelibtest.c
+++ b/tests/repository/gitypelibtest.c
@@ -120,14 +120,15 @@ test_size_of_struct_with_array_of_anon_unions(GIRepository *repo)
struct_info = g_irepository_find_by_name (repo, "Regress", "TestStructE");
if (!struct_info)
g_error ("Could not find Regress.TestStructE");
- g_assert (g_struct_info_get_size (struct_info)
- == sizeof (GType) + 2*sizeof (gint64));
+ /* need to use >=, there might be padding */
+ g_assert_cmpuint (g_struct_info_get_size (struct_info),
+ >=, sizeof (GType) + 2*sizeof (gint64));
g_base_info_unref (struct_info);
struct_info = g_irepository_find_by_name (repo, "GObject", "Value");
if (!struct_info)
g_error ("Could not find GObject.Value");
- g_assert (g_struct_info_get_size (struct_info) == sizeof (GValue));
+ g_assert_cmpuint (g_struct_info_get_size (struct_info), ==, sizeof (GValue));
g_base_info_unref (struct_info);
}