From: Robert Jordan Date: Sun, 4 May 2008 16:22:22 +0000 (-0000) Subject: 2008-05-04 Robert Jordan X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=e428b7ea8a235c889dcd0edd64d59bd0b23c77c2;p=mono.git 2008-05-04 Robert Jordan * libtest.c: disable struct tests for platforms with incompatible native/managed alignments. svn path=/trunk/mono/; revision=102468 --- diff --git a/mono/tests/ChangeLog b/mono/tests/ChangeLog index eb708a715e0..87472b691c3 100644 --- a/mono/tests/ChangeLog +++ b/mono/tests/ChangeLog @@ -1,3 +1,8 @@ +2008-05-04 Robert Jordan + + * libtest.c: disable struct tests for platforms with incompatible + native/managed alignments. + 2008-05-03 Robert Jordan * libtest.c, thunks.cs: tests for mono_method_get_unmanaged_thunk (). diff --git a/mono/tests/libtest.c b/mono/tests/libtest.c index 8a137fbcaf7..206bf6fab25 100644 --- a/mono/tests/libtest.c +++ b/mono/tests/libtest.c @@ -2903,6 +2903,16 @@ mono_test_marshal_ccw_itest (MonoComObject *pUnk) * mono_method_get_unmanaged_thunk tests */ + +#define NATIVE_ALIGNMENT(type) G_STRUCT_OFFSET(struct { char c; type x; }, x) +#ifdef __GNUC__ +#define MANAGED_ALIGNMENT __alignof__ +#else +#define MANAGED_ALIGNMENT NATIVE_ALIGNMENT +#endif + +#define SAME_ALIGNMENT(type) (NATIVE_ALIGNMENT(type) == MANAGED_ALIGNMENT(type)) + /* thunks.cs:TestStruct */ typedef struct _TestStruct { int A; @@ -3112,18 +3122,15 @@ test_method_thunk (int id, gpointer test_method_handle, gpointer create_object_m } case 10: { - - break; - - /* disabled temporarily as it fails on linux/mac x86. - struct alignment problem? */ -#if 0 /* thunks.cs:Test.Foo10 */ int (STDCALL *F)(TestStruct, gpointer*); TestStruct a1; int res; + if (!SAME_ALIGNMENT (double)) + break; + a1.A = 42; a1.B = 3.1415; @@ -3137,8 +3144,6 @@ test_method_thunk (int id, gpointer test_method_handle, gpointer create_object_m return 5; break; -#endif - } case 11: { @@ -3147,6 +3152,9 @@ test_method_thunk (int id, gpointer test_method_handle, gpointer create_object_m TestStruct a1; + if (!SAME_ALIGNMENT (double)) + break; + F = test_method; F (&a1, &ex); @@ -3168,6 +3176,9 @@ test_method_thunk (int id, gpointer test_method_handle, gpointer create_object_m TestStruct a1; + if (!SAME_ALIGNMENT (double)) + break; + F = test_method; a1 = F (&ex); @@ -3188,6 +3199,10 @@ test_method_thunk (int id, gpointer test_method_handle, gpointer create_object_m void (STDCALL *F)(TestStruct*, gpointer*); TestStruct a1; + + if (!SAME_ALIGNMENT (double)) + break; + a1.A = 42; a1.B = 3.1415;