mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-16 19:25:18 +00:00
tests/check/: Added ABI check for libs, this time for real
Original commit message from CVS: * tests/check/Makefile.am: * tests/check/libs/libsabi.c: (GST_START_TEST), (gstabi_suite), (main): * tests/check/libs/struct_i386.h: Added ABI check for libs, this time for real
This commit is contained in:
parent
b7e641a95a
commit
7412c36419
3 changed files with 138 additions and 1 deletions
|
@ -62,6 +62,7 @@ check_PROGRAMS = \
|
|||
generic/states \
|
||||
$(PARSE_CHECKS) \
|
||||
pipelines/stress \
|
||||
libs/libsabi \
|
||||
libs/controller \
|
||||
libs/gdp \
|
||||
libs/gstnetclientclock \
|
||||
|
@ -73,7 +74,7 @@ noinst_PROGRAMS = \
|
|||
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
noinst_HEADERS = gst/capslist.h gst/struct_i386.h
|
||||
noinst_HEADERS = gst/capslist.h gst/struct_i386.h libs/struct_i386.h
|
||||
|
||||
AM_CFLAGS = $(GST_OBJ_CFLAGS) $(CHECK_CFLAGS)
|
||||
LDADD = $(top_builddir)/libs/gst/check/libgstcheck-@GST_MAJORMINOR@.la \
|
||||
|
|
106
tests/check/libs/libsabi.c
Normal file
106
tests/check/libs/libsabi.c
Normal file
|
@ -0,0 +1,106 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
|
||||
*
|
||||
* 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 <config.h>
|
||||
#include <gst/check/gstcheck.h>
|
||||
|
||||
#include <gst/base/gstadapter.h>
|
||||
#include <gst/base/gstbasesink.h>
|
||||
#include <gst/base/gstbasesrc.h>
|
||||
#include <gst/base/gstbasetransform.h>
|
||||
#include <gst/base/gstcollectpads.h>
|
||||
#include <gst/base/gstpushsrc.h>
|
||||
#include <gst/base/gsttypefindhelper.h>
|
||||
#include <gst/controller/gstcontroller.h>
|
||||
#include <gst/net/gstnet.h>
|
||||
#include <gst/net/gstnetclientclock.h>
|
||||
#include <gst/net/gstnettimepacket.h>
|
||||
#include <gst/net/gstnettimeprovider.h>
|
||||
|
||||
|
||||
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 ("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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
30
tests/check/libs/struct_i386.h
Normal file
30
tests/check/libs/struct_i386.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
Struct list[] = {
|
||||
{"GstAdapter", sizeof(GstAdapter), 52},
|
||||
{"GstAdapterClass", sizeof(GstAdapterClass), 84},
|
||||
{"GstBaseSink", sizeof(GstBaseSink), 384},
|
||||
{"GstBaseSinkClass", sizeof(GstBaseSinkClass), 368},
|
||||
{"GstBaseSrc", sizeof(GstBaseSrc), 376},
|
||||
{"GstBaseSrcClass", sizeof(GstBaseSrcClass), 376},
|
||||
{"GstBaseTransform", sizeof(GstBaseTransform), 352},
|
||||
{"GstBaseTransformClass", sizeof(GstBaseTransformClass), 376},
|
||||
{"GstCollectData", sizeof(GstCollectData), 120},
|
||||
{"GstCollectPads", sizeof(GstCollectPads), 92},
|
||||
{"GstCollectPadsClass", sizeof(GstCollectPadsClass), 136},
|
||||
{"GstPushSrc", sizeof(GstPushSrc), 392},
|
||||
{"GstPushSrcClass", sizeof(GstPushSrcClass), 396},
|
||||
|
||||
{"GstTimedValue", sizeof(GstTimedValue), 28},
|
||||
{"GstValueArray", sizeof(GstValueArray), 20},
|
||||
{"GstInterpolateMethod", sizeof(GstInterpolateMethod), 64},
|
||||
{"GstControlledProperty", sizeof(GstControlledProperty), 144},
|
||||
{"GstController", sizeof(GstController), 40},
|
||||
{"GstControllerClass", sizeof(GstControllerClass), 84},
|
||||
|
||||
{"GstNetClientClock", sizeof(GstNetClientClock), 248},
|
||||
{"GstNetClientClockClass", sizeof(GstNetClientClockClass), 192},
|
||||
{"GstNetTimePacket", sizeof(GstNetTimePacket), 16},
|
||||
{"GstNetTimeProvider", sizeof(GstNetTimeProvider), 84},
|
||||
{"GstNetTimeProviderClass", sizeof(GstNetTimeProviderClass), 120},
|
||||
|
||||
{NULL, 0, 0}
|
||||
};
|
Loading…
Reference in a new issue