diff --git a/ChangeLog b/ChangeLog index ccd373ffa0..a15cb95181 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-12-07 Wim Taymans + + * tests/check/Makefile.am: + * tests/check/gst/.cvsignore: + * tests/check/gst/gstabi.c: (GST_START_TEST), (gstabi_suite), + (main): + * tests/check/gst/struct_i386.h: + Added check for ABI compatibility. + 2005-12-07 Wim Taymans * plugins/elements/gstfakesrc.c: (gst_fake_src_class_init), diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 810765fb91..03357834ee 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -35,6 +35,7 @@ endif check_PROGRAMS = \ gst/gst \ + gst/gstabi \ gst/gstbin \ gst/gstbuffer \ gst/gstbus \ diff --git a/tests/check/gst/.gitignore b/tests/check/gst/.gitignore index 31d6a1fb73..e332a84cf9 100644 --- a/tests/check/gst/.gitignore +++ b/tests/check/gst/.gitignore @@ -1,5 +1,6 @@ .dirstamp gst +gstabi gstbin gstbuffer gstbus diff --git a/tests/check/gst/gstabi.c b/tests/check/gst/gstabi.c new file mode 100644 index 0000000000..320adf6aba --- /dev/null +++ b/tests/check/gst/gstabi.c @@ -0,0 +1,92 @@ +/* GStreamer + * Copyright (C) 2005 Wim Taymans + * + * gstabi.c: Unit test for ABI compatibility + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include + +typedef struct +{ + char *name; + int size; + int abi_size; +} +Struct; + +#ifdef HAVE_CPU_I386 +#include "struct_i386.h" +#define HAVE_ABI_SIZES +#else +/* in case someone wants to generate a new arch */ +#include "struct_i386.h" +#endif + + +GST_START_TEST (test_ABI) +{ +#ifdef HAVE_ABI_SIZES + gboolean ok = TRUE; + gint i; + + for (i = 0; list[i].name; i++) { + if (list[i].size != list[i].abi_size) { + ok = FALSE; + g_print ("sizeof(%s) is %d, expected %d\n", + list[i].name, list[i].size, list[i].abi_size); + } + } + fail_unless (ok, "failed ABI check"); +#else + g_print ("No structure size list was generated for this architecture\n"); + g_print ("ignoring\n"); +#endif +} + +GST_END_TEST; + +Suite * +gstabi_suite (void) +{ + Suite *s = suite_create ("GstABI"); + TCase *tc_chain = tcase_create ("size check"); + + tcase_set_timeout (tc_chain, 0); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_ABI); + return s; +} + +int +main (int argc, char **argv) +{ + int nf; + + Suite *s = gstabi_suite (); + SRunner *sr = srunner_create (s); + + gst_check_init (&argc, &argv); + + srunner_run_all (sr, CK_NORMAL); + nf = srunner_ntests_failed (sr); + srunner_free (sr); + + return nf; +} diff --git a/tests/check/gst/struct_i386.h b/tests/check/gst/struct_i386.h new file mode 100644 index 0000000000..9c51ba1e85 --- /dev/null +++ b/tests/check/gst/struct_i386.h @@ -0,0 +1,73 @@ +Struct list[] = { + {"GstBin", sizeof (GstBin), 184}, + {"GstBinClass", sizeof(GstBinClass), 288}, + {"GstBuffer", sizeof(GstBuffer), 80}, + {"GstBufferClass", sizeof(GstBufferClass), 16}, + {"GstBus", sizeof(GstBus), 80}, + {"GstBusClass", sizeof(GstBusClass), 144}, + {"GstCaps", sizeof(GstCaps), 32}, + {"GstStaticCaps", sizeof(GstStaticCaps), 52}, + {"GstChildProxyInterface", sizeof(GstChildProxyInterface), 40}, + {"GstClockEntry", sizeof(GstClockEntry), 40}, + {"GstClock", sizeof(GstClock), 172}, + {"GstClockClass", sizeof(GstClockClass), 160}, + {"GstElement", sizeof(GstElement), 128}, + {"GstElementClass", sizeof(GstElementClass), 248}, + {"GstElementFactory", sizeof(GstElementFactory), 144}, + {"GstElementFactoryClass", sizeof(GstElementFactoryClass), 152}, + {"GstElementDetails", sizeof(GstElementDetails), 32}, + {"GstEvent", sizeof(GstEvent), 40}, + {"GstEventClass", sizeof(GstEventClass), 32}, + {"GstFormatDefinition", sizeof(GstFormatDefinition), 16}, + {"GstIndexEntry", sizeof(GstIndexEntry), 20}, + {"GstIndexGroup", sizeof(GstIndexGroup), 16}, + {"GstIndex", sizeof(GstIndex), 100}, + {"GstIndexClass", sizeof(GstIndexClass), 156}, + {"GstIndexAssociation", sizeof(GstIndexAssociation), 12}, + {"GstIndexFactory", sizeof(GstIndexFactory), 96}, + {"GstIndexFactoryClass", sizeof(GstIndexFactoryClass), 152}, + {"GstDebugCategory", sizeof(GstDebugCategory), 16}, + {"GstImplementsInterfaceClass", sizeof(GstImplementsInterfaceClass), 28}, + {"GstIterator", sizeof(GstIterator), 52}, + {"GstMessage", sizeof(GstMessage), 60}, + {"GstMessageClass", sizeof(GstMessageClass), 32}, + {"GstMiniObject", sizeof(GstMiniObject), 16}, + {"GstMiniObjectClass", sizeof(GstMiniObjectClass), 16}, + {"GstObject", sizeof(GstObject), 40}, + {"GstObjectClass", sizeof(GstObjectClass), 120}, + {"GstPad", sizeof(GstPad), 188}, + {"GstPadClass", sizeof(GstPadClass), 152}, + {"GstPadTemplate", sizeof(GstPadTemplate), 72}, + {"GstPadTemplateClass", sizeof(GstPadTemplateClass), 140}, + {"GstStaticPadTemplate", sizeof(GstStaticPadTemplate), 64}, + {"GstPipeline", sizeof(GstPipeline), 220}, + {"GstPipelineClass", sizeof(GstPipelineClass), 304}, + {"GstPlugin", sizeof(GstPlugin), 148}, + {"GstPluginClass", sizeof(GstPluginClass), 136}, + {"GstPluginDesc", sizeof(GstPluginDesc), 56}, + {"GstPluginFeature", sizeof(GstPluginFeature), 72}, + {"GstPluginFeatureClass", sizeof(GstPluginFeatureClass), 136}, + {"GstQueryTypeDefinition", sizeof(GstQueryTypeDefinition), 16}, + {"GstQuery", sizeof(GstQuery), 28}, + {"GstQueryClass", sizeof(GstQueryClass), 32}, + {"GstRegistry", sizeof(GstRegistry), 72}, + {"GstRegistryClass", sizeof(GstRegistryClass), 144}, + {"GstSegment", sizeof(GstSegment), 88}, + {"GstStructure", sizeof(GstStructure), 20}, + {"GstSystemClock", sizeof(GstSystemClock), 196}, + {"GstSystemClockClass", sizeof(GstSystemClockClass), 176}, + {"GstTagSetterIFace", sizeof(GstTagSetterIFace), 8}, + {"GstTask", sizeof(GstTask), 80}, + {"GstTaskClass", sizeof(GstTaskClass), 140}, + {"GstTrace", sizeof(GstTrace), 20}, + {"GstTraceEntry", sizeof(GstTraceEntry), 128}, + {"GstAllocTrace", sizeof(GstAllocTrace), 16}, + {"GstTypeFind", sizeof(GstTypeFind), 32}, + {"GstTypeFindFactory", sizeof(GstTypeFindFactory), 108}, + {"GstTypeFindFactoryClass", sizeof(GstTypeFindFactoryClass), 152}, + {"GstURIHandlerInterface", sizeof(GstURIHandlerInterface), 44}, + {"GstValueTable", sizeof(GstValueTable), 32}, + {"GstXML", sizeof(GstXML), 64}, + {"GstXMLClass", sizeof(GstXMLClass), 144}, + {NULL, 0, 0} +};