From fa300aee2006b1771c7dd77c8cfd5730296ab5f1 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Mon, 28 Feb 2011 10:10:22 +0200 Subject: [PATCH] tests: add ABI test suite for libs --- tests/check/Makefile.am | 36 ++++++++++- tests/check/libs/libsabi.c | 112 +++++++++++++++++++++++++++++++++ tests/check/libs/struct_i386.h | 100 +++++++++++++++++++++++++++++ 3 files changed, 245 insertions(+), 3 deletions(-) create mode 100644 tests/check/libs/libsabi.c create mode 100644 tests/check/libs/struct_i386.h diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index f284716a10..f496787d35 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -37,7 +37,7 @@ endif if USE_GNOME_VFS check_gnomevfs = elements/gnomevfssink else -check_gnomevfs = +check_gnomevfs = endif if USE_GIO @@ -55,13 +55,13 @@ endif if USE_OGG check_ogg = pipelines/oggmux else -check_ogg = +check_ogg = endif if USE_PANGO check_pango = elements/textoverlay else -check_pango = +check_pango = endif if USE_VORBIS @@ -131,6 +131,7 @@ check_PROGRAMS = \ generic/clock-selection \ generic/states \ gst/typefindfunctions \ + libs/libsabi \ libs/audio \ libs/cddabasesrc \ libs/fft \ @@ -160,6 +161,15 @@ VALGRIND_TO_FIX = \ # these tests don't even pass noinst_PROGRAMS = $(check_libvisual) +noinst_HEADERS = \ + libs/struct_i386.h +# libs/struct_arm.h \ +# libs/struct_hppa.h \ +# libs/struct_ppc32.h \ +# libs/struct_ppc64.h \ +# libs/struct_sparc.h \ +# libs/struct_x86_64.h + AM_CFLAGS = $(GST_CFLAGS) $(GST_CHECK_CFLAGS) \ -DGST_TEST_FILES_PATH="\"$(TEST_FILES_DIRECTORY)\"" \ -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS @@ -170,6 +180,26 @@ VALGRIND_TESTS_DISABLE = $(VALGRIND_TO_FIX) SUPPRESSIONS = $(top_srcdir)/common/gst.supp $(srcdir)/gst-plugins-base.supp +libs_libsabi_CFLAGS = \ + $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_BASE_CFLAGS) \ + $(AM_CFLAGS) + +libs_libsabi_LDADD = \ + $(top_builddir)/gst-libs/gst/app/libgstapp-@GST_MAJORMINOR@.la \ + $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \ + $(top_builddir)/gst-libs/gst/cdda/libgstcdda-@GST_MAJORMINOR@.la \ + $(top_builddir)/gst-libs/gst/fft/libgstfft-@GST_MAJORMINOR@.la \ + $(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \ + $(top_builddir)/gst-libs/gst/netbuffer/libgstnetbuffer-@GST_MAJORMINOR@.la \ + $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la \ + $(top_builddir)/gst-libs/gst/rtp/libgstrtp-@GST_MAJORMINOR@.la \ + $(top_builddir)/gst-libs/gst/rtsp/libgstrtsp-@GST_MAJORMINOR@.la \ + $(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_MAJORMINOR@.la \ + $(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_MAJORMINOR@.la \ + $(GST_BASE_LIBS) \ + $(LDADD) + libs_audio_CFLAGS = \ $(GST_PLUGINS_BASE_CFLAGS) \ $(GST_BASE_CFLAGS) \ diff --git a/tests/check/libs/libsabi.c b/tests/check/libs/libsabi.c new file mode 100644 index 0000000000..5202d921e2 --- /dev/null +++ b/tests/check/libs/libsabi.c @@ -0,0 +1,112 @@ +/* GStreamer + * Copyright (C) 2005 Wim Taymans + * 2011 Stefan Kost + * + * libsabi.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 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* initial version of the file was generated using: + * grep -A1 "" ../../docs/libs/gst-plugins-base-libs-decl.txt | \ + * grep "" | grep -v "Private" | sort | \ + * sed -e 's/\(.*\)<\/NAME>/\ {\"\1\", sizeof (\1), 0\},/' + * + * it needs a bit of editing to remove opaque structs + */ + +#ifdef HAVE_CPU_I386 +#include "struct_i386.h" +#define HAVE_ABI_SIZES TRUE +#else +/* in case someone wants to generate a new arch */ +#include "struct_i386.h" +#define HAVE_ABI_SIZES FALSE +#endif + +GST_START_TEST (test_ABI) +{ + gst_check_abi_list (list, HAVE_ABI_SIZES); +} + +GST_END_TEST; + +static Suite * +libsabi_suite (void) +{ + Suite *s = suite_create ("LibsABI"); + 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; +} + +GST_CHECK_MAIN (libsabi); diff --git a/tests/check/libs/struct_i386.h b/tests/check/libs/struct_i386.h new file mode 100644 index 0000000000..6f504adefa --- /dev/null +++ b/tests/check/libs/struct_i386.h @@ -0,0 +1,100 @@ + +GstCheckABIStruct list[] = { + {"GstAppBufferClass", sizeof (GstAppBufferClass), 16}, + {"GstAppBuffer", sizeof (GstAppBuffer), 88}, + {"GstAppSinkCallbacks", sizeof (GstAppSinkCallbacks), 28}, + {"GstAppSinkClass", sizeof (GstAppSinkClass), 404}, + {"GstAppSink", sizeof (GstAppSink), 404}, + {"GstAppSrcCallbacks", sizeof (GstAppSrcCallbacks), 28}, + {"GstAppSrcClass", sizeof (GstAppSrcClass), 412}, + {"GstAppSrc", sizeof (GstAppSrc), 396}, + {"GstAudioClockClass", sizeof (GstAudioClockClass), 192}, + {"GstAudioClock", sizeof (GstAudioClock), 228}, + {"GstAudioFilterClass", sizeof (GstAudioFilterClass), 396}, + {"GstAudioFilter", sizeof (GstAudioFilter), 480}, + {"GstAudioSinkClass", sizeof (GstAudioSinkClass), 432}, + {"GstAudioSink", sizeof (GstAudioSink), 456}, + {"GstAudioSrcClass", sizeof (GstAudioSrcClass), 460}, + {"GstAudioSrc", sizeof (GstAudioSrc), 460}, + {"GstBaseAudioSinkClass", sizeof (GstBaseAudioSinkClass), 388}, + {"GstBaseAudioSink", sizeof (GstBaseAudioSink), 436}, + {"GstBaseAudioSrcClass", sizeof (GstBaseAudioSrcClass), 416}, + {"GstBaseAudioSrc", sizeof (GstBaseAudioSrc), 440}, + {"GstBaseRTPAudioPayloadClass", sizeof (GstBaseRTPAudioPayloadClass), 288}, + {"GstBaseRTPAudioPayload", sizeof (GstBaseRTPAudioPayload), 364}, + {"GstBaseRTPDepayloadClass", sizeof (GstBaseRTPDepayloadClass), 280}, + {"GstBaseRTPDepayload", sizeof (GstBaseRTPDepayload), 304}, + {"GstBaseRTPPayloadClass", sizeof (GstBaseRTPPayloadClass), 272}, + {"GstBaseRTPPayload", sizeof (GstBaseRTPPayload), 324}, + {"GstCddaBaseSrcClass", sizeof (GstCddaBaseSrcClass), 432}, + {"GstCddaBaseSrc", sizeof (GstCddaBaseSrc), 508}, + {"GstCddaBaseSrcTrack", sizeof (GstCddaBaseSrcTrack), 36}, + {"GstColorBalanceChannelClass", sizeof (GstColorBalanceChannelClass), 88}, + {"GstColorBalanceChannel", sizeof (GstColorBalanceChannel), 24}, + {"GstColorBalanceClass", sizeof (GstColorBalanceClass), 44}, + {"GstDiscovererClass", sizeof (GstDiscovererClass), 96}, + {"GstDiscoverer", sizeof (GstDiscoverer), 32}, + {"GstFFTF32Complex", sizeof (GstFFTF32Complex), 8}, + {"GstFFTF32", sizeof (GstFFTF32), 28}, + {"GstFFTF64Complex", sizeof (GstFFTF64Complex), 16}, + {"GstFFTF64", sizeof (GstFFTF64), 28}, + {"GstFFTS16Complex", sizeof (GstFFTS16Complex), 4}, + {"GstFFTS16", sizeof (GstFFTS16), 28}, + {"GstFFTS32Complex", sizeof (GstFFTS32Complex), 8}, + {"GstFFTS32", sizeof (GstFFTS32), 28}, + {"GstMixerClass", sizeof (GstMixerClass), 72}, + {"GstMixerOptionsClass", sizeof (GstMixerOptionsClass), 100}, + {"GstMixerOptions", sizeof (GstMixerOptions), 52}, + {"GstMixerTrackClass", sizeof (GstMixerTrackClass), 84}, + {"GstMixerTrack", sizeof (GstMixerTrack), 32}, + {"GstNavigationInterface", sizeof (GstNavigationInterface), 28}, + {"GstNetAddress", sizeof (GstNetAddress), 40}, + {"GstNetBufferClass", sizeof (GstNetBufferClass), 32}, + {"GstNetBuffer", sizeof (GstNetBuffer), 176}, + {"GstPropertyProbeInterface", sizeof (GstPropertyProbeInterface), 44}, + {"gst_riff_acid", sizeof (gst_riff_acid), 24}, + {"gst_riff_dmlh", sizeof (gst_riff_dmlh), 4}, + {"gst_riff_index_entry", sizeof (gst_riff_index_entry), 16}, + {"gst_riff_strf_auds", sizeof (gst_riff_strf_auds), 16}, + {"gst_riff_strf_iavs", sizeof (gst_riff_strf_iavs), 32}, + {"gst_riff_strf_vids", sizeof (gst_riff_strf_vids), 40}, + {"gst_riff_strh", sizeof (gst_riff_strh), 48}, + {"GstRingBufferClass", sizeof (GstRingBufferClass), 172}, + {"GstRingBuffer", sizeof (GstRingBuffer), 220}, + {"GstRingBufferSpec", sizeof (GstRingBufferSpec), 112}, + {"GstRTCPPacket", sizeof (GstRTCPPacket), 36}, + {"GstRTPPayloadInfo", sizeof (GstRTPPayloadInfo), 24}, + {"GstRTSPExtensionInterface", sizeof (GstRTSPExtensionInterface), 60}, + {"GstRTSPMessage", sizeof (GstRTSPMessage), 28}, + {"GstRTSPRange", sizeof (GstRTSPRange), 8}, + {"GstRTSPTime", sizeof (GstRTSPTime), 12}, + {"GstRTSPTimeRange", sizeof (GstRTSPTimeRange), 28}, + {"GstRTSPTransport", sizeof (GstRTSPTransport), 76}, + {"GstRTSPUrl", sizeof (GstRTSPUrl), 32}, + {"GstRTSPWatchFuncs", sizeof (GstRTSPWatchFuncs), 40}, + {"GstSDPAttribute", sizeof (GstSDPAttribute), 8}, + {"GstSDPBandwidth", sizeof (GstSDPBandwidth), 8}, + {"GstSDPConnection", sizeof (GstSDPConnection), 20}, + {"GstSDPKey", sizeof (GstSDPKey), 8}, + {"GstSDPMedia", sizeof (GstSDPMedia), 44}, + {"GstSDPMessage", sizeof (GstSDPMessage), 96}, + {"GstSDPOrigin", sizeof (GstSDPOrigin), 24}, + {"GstSDPTime", sizeof (GstSDPTime), 12}, + {"GstSDPZone", sizeof (GstSDPZone), 8}, + {"GstStreamVolumeInterface", sizeof (GstStreamVolumeInterface), 24}, + {"GstTagDemuxClass", sizeof (GstTagDemuxClass), 284}, + {"GstTagDemux", sizeof (GstTagDemux), 148}, + {"GstTunerChannelClass", sizeof (GstTunerChannelClass), 92}, + {"GstTunerChannel", sizeof (GstTunerChannel), 40}, + {"GstTunerClass", sizeof (GstTunerClass), 76}, + {"GstTunerNormClass", sizeof (GstTunerNormClass), 84}, + {"GstTunerNorm", sizeof (GstTunerNorm), 36}, + {"GstVideoFilterClass", sizeof (GstVideoFilterClass), 376}, + {"GstVideoFilter", sizeof (GstVideoFilter), 356}, + {"GstVideoOrientationInterface", sizeof (GstVideoOrientationInterface), 56}, + {"GstVideoRectangle", sizeof (GstVideoRectangle), 16}, + {"GstVideoSinkClass", sizeof (GstVideoSinkClass), 384}, + {"GstVideoSink", sizeof (GstVideoSink), 408}, + {"GstXOverlayClass", sizeof (GstXOverlayClass), 32}, + {NULL, 0, 0} +};