+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:
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");
+ }
+ }
+}
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);
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) \
#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;
-Struct list[] = {
+GstCheckABIStruct list[] = {
{"GstBin", sizeof (GstBin), 184},
{"GstBinClass", sizeof(GstBinClass), 288},
{"GstBuffer", sizeof(GstBuffer), 80},
#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;
-Struct list[] = {
+GstCheckABIStruct list[] = {
{"GstAdapter", sizeof(GstAdapter), 52},
{"GstAdapterClass", sizeof(GstAdapterClass), 84},
{"GstBaseSink", sizeof(GstBaseSink), 384},