mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-27 11:32:51 +00:00
libs/gst/check/gstcheck.*: factor out the method from tests that checks size of structures, and add code to generate ...
Original commit message from CVS: * libs/gst/check/gstcheck.c: (gst_check_abi_list): * libs/gst/check/gstcheck.h: factor out the method from tests that checks size of structures, and add code to generate the header containing these sizes * tests/check/gst/gstabi.c: (GST_START_TEST): * tests/check/gst/struct_i386.h: * tests/check/libs/libsabi.c: (GST_START_TEST): * tests/check/libs/struct_i386.h: use it
This commit is contained in:
parent
d1d2e509d1
commit
e036ea0995
7 changed files with 67 additions and 54 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2006-06-06 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* libs/gst/check/gstcheck.c: (gst_check_abi_list):
|
||||
* libs/gst/check/gstcheck.h:
|
||||
factor out the method from tests that checks size of structures,
|
||||
and add code to generate the header containing these sizes
|
||||
* tests/check/gst/gstabi.c: (GST_START_TEST):
|
||||
* tests/check/gst/struct_i386.h:
|
||||
* tests/check/libs/libsabi.c: (GST_START_TEST):
|
||||
* tests/check/libs/struct_i386.h:
|
||||
use it
|
||||
|
||||
2006-06-06 Michael Smith <msmith@fluendo.com>
|
||||
|
||||
* gst/gstsegment.h:
|
||||
|
|
|
@ -259,3 +259,36 @@ gst_check_teardown_sink_pad (GstElement * element)
|
|||
gst_object_unref (sinkpad);
|
||||
gst_object_unref (sinkpad);
|
||||
}
|
||||
|
||||
void
|
||||
gst_check_abi_list (GstCheckABIStruct list[], gboolean have_abi_sizes)
|
||||
{
|
||||
if (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 {
|
||||
if (g_getenv ("GST_ABI")) {
|
||||
gint i;
|
||||
|
||||
g_print ("GstCheckABIStruct list[] = {\n");
|
||||
for (i = 0; list[i].name; i++) {
|
||||
g_print (" {\"%s\", sizeof (%s), %d},\n", list[i].name, list[i].name,
|
||||
list[i].size);
|
||||
}
|
||||
g_print (" {NULL, 0, 0}\n");
|
||||
g_print ("}\n");
|
||||
} else {
|
||||
g_print ("No structure size list was generated for this architecture.\n");
|
||||
g_print ("Run with GST_ABI environment variable set to output header.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,14 @@ GList * buffers;
|
|||
GMutex *check_mutex;
|
||||
GCond *check_cond;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
int size;
|
||||
int abi_size;
|
||||
}
|
||||
GstCheckABIStruct;
|
||||
|
||||
void gst_check_init (int *argc, char **argv[]);
|
||||
|
||||
GstFlowReturn gst_check_chain_func (GstPad *pad, GstBuffer *buffer);
|
||||
|
@ -64,6 +72,8 @@ void gst_check_teardown_src_pad (GstElement *element);
|
|||
GstPad * gst_check_setup_sink_pad (GstElement *element,
|
||||
GstStaticPadTemplate *template, GstCaps *caps);
|
||||
void gst_check_teardown_sink_pad (GstElement *element);
|
||||
void gst_check_abi_list (GstCheckABIStruct list[], gboolean have_abi_sizes);
|
||||
|
||||
|
||||
|
||||
#define fail_unless_message_error(msg, domain, code) \
|
||||
|
|
|
@ -22,41 +22,22 @@
|
|||
#include <config.h>
|
||||
#include <gst/check/gstcheck.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
int size;
|
||||
int abi_size;
|
||||
}
|
||||
Struct;
|
||||
|
||||
#ifdef HAVE_CPU_I386
|
||||
#include "struct_i386.h"
|
||||
#define HAVE_ABI_SIZES
|
||||
#define HAVE_ABI_SIZES TRUE
|
||||
#else
|
||||
#ifdef HAVE_CPU_X86_64
|
||||
#include "struct_x86_64.h"
|
||||
#else
|
||||
/* in case someone wants to generate a new arch */
|
||||
#include "struct_i386.h"
|
||||
#define HAVE_ABI_SIZES FALSE
|
||||
#endif
|
||||
#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_check_abi_list (list, HAVE_ABI_SIZES);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Struct list[] = {
|
||||
GstCheckABIStruct list[] = {
|
||||
{"GstBin", sizeof (GstBin), 184},
|
||||
{"GstBinClass", sizeof(GstBinClass), 288},
|
||||
{"GstBuffer", sizeof(GstBuffer), 80},
|
||||
|
|
|
@ -35,42 +35,19 @@
|
|||
#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
|
||||
#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)
|
||||
{
|
||||
#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_check_abi_list (list, HAVE_ABI_SIZES);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Struct list[] = {
|
||||
GstCheckABIStruct list[] = {
|
||||
{"GstAdapter", sizeof(GstAdapter), 52},
|
||||
{"GstAdapterClass", sizeof(GstAdapterClass), 84},
|
||||
{"GstBaseSink", sizeof(GstBaseSink), 384},
|
||||
|
|
Loading…
Reference in a new issue