testsuite/threads/: added test to check if problem when removing all elements from a

Original commit message from CVS:
2004-07-09  Zaheer Abbas Merali  <zaheerabbas at merali dot org>

* testsuite/threads/Makefile.am:
* testsuite/threads/threadg.c:
added test to check if problem when removing all elements from a
GstThread before setting GstThread state to NULL
This commit is contained in:
Zaheer Abbas Merali 2004-07-09 14:18:35 +00:00
parent 16ff395986
commit becad99a95
5 changed files with 135 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2004-07-09 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* testsuite/threads/Makefile.am:
* testsuite/threads/threadg.c:
added test to check if problem when removing all elements from a
GstThread before setting GstThread state to NULL
2004-07-09 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
* docs/gst/tmpl/gstelement.sgml:

View file

@ -1,7 +1,7 @@
include ../Rules
tests_pass = thread1 thread2 thread3 thread4 threadf
tests_fail = thread5 threadd queue
tests_fail = thread5 threadd queue threadg
tests_ignore = threade threadb threadc

View file

@ -0,0 +1,63 @@
/* this tests if the GstThread is ok after removing all elements from it
* in PAUSED rather than NULL state. Currently it crashes with a mutex
* error
*/
#include <gst/gst.h>
int
main (int argc, char **argv)
{
GstElement *thread, *pipeline;
GstElement *src, *sink, *queue;
int i;
gst_init (&argc, &argv);
pipeline = gst_element_factory_make ("pipeline", "pipeline");
src = gst_element_factory_make ("fakesrc", "src");
g_assert (src);
gst_bin_add (GST_BIN (pipeline), src);
thread = gst_element_factory_make ("thread", "thread");
g_assert (thread);
sink = gst_element_factory_make ("fakesink", "sink");
g_assert (sink);
queue = gst_element_factory_make ("queue", "queue");
g_assert (queue);
gst_bin_add_many (GST_BIN (thread), queue, sink, NULL);
gst_bin_add (GST_BIN (pipeline), thread);
if (!gst_element_link_many (src, queue, sink, NULL))
g_assert_not_reached ();
if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS)
g_assert_not_reached ();
for (i = 0; i < 100; i++) {
if (!gst_bin_iterate (GST_BIN (pipeline)))
g_assert_not_reached ();
g_print ("%d\n", i);
}
if (gst_element_set_state (pipeline, GST_STATE_PAUSED) != GST_STATE_SUCCESS)
g_assert_not_reached ();
gst_bin_remove_many (GST_BIN (thread), queue, sink, NULL);
if (gst_element_set_state (thread, GST_STATE_NULL) != GST_STATE_SUCCESS)
g_assert_not_reached ();
gst_bin_remove (GST_BIN (pipeline), thread);
if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS)
g_assert_not_reached ();
return 0;
}

View file

@ -1,7 +1,7 @@
include ../Rules
tests_pass = thread1 thread2 thread3 thread4 threadf
tests_fail = thread5 threadd queue
tests_fail = thread5 threadd queue threadg
tests_ignore = threade threadb threadc

View file

@ -0,0 +1,63 @@
/* this tests if the GstThread is ok after removing all elements from it
* in PAUSED rather than NULL state. Currently it crashes with a mutex
* error
*/
#include <gst/gst.h>
int
main (int argc, char **argv)
{
GstElement *thread, *pipeline;
GstElement *src, *sink, *queue;
int i;
gst_init (&argc, &argv);
pipeline = gst_element_factory_make ("pipeline", "pipeline");
src = gst_element_factory_make ("fakesrc", "src");
g_assert (src);
gst_bin_add (GST_BIN (pipeline), src);
thread = gst_element_factory_make ("thread", "thread");
g_assert (thread);
sink = gst_element_factory_make ("fakesink", "sink");
g_assert (sink);
queue = gst_element_factory_make ("queue", "queue");
g_assert (queue);
gst_bin_add_many (GST_BIN (thread), queue, sink, NULL);
gst_bin_add (GST_BIN (pipeline), thread);
if (!gst_element_link_many (src, queue, sink, NULL))
g_assert_not_reached ();
if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS)
g_assert_not_reached ();
for (i = 0; i < 100; i++) {
if (!gst_bin_iterate (GST_BIN (pipeline)))
g_assert_not_reached ();
g_print ("%d\n", i);
}
if (gst_element_set_state (pipeline, GST_STATE_PAUSED) != GST_STATE_SUCCESS)
g_assert_not_reached ();
gst_bin_remove_many (GST_BIN (thread), queue, sink, NULL);
if (gst_element_set_state (thread, GST_STATE_NULL) != GST_STATE_SUCCESS)
g_assert_not_reached ();
gst_bin_remove (GST_BIN (pipeline), thread);
if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS)
g_assert_not_reached ();
return 0;
}