From 0ff349fb38121adac9c4c909877d24660dae5de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 26 Jan 2012 11:38:29 +0100 Subject: [PATCH] collectpads2: Port collectpads unit test to collectpads2 Currently fails but really shouldn't. --- tests/check/Makefile.am | 4 +- .../libs/{collectpads.c => collectpads2.c} | 90 +++++++++---------- tests/check/libs/gstlibscpp.cc | 2 +- tests/check/libs/libsabi.c | 2 +- 4 files changed, 49 insertions(+), 49 deletions(-) rename tests/check/libs/{collectpads.c => collectpads2.c} (77%) diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index f254fae6ce..f0550adb87 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -141,7 +141,7 @@ check_PROGRAMS = \ # failing tests noinst_PROGRAMS = \ gst/gstpipeline \ - libs/collectpads + libs/collectpads2 # elements to ignore for the state tests # STATE_IGNORE_ELEMENTS = @@ -199,7 +199,7 @@ libs_gstnettimeprovider_LDADD = \ # these just need valgrind fixing, period VALGRIND_TO_FIX = \ gst/gstinfo \ - libs/collectpads \ + libs/collectpads2 \ pipelines/parse-launch VALGRIND_IGNORE = \ diff --git a/tests/check/libs/collectpads.c b/tests/check/libs/collectpads2.c similarity index 77% rename from tests/check/libs/collectpads.c rename to tests/check/libs/collectpads2.c index ea54d39406..97e7f5bd42 100644 --- a/tests/check/libs/collectpads.c +++ b/tests/check/libs/collectpads2.c @@ -1,5 +1,5 @@ /* - * collectpads.c - GstCollectPads testsuite + * collectpads.c - GstCollectPads2 testsuite * Copyright (C) 2006 Alessandro Decina * * Authors: @@ -22,7 +22,7 @@ */ #include -#include +#include #define fail_unless_collected(expected) \ G_STMT_START { \ @@ -36,11 +36,11 @@ G_STMT_START { \ typedef struct { char foo; -} BadCollectData; +} BadCollectData2; typedef struct { - GstCollectData data; + GstCollectData2 data; GstPad *pad; GstBuffer *buffer; GstEvent *event; @@ -56,7 +56,7 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); -static GstCollectPads *collect; +static GstCollectPads2 *collect; static gboolean collected; static GstPad *srcpad1, *srcpad2; static GstPad *sinkpad1, *sinkpad2; @@ -66,7 +66,7 @@ static GMutex *lock; static GCond *cond; static GstFlowReturn -collected_cb (GstCollectPads * pads, gpointer user_data) +collected_cb (GstCollectPads2 * pads, gpointer user_data) { g_mutex_lock (lock); collected = TRUE; @@ -100,8 +100,8 @@ push_event (gpointer user_data) static void setup (void) { - collect = gst_collect_pads_new (); - gst_collect_pads_set_function (collect, collected_cb, NULL); + collect = gst_collect_pads2_new (); + gst_collect_pads2_set_function (collect, collected_cb, NULL); srcpad1 = gst_pad_new_from_static_template (&srctemplate, "src1"); srcpad2 = gst_pad_new_from_static_template (&srctemplate, "src2"); @@ -129,15 +129,15 @@ teardown (void) GST_START_TEST (test_pad_add_remove) { - ASSERT_CRITICAL (gst_collect_pads_add_pad (collect, sinkpad1, - sizeof (BadCollectData), NULL)); + ASSERT_CRITICAL (gst_collect_pads2_add_pad (collect, sinkpad1, + sizeof (BadCollectData2))); - data1 = (TestData *) gst_collect_pads_add_pad (collect, - sinkpad1, sizeof (TestData), NULL); + data1 = (TestData *) gst_collect_pads2_add_pad (collect, + sinkpad1, sizeof (TestData)); fail_unless (data1 != NULL); - fail_unless (gst_collect_pads_remove_pad (collect, sinkpad2) == FALSE); - fail_unless (gst_collect_pads_remove_pad (collect, sinkpad1) == TRUE); + fail_unless (gst_collect_pads2_remove_pad (collect, sinkpad2) == FALSE); + fail_unless (gst_collect_pads2_remove_pad (collect, sinkpad1) == TRUE); } GST_END_TEST; @@ -147,19 +147,19 @@ GST_START_TEST (test_collect) GstBuffer *buf1, *buf2, *tmp; GThread *thread1, *thread2; - data1 = (TestData *) gst_collect_pads_add_pad (collect, - sinkpad1, sizeof (TestData), NULL); + data1 = (TestData *) gst_collect_pads2_add_pad (collect, + sinkpad1, sizeof (TestData)); fail_unless (data1 != NULL); - data2 = (TestData *) gst_collect_pads_add_pad (collect, - sinkpad2, sizeof (TestData), NULL); + data2 = (TestData *) gst_collect_pads2_add_pad (collect, + sinkpad2, sizeof (TestData)); fail_unless (data2 != NULL); buf1 = gst_buffer_new (); buf2 = gst_buffer_new (); /* start collect pads */ - gst_collect_pads_start (collect); + gst_collect_pads2_start (collect); /* push buffers on the pads */ data1->pad = srcpad1; @@ -175,9 +175,9 @@ GST_START_TEST (test_collect) /* now both pads have a buffer */ fail_unless_collected (TRUE); - tmp = gst_collect_pads_pop (collect, (GstCollectData *) data1); + tmp = gst_collect_pads2_pop (collect, (GstCollectData2 *) data1); fail_unless (tmp == buf1); - tmp = gst_collect_pads_pop (collect, (GstCollectData *) data2); + tmp = gst_collect_pads2_pop (collect, (GstCollectData2 *) data2); fail_unless (tmp == buf2); /* these will return immediately as at this point the threads have been @@ -185,7 +185,7 @@ GST_START_TEST (test_collect) g_thread_join (thread1); g_thread_join (thread2); - gst_collect_pads_stop (collect); + gst_collect_pads2_stop (collect); gst_buffer_unref (buf1); gst_buffer_unref (buf2); @@ -198,18 +198,18 @@ GST_START_TEST (test_collect_eos) GstBuffer *buf1, *tmp; GThread *thread1, *thread2; - data1 = (TestData *) gst_collect_pads_add_pad (collect, - sinkpad1, sizeof (TestData), NULL); + data1 = (TestData *) gst_collect_pads2_add_pad (collect, + sinkpad1, sizeof (TestData)); fail_unless (data1 != NULL); - data2 = (TestData *) gst_collect_pads_add_pad (collect, - sinkpad2, sizeof (TestData), NULL); + data2 = (TestData *) gst_collect_pads2_add_pad (collect, + sinkpad2, sizeof (TestData)); fail_unless (data2 != NULL); buf1 = gst_buffer_new (); /* start collect pads */ - gst_collect_pads_start (collect); + gst_collect_pads2_start (collect); /* push a buffer on srcpad1 and EOS on srcpad2 */ data1->pad = srcpad1; @@ -224,10 +224,10 @@ GST_START_TEST (test_collect_eos) /* now sinkpad1 has a buffer and sinkpad2 has EOS */ fail_unless_collected (TRUE); - tmp = gst_collect_pads_pop (collect, (GstCollectData *) data1); + tmp = gst_collect_pads2_pop (collect, (GstCollectData2 *) data1); fail_unless (tmp == buf1); /* sinkpad2 has EOS so a NULL buffer is returned */ - tmp = gst_collect_pads_pop (collect, (GstCollectData *) data2); + tmp = gst_collect_pads2_pop (collect, (GstCollectData2 *) data2); fail_unless (tmp == NULL); /* these will return immediately as when the data is popped the threads are @@ -235,7 +235,7 @@ GST_START_TEST (test_collect_eos) g_thread_join (thread1); g_thread_join (thread2); - gst_collect_pads_stop (collect); + gst_collect_pads2_stop (collect); gst_buffer_unref (buf1); } @@ -247,18 +247,18 @@ GST_START_TEST (test_collect_twice) GstBuffer *buf1, *buf2, *tmp; GThread *thread1, *thread2; - data1 = (TestData *) gst_collect_pads_add_pad (collect, - sinkpad1, sizeof (TestData), NULL); + data1 = (TestData *) gst_collect_pads2_add_pad (collect, + sinkpad1, sizeof (TestData)); fail_unless (data1 != NULL); - data2 = (TestData *) gst_collect_pads_add_pad (collect, - sinkpad2, sizeof (TestData), NULL); + data2 = (TestData *) gst_collect_pads2_add_pad (collect, + sinkpad2, sizeof (TestData)); fail_unless (data2 != NULL); buf1 = gst_buffer_new (); /* start collect pads */ - gst_collect_pads_start (collect); + gst_collect_pads2_start (collect); /* queue a buffer */ data1->pad = srcpad1; @@ -275,10 +275,10 @@ GST_START_TEST (test_collect_twice) /* one of the pads has a buffer, the other has EOS */ fail_unless_collected (TRUE); - tmp = gst_collect_pads_pop (collect, (GstCollectData *) data1); + tmp = gst_collect_pads2_pop (collect, (GstCollectData2 *) data1); fail_unless (tmp == buf1); /* there's nothing to pop from the one which received EOS */ - tmp = gst_collect_pads_pop (collect, (GstCollectData *) data2); + tmp = gst_collect_pads2_pop (collect, (GstCollectData2 *) data2); fail_unless (tmp == NULL); /* these will return immediately as at this point the threads have been @@ -286,13 +286,13 @@ GST_START_TEST (test_collect_twice) g_thread_join (thread1); g_thread_join (thread2); - gst_collect_pads_stop (collect); + gst_collect_pads2_stop (collect); collected = FALSE; buf2 = gst_buffer_new (); /* start collect pads */ - gst_collect_pads_start (collect); + gst_collect_pads2_start (collect); /* push buffers on the pads */ data1->pad = srcpad1; @@ -308,9 +308,9 @@ GST_START_TEST (test_collect_twice) /* now both pads have a buffer */ fail_unless_collected (TRUE); - tmp = gst_collect_pads_pop (collect, (GstCollectData *) data1); + tmp = gst_collect_pads2_pop (collect, (GstCollectData2 *) data1); fail_unless (tmp == buf1); - tmp = gst_collect_pads_pop (collect, (GstCollectData *) data2); + tmp = gst_collect_pads2_pop (collect, (GstCollectData2 *) data2); fail_unless (tmp == buf2); /* these will return immediately as at this point the threads have been @@ -318,7 +318,7 @@ GST_START_TEST (test_collect_twice) g_thread_join (thread1); g_thread_join (thread2); - gst_collect_pads_stop (collect); + gst_collect_pads2_stop (collect); gst_buffer_unref (buf1); gst_buffer_unref (buf2); @@ -328,12 +328,12 @@ GST_START_TEST (test_collect_twice) GST_END_TEST; static Suite * -gst_collect_pads_suite (void) +gst_collect_pads2_suite (void) { Suite *suite; TCase *general; - suite = suite_create ("GstCollectPads"); + suite = suite_create ("GstCollectPads2"); general = tcase_create ("general"); suite_add_tcase (suite, general); tcase_add_checked_fixture (general, setup, teardown); @@ -345,4 +345,4 @@ gst_collect_pads_suite (void) return suite; } -GST_CHECK_MAIN (gst_collect_pads); +GST_CHECK_MAIN (gst_collect_pads2); diff --git a/tests/check/libs/gstlibscpp.cc b/tests/check/libs/gstlibscpp.cc index 0009ec3f47..29939a3d8e 100644 --- a/tests/check/libs/gstlibscpp.cc +++ b/tests/check/libs/gstlibscpp.cc @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include diff --git a/tests/check/libs/libsabi.c b/tests/check/libs/libsabi.c index 117df17ed5..7010f14dfb 100644 --- a/tests/check/libs/libsabi.c +++ b/tests/check/libs/libsabi.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include