mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
collectpads2: Port collectpads unit test to collectpads2
Currently fails but really shouldn't.
This commit is contained in:
parent
3844f80266
commit
0ff349fb38
4 changed files with 49 additions and 49 deletions
tests/check
|
@ -141,7 +141,7 @@ check_PROGRAMS = \
|
||||||
# failing tests
|
# failing tests
|
||||||
noinst_PROGRAMS = \
|
noinst_PROGRAMS = \
|
||||||
gst/gstpipeline \
|
gst/gstpipeline \
|
||||||
libs/collectpads
|
libs/collectpads2
|
||||||
|
|
||||||
# elements to ignore for the state tests
|
# elements to ignore for the state tests
|
||||||
# STATE_IGNORE_ELEMENTS =
|
# STATE_IGNORE_ELEMENTS =
|
||||||
|
@ -199,7 +199,7 @@ libs_gstnettimeprovider_LDADD = \
|
||||||
# these just need valgrind fixing, period
|
# these just need valgrind fixing, period
|
||||||
VALGRIND_TO_FIX = \
|
VALGRIND_TO_FIX = \
|
||||||
gst/gstinfo \
|
gst/gstinfo \
|
||||||
libs/collectpads \
|
libs/collectpads2 \
|
||||||
pipelines/parse-launch
|
pipelines/parse-launch
|
||||||
|
|
||||||
VALGRIND_IGNORE = \
|
VALGRIND_IGNORE = \
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* collectpads.c - GstCollectPads testsuite
|
* collectpads.c - GstCollectPads2 testsuite
|
||||||
* Copyright (C) 2006 Alessandro Decina <alessandro@nnva.org>
|
* Copyright (C) 2006 Alessandro Decina <alessandro@nnva.org>
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <gst/check/gstcheck.h>
|
#include <gst/check/gstcheck.h>
|
||||||
#include <gst/base/gstcollectpads.h>
|
#include <gst/base/gstcollectpads2.h>
|
||||||
|
|
||||||
#define fail_unless_collected(expected) \
|
#define fail_unless_collected(expected) \
|
||||||
G_STMT_START { \
|
G_STMT_START { \
|
||||||
|
@ -36,11 +36,11 @@ G_STMT_START { \
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char foo;
|
char foo;
|
||||||
} BadCollectData;
|
} BadCollectData2;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GstCollectData data;
|
GstCollectData2 data;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
GstEvent *event;
|
GstEvent *event;
|
||||||
|
@ -56,7 +56,7 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS_ANY);
|
GST_STATIC_CAPS_ANY);
|
||||||
|
|
||||||
static GstCollectPads *collect;
|
static GstCollectPads2 *collect;
|
||||||
static gboolean collected;
|
static gboolean collected;
|
||||||
static GstPad *srcpad1, *srcpad2;
|
static GstPad *srcpad1, *srcpad2;
|
||||||
static GstPad *sinkpad1, *sinkpad2;
|
static GstPad *sinkpad1, *sinkpad2;
|
||||||
|
@ -66,7 +66,7 @@ static GMutex *lock;
|
||||||
static GCond *cond;
|
static GCond *cond;
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
collected_cb (GstCollectPads * pads, gpointer user_data)
|
collected_cb (GstCollectPads2 * pads, gpointer user_data)
|
||||||
{
|
{
|
||||||
g_mutex_lock (lock);
|
g_mutex_lock (lock);
|
||||||
collected = TRUE;
|
collected = TRUE;
|
||||||
|
@ -100,8 +100,8 @@ push_event (gpointer user_data)
|
||||||
static void
|
static void
|
||||||
setup (void)
|
setup (void)
|
||||||
{
|
{
|
||||||
collect = gst_collect_pads_new ();
|
collect = gst_collect_pads2_new ();
|
||||||
gst_collect_pads_set_function (collect, collected_cb, NULL);
|
gst_collect_pads2_set_function (collect, collected_cb, NULL);
|
||||||
|
|
||||||
srcpad1 = gst_pad_new_from_static_template (&srctemplate, "src1");
|
srcpad1 = gst_pad_new_from_static_template (&srctemplate, "src1");
|
||||||
srcpad2 = gst_pad_new_from_static_template (&srctemplate, "src2");
|
srcpad2 = gst_pad_new_from_static_template (&srctemplate, "src2");
|
||||||
|
@ -129,15 +129,15 @@ teardown (void)
|
||||||
|
|
||||||
GST_START_TEST (test_pad_add_remove)
|
GST_START_TEST (test_pad_add_remove)
|
||||||
{
|
{
|
||||||
ASSERT_CRITICAL (gst_collect_pads_add_pad (collect, sinkpad1,
|
ASSERT_CRITICAL (gst_collect_pads2_add_pad (collect, sinkpad1,
|
||||||
sizeof (BadCollectData), NULL));
|
sizeof (BadCollectData2)));
|
||||||
|
|
||||||
data1 = (TestData *) gst_collect_pads_add_pad (collect,
|
data1 = (TestData *) gst_collect_pads2_add_pad (collect,
|
||||||
sinkpad1, sizeof (TestData), NULL);
|
sinkpad1, sizeof (TestData));
|
||||||
fail_unless (data1 != NULL);
|
fail_unless (data1 != NULL);
|
||||||
|
|
||||||
fail_unless (gst_collect_pads_remove_pad (collect, sinkpad2) == FALSE);
|
fail_unless (gst_collect_pads2_remove_pad (collect, sinkpad2) == FALSE);
|
||||||
fail_unless (gst_collect_pads_remove_pad (collect, sinkpad1) == TRUE);
|
fail_unless (gst_collect_pads2_remove_pad (collect, sinkpad1) == TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
@ -147,19 +147,19 @@ GST_START_TEST (test_collect)
|
||||||
GstBuffer *buf1, *buf2, *tmp;
|
GstBuffer *buf1, *buf2, *tmp;
|
||||||
GThread *thread1, *thread2;
|
GThread *thread1, *thread2;
|
||||||
|
|
||||||
data1 = (TestData *) gst_collect_pads_add_pad (collect,
|
data1 = (TestData *) gst_collect_pads2_add_pad (collect,
|
||||||
sinkpad1, sizeof (TestData), NULL);
|
sinkpad1, sizeof (TestData));
|
||||||
fail_unless (data1 != NULL);
|
fail_unless (data1 != NULL);
|
||||||
|
|
||||||
data2 = (TestData *) gst_collect_pads_add_pad (collect,
|
data2 = (TestData *) gst_collect_pads2_add_pad (collect,
|
||||||
sinkpad2, sizeof (TestData), NULL);
|
sinkpad2, sizeof (TestData));
|
||||||
fail_unless (data2 != NULL);
|
fail_unless (data2 != NULL);
|
||||||
|
|
||||||
buf1 = gst_buffer_new ();
|
buf1 = gst_buffer_new ();
|
||||||
buf2 = gst_buffer_new ();
|
buf2 = gst_buffer_new ();
|
||||||
|
|
||||||
/* start collect pads */
|
/* start collect pads */
|
||||||
gst_collect_pads_start (collect);
|
gst_collect_pads2_start (collect);
|
||||||
|
|
||||||
/* push buffers on the pads */
|
/* push buffers on the pads */
|
||||||
data1->pad = srcpad1;
|
data1->pad = srcpad1;
|
||||||
|
@ -175,9 +175,9 @@ GST_START_TEST (test_collect)
|
||||||
/* now both pads have a buffer */
|
/* now both pads have a buffer */
|
||||||
fail_unless_collected (TRUE);
|
fail_unless_collected (TRUE);
|
||||||
|
|
||||||
tmp = gst_collect_pads_pop (collect, (GstCollectData *) data1);
|
tmp = gst_collect_pads2_pop (collect, (GstCollectData2 *) data1);
|
||||||
fail_unless (tmp == buf1);
|
fail_unless (tmp == buf1);
|
||||||
tmp = gst_collect_pads_pop (collect, (GstCollectData *) data2);
|
tmp = gst_collect_pads2_pop (collect, (GstCollectData2 *) data2);
|
||||||
fail_unless (tmp == buf2);
|
fail_unless (tmp == buf2);
|
||||||
|
|
||||||
/* these will return immediately as at this point the threads have been
|
/* 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 (thread1);
|
||||||
g_thread_join (thread2);
|
g_thread_join (thread2);
|
||||||
|
|
||||||
gst_collect_pads_stop (collect);
|
gst_collect_pads2_stop (collect);
|
||||||
|
|
||||||
gst_buffer_unref (buf1);
|
gst_buffer_unref (buf1);
|
||||||
gst_buffer_unref (buf2);
|
gst_buffer_unref (buf2);
|
||||||
|
@ -198,18 +198,18 @@ GST_START_TEST (test_collect_eos)
|
||||||
GstBuffer *buf1, *tmp;
|
GstBuffer *buf1, *tmp;
|
||||||
GThread *thread1, *thread2;
|
GThread *thread1, *thread2;
|
||||||
|
|
||||||
data1 = (TestData *) gst_collect_pads_add_pad (collect,
|
data1 = (TestData *) gst_collect_pads2_add_pad (collect,
|
||||||
sinkpad1, sizeof (TestData), NULL);
|
sinkpad1, sizeof (TestData));
|
||||||
fail_unless (data1 != NULL);
|
fail_unless (data1 != NULL);
|
||||||
|
|
||||||
data2 = (TestData *) gst_collect_pads_add_pad (collect,
|
data2 = (TestData *) gst_collect_pads2_add_pad (collect,
|
||||||
sinkpad2, sizeof (TestData), NULL);
|
sinkpad2, sizeof (TestData));
|
||||||
fail_unless (data2 != NULL);
|
fail_unless (data2 != NULL);
|
||||||
|
|
||||||
buf1 = gst_buffer_new ();
|
buf1 = gst_buffer_new ();
|
||||||
|
|
||||||
/* start collect pads */
|
/* start collect pads */
|
||||||
gst_collect_pads_start (collect);
|
gst_collect_pads2_start (collect);
|
||||||
|
|
||||||
/* push a buffer on srcpad1 and EOS on srcpad2 */
|
/* push a buffer on srcpad1 and EOS on srcpad2 */
|
||||||
data1->pad = srcpad1;
|
data1->pad = srcpad1;
|
||||||
|
@ -224,10 +224,10 @@ GST_START_TEST (test_collect_eos)
|
||||||
/* now sinkpad1 has a buffer and sinkpad2 has EOS */
|
/* now sinkpad1 has a buffer and sinkpad2 has EOS */
|
||||||
fail_unless_collected (TRUE);
|
fail_unless_collected (TRUE);
|
||||||
|
|
||||||
tmp = gst_collect_pads_pop (collect, (GstCollectData *) data1);
|
tmp = gst_collect_pads2_pop (collect, (GstCollectData2 *) data1);
|
||||||
fail_unless (tmp == buf1);
|
fail_unless (tmp == buf1);
|
||||||
/* sinkpad2 has EOS so a NULL buffer is returned */
|
/* 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);
|
fail_unless (tmp == NULL);
|
||||||
|
|
||||||
/* these will return immediately as when the data is popped the threads are
|
/* 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 (thread1);
|
||||||
g_thread_join (thread2);
|
g_thread_join (thread2);
|
||||||
|
|
||||||
gst_collect_pads_stop (collect);
|
gst_collect_pads2_stop (collect);
|
||||||
|
|
||||||
gst_buffer_unref (buf1);
|
gst_buffer_unref (buf1);
|
||||||
}
|
}
|
||||||
|
@ -247,18 +247,18 @@ GST_START_TEST (test_collect_twice)
|
||||||
GstBuffer *buf1, *buf2, *tmp;
|
GstBuffer *buf1, *buf2, *tmp;
|
||||||
GThread *thread1, *thread2;
|
GThread *thread1, *thread2;
|
||||||
|
|
||||||
data1 = (TestData *) gst_collect_pads_add_pad (collect,
|
data1 = (TestData *) gst_collect_pads2_add_pad (collect,
|
||||||
sinkpad1, sizeof (TestData), NULL);
|
sinkpad1, sizeof (TestData));
|
||||||
fail_unless (data1 != NULL);
|
fail_unless (data1 != NULL);
|
||||||
|
|
||||||
data2 = (TestData *) gst_collect_pads_add_pad (collect,
|
data2 = (TestData *) gst_collect_pads2_add_pad (collect,
|
||||||
sinkpad2, sizeof (TestData), NULL);
|
sinkpad2, sizeof (TestData));
|
||||||
fail_unless (data2 != NULL);
|
fail_unless (data2 != NULL);
|
||||||
|
|
||||||
buf1 = gst_buffer_new ();
|
buf1 = gst_buffer_new ();
|
||||||
|
|
||||||
/* start collect pads */
|
/* start collect pads */
|
||||||
gst_collect_pads_start (collect);
|
gst_collect_pads2_start (collect);
|
||||||
|
|
||||||
/* queue a buffer */
|
/* queue a buffer */
|
||||||
data1->pad = srcpad1;
|
data1->pad = srcpad1;
|
||||||
|
@ -275,10 +275,10 @@ GST_START_TEST (test_collect_twice)
|
||||||
/* one of the pads has a buffer, the other has EOS */
|
/* one of the pads has a buffer, the other has EOS */
|
||||||
fail_unless_collected (TRUE);
|
fail_unless_collected (TRUE);
|
||||||
|
|
||||||
tmp = gst_collect_pads_pop (collect, (GstCollectData *) data1);
|
tmp = gst_collect_pads2_pop (collect, (GstCollectData2 *) data1);
|
||||||
fail_unless (tmp == buf1);
|
fail_unless (tmp == buf1);
|
||||||
/* there's nothing to pop from the one which received EOS */
|
/* 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);
|
fail_unless (tmp == NULL);
|
||||||
|
|
||||||
/* these will return immediately as at this point the threads have been
|
/* 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 (thread1);
|
||||||
g_thread_join (thread2);
|
g_thread_join (thread2);
|
||||||
|
|
||||||
gst_collect_pads_stop (collect);
|
gst_collect_pads2_stop (collect);
|
||||||
collected = FALSE;
|
collected = FALSE;
|
||||||
|
|
||||||
buf2 = gst_buffer_new ();
|
buf2 = gst_buffer_new ();
|
||||||
|
|
||||||
/* start collect pads */
|
/* start collect pads */
|
||||||
gst_collect_pads_start (collect);
|
gst_collect_pads2_start (collect);
|
||||||
|
|
||||||
/* push buffers on the pads */
|
/* push buffers on the pads */
|
||||||
data1->pad = srcpad1;
|
data1->pad = srcpad1;
|
||||||
|
@ -308,9 +308,9 @@ GST_START_TEST (test_collect_twice)
|
||||||
/* now both pads have a buffer */
|
/* now both pads have a buffer */
|
||||||
fail_unless_collected (TRUE);
|
fail_unless_collected (TRUE);
|
||||||
|
|
||||||
tmp = gst_collect_pads_pop (collect, (GstCollectData *) data1);
|
tmp = gst_collect_pads2_pop (collect, (GstCollectData2 *) data1);
|
||||||
fail_unless (tmp == buf1);
|
fail_unless (tmp == buf1);
|
||||||
tmp = gst_collect_pads_pop (collect, (GstCollectData *) data2);
|
tmp = gst_collect_pads2_pop (collect, (GstCollectData2 *) data2);
|
||||||
fail_unless (tmp == buf2);
|
fail_unless (tmp == buf2);
|
||||||
|
|
||||||
/* these will return immediately as at this point the threads have been
|
/* 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 (thread1);
|
||||||
g_thread_join (thread2);
|
g_thread_join (thread2);
|
||||||
|
|
||||||
gst_collect_pads_stop (collect);
|
gst_collect_pads2_stop (collect);
|
||||||
|
|
||||||
gst_buffer_unref (buf1);
|
gst_buffer_unref (buf1);
|
||||||
gst_buffer_unref (buf2);
|
gst_buffer_unref (buf2);
|
||||||
|
@ -328,12 +328,12 @@ GST_START_TEST (test_collect_twice)
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
static Suite *
|
static Suite *
|
||||||
gst_collect_pads_suite (void)
|
gst_collect_pads2_suite (void)
|
||||||
{
|
{
|
||||||
Suite *suite;
|
Suite *suite;
|
||||||
TCase *general;
|
TCase *general;
|
||||||
|
|
||||||
suite = suite_create ("GstCollectPads");
|
suite = suite_create ("GstCollectPads2");
|
||||||
general = tcase_create ("general");
|
general = tcase_create ("general");
|
||||||
suite_add_tcase (suite, general);
|
suite_add_tcase (suite, general);
|
||||||
tcase_add_checked_fixture (general, setup, teardown);
|
tcase_add_checked_fixture (general, setup, teardown);
|
||||||
|
@ -345,4 +345,4 @@ gst_collect_pads_suite (void)
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_CHECK_MAIN (gst_collect_pads);
|
GST_CHECK_MAIN (gst_collect_pads2);
|
|
@ -31,7 +31,7 @@
|
||||||
#include <gst/base/gstbitreader.h>
|
#include <gst/base/gstbitreader.h>
|
||||||
#include <gst/base/gstbytereader.h>
|
#include <gst/base/gstbytereader.h>
|
||||||
#include <gst/base/gstbytewriter.h>
|
#include <gst/base/gstbytewriter.h>
|
||||||
#include <gst/base/gstcollectpads.h>
|
#include <gst/base/gstcollectpads2.h>
|
||||||
#include <gst/base/gstpushsrc.h>
|
#include <gst/base/gstpushsrc.h>
|
||||||
#include <gst/base/gsttypefindhelper.h>
|
#include <gst/base/gsttypefindhelper.h>
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <gst/base/gstbitreader.h>
|
#include <gst/base/gstbitreader.h>
|
||||||
#include <gst/base/gstbytereader.h>
|
#include <gst/base/gstbytereader.h>
|
||||||
#include <gst/base/gstbytewriter.h>
|
#include <gst/base/gstbytewriter.h>
|
||||||
#include <gst/base/gstcollectpads.h>
|
#include <gst/base/gstcollectpads2.h>
|
||||||
#include <gst/base/gstpushsrc.h>
|
#include <gst/base/gstpushsrc.h>
|
||||||
#include <gst/base/gsttypefindhelper.h>
|
#include <gst/base/gsttypefindhelper.h>
|
||||||
#include <gst/controller/gstcontroller.h>
|
#include <gst/controller/gstcontroller.h>
|
||||||
|
|
Loading…
Reference in a new issue