X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=test%2Fmarshal.c;h=e71b728863cb67b83fc6c3e92d53fcf3ebaf79fa;hb=04c58b9e5fbdf3acc7565f989e5fcd11f0c23c57;hp=e9ac7e303ec108a86369102b776c62d875d3e729;hpb=0611a71c67b39d90565144de20c946447e2bbea6;p=platform%2Fupstream%2Fdbus.git diff --git a/test/marshal.c b/test/marshal.c index e9ac7e3..e71b728 100644 --- a/test/marshal.c +++ b/test/marshal.c @@ -27,9 +27,9 @@ #include #include +#include #include -#include typedef struct { DBusError e; @@ -244,14 +244,30 @@ int main (int argc, char **argv) { + int ret; + char *aligned_le_blob; + char *aligned_be_blob; + g_test_init (&argc, &argv, NULL); - g_test_add ("/demarshal/le", Fixture, le_blob, setup, test_endian, teardown); - g_test_add ("/demarshal/be", Fixture, be_blob, setup, test_endian, teardown); - g_test_add ("/demarshal/needed/le", Fixture, le_blob, setup, test_needed, + /* We have to pass in a buffer that's at least "default aligned", + * i.e. on GNU systems to 8 or 16. The linker may have only given + * us byte-alignment for the char[] static variables. + */ + aligned_le_blob = g_malloc (sizeof (le_blob)); + memcpy (aligned_le_blob, le_blob, sizeof (le_blob)); + aligned_be_blob = g_malloc (sizeof (be_blob)); + memcpy (aligned_be_blob, be_blob, sizeof (be_blob)); + + g_test_add ("/demarshal/le", Fixture, aligned_le_blob, setup, test_endian, teardown); + g_test_add ("/demarshal/be", Fixture, aligned_be_blob, setup, test_endian, teardown); + g_test_add ("/demarshal/needed/le", Fixture, aligned_le_blob, setup, test_needed, teardown); - g_test_add ("/demarshal/needed/be", Fixture, be_blob, setup, test_needed, + g_test_add ("/demarshal/needed/be", Fixture, aligned_be_blob, setup, test_needed, teardown); - return g_test_run (); + ret = g_test_run (); + g_free (aligned_le_blob); + g_free (aligned_be_blob); + return ret; }