cleanups in code fix tests to run and complete if they can move threadb to failing tests since it doesn't work with b...

Original commit message from CVS:
cleanups in code
fix tests to run and complete if they can
move threadb to failing tests since it doesn't work with basicomega
(crashes in the mmap)
This commit is contained in:
Thomas Vander Stichele 2002-11-13 17:06:23 +00:00
parent ede132c69c
commit 9d804f0b00
6 changed files with 48 additions and 18 deletions

View file

@ -1,11 +1,14 @@
testprogs = thread1 thread2 thread3 thread4 thread5 threadb testprogs = thread1 thread2 thread3 thread4 thread5
testsfailing = threadb
TESTS = $(testprogs) TESTS = $(testprogs)
check_PROGRAMS = $(testprogs) check_PROGRAMS = $(testprogs)
noinst_PROGRAMS = $(testsfailing)
LDADD = $(GST_LIBS) LDADD = $(GST_LIBS)
AM_CFLAGS = $(GST_CFLAGS) CFLAGS = $(GST_CFLAGS)
thread1_SOURCES = thread.c thread1_SOURCES = thread.c
thread1_CFLAGS = -DTESTNUM=1 thread1_CFLAGS = -DTESTNUM=1

View file

@ -24,7 +24,7 @@ construct_pipeline (GstElement *pipeline)
GstElement *src, *sink, *queue, *identity, *thread; GstElement *src, *sink, *queue, *identity, *thread;
src = gst_element_factory_make ("fakesrc", NULL); src = gst_element_factory_make ("fakesrc", NULL);
sink = gst_element_factory_make ("fakesink", NULL); sink = gst_element_factory_make ("fakesink", "sink");
identity = gst_element_factory_make ("identity", NULL); identity = gst_element_factory_make ("identity", NULL);
queue = gst_element_factory_make ("queue", NULL); queue = gst_element_factory_make ("queue", NULL);
thread = gst_element_factory_make ("thread", NULL); thread = gst_element_factory_make ("thread", NULL);
@ -90,7 +90,7 @@ main (gint argc, gchar *argv[])
} }
if (TESTNUM == 3) { if (TESTNUM == 3) {
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_print ("running2 ...\n"); g_print ("running ...\n");
while (gst_bin_iterate (GST_BIN (pipeline))); while (gst_bin_iterate (GST_BIN (pipeline)));
gst_element_set_state (pipeline, GST_STATE_NULL); gst_element_set_state (pipeline, GST_STATE_NULL);
} }
@ -98,7 +98,7 @@ main (gint argc, gchar *argv[])
gint run; gint run;
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_print ("running3 ...\n"); g_print ("running ...\n");
for (run = 0; run < 3; run++) { for (run = 0; run < 3; run++) {
gst_bin_iterate (GST_BIN (pipeline)); gst_bin_iterate (GST_BIN (pipeline));
} }
@ -108,10 +108,12 @@ main (gint argc, gchar *argv[])
GstElement *sink; GstElement *sink;
sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink"); sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
g_assert (sink);
g_signal_connect (G_OBJECT (sink), "handoff", G_CALLBACK (change_state), pipeline); g_signal_connect (G_OBJECT (sink), "handoff",
G_CALLBACK (change_state), pipeline);
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_print ("running3 ...\n"); g_print ("running ...\n");
while (gst_bin_iterate (GST_BIN (pipeline))); while (gst_bin_iterate (GST_BIN (pipeline)));
gst_element_set_state (pipeline, GST_STATE_NULL); gst_element_set_state (pipeline, GST_STATE_NULL);
} }

View file

@ -28,7 +28,15 @@ construct_pipeline (GstElement *pipeline)
void void
state_changed (GstElement *el, gint arg1, gint arg2, gpointer user_data) state_changed (GstElement *el, gint arg1, gint arg2, gpointer user_data)
{ {
g_print ("element %s has changed state\n", GST_ELEMENT_NAME (el)); static gboolean running = FALSE;
GstElementState state = gst_element_get_state (el);
g_print ("element %s has changed state to %s\n",
GST_ELEMENT_NAME (el),
gst_element_state_get_name (state));
if (state == GST_STATE_PLAYING) running = TRUE;
/* if we move from PLAYING to PAUSED, we're done */
if (state == GST_STATE_PAUSED && running) gst_main_quit ();
} }
int int
@ -42,7 +50,8 @@ main (gint argc, gchar *argv[])
g_assert (thread); g_assert (thread);
/* connect state change signal */ /* connect state change signal */
g_signal_connect (G_OBJECT (thread), "state_change", state_changed, NULL); g_signal_connect (G_OBJECT (thread), "state_change",
G_CALLBACK (state_changed), NULL);
construct_pipeline (thread); construct_pipeline (thread);
g_print ("Setting thread to play\n"); g_print ("Setting thread to play\n");
@ -50,6 +59,7 @@ main (gint argc, gchar *argv[])
g_print ("Going into the main GStreamer loop\n"); g_print ("Going into the main GStreamer loop\n");
gst_main (); gst_main ();
g_print ("Coming out of the main GStreamer loop\n");
return 0; return 0;
} }

View file

@ -1,11 +1,14 @@
testprogs = thread1 thread2 thread3 thread4 thread5 threadb testprogs = thread1 thread2 thread3 thread4 thread5
testsfailing = threadb
TESTS = $(testprogs) TESTS = $(testprogs)
check_PROGRAMS = $(testprogs) check_PROGRAMS = $(testprogs)
noinst_PROGRAMS = $(testsfailing)
LDADD = $(GST_LIBS) LDADD = $(GST_LIBS)
AM_CFLAGS = $(GST_CFLAGS) CFLAGS = $(GST_CFLAGS)
thread1_SOURCES = thread.c thread1_SOURCES = thread.c
thread1_CFLAGS = -DTESTNUM=1 thread1_CFLAGS = -DTESTNUM=1

View file

@ -24,7 +24,7 @@ construct_pipeline (GstElement *pipeline)
GstElement *src, *sink, *queue, *identity, *thread; GstElement *src, *sink, *queue, *identity, *thread;
src = gst_element_factory_make ("fakesrc", NULL); src = gst_element_factory_make ("fakesrc", NULL);
sink = gst_element_factory_make ("fakesink", NULL); sink = gst_element_factory_make ("fakesink", "sink");
identity = gst_element_factory_make ("identity", NULL); identity = gst_element_factory_make ("identity", NULL);
queue = gst_element_factory_make ("queue", NULL); queue = gst_element_factory_make ("queue", NULL);
thread = gst_element_factory_make ("thread", NULL); thread = gst_element_factory_make ("thread", NULL);
@ -90,7 +90,7 @@ main (gint argc, gchar *argv[])
} }
if (TESTNUM == 3) { if (TESTNUM == 3) {
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_print ("running2 ...\n"); g_print ("running ...\n");
while (gst_bin_iterate (GST_BIN (pipeline))); while (gst_bin_iterate (GST_BIN (pipeline)));
gst_element_set_state (pipeline, GST_STATE_NULL); gst_element_set_state (pipeline, GST_STATE_NULL);
} }
@ -98,7 +98,7 @@ main (gint argc, gchar *argv[])
gint run; gint run;
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_print ("running3 ...\n"); g_print ("running ...\n");
for (run = 0; run < 3; run++) { for (run = 0; run < 3; run++) {
gst_bin_iterate (GST_BIN (pipeline)); gst_bin_iterate (GST_BIN (pipeline));
} }
@ -108,10 +108,12 @@ main (gint argc, gchar *argv[])
GstElement *sink; GstElement *sink;
sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink"); sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
g_assert (sink);
g_signal_connect (G_OBJECT (sink), "handoff", G_CALLBACK (change_state), pipeline); g_signal_connect (G_OBJECT (sink), "handoff",
G_CALLBACK (change_state), pipeline);
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_print ("running3 ...\n"); g_print ("running ...\n");
while (gst_bin_iterate (GST_BIN (pipeline))); while (gst_bin_iterate (GST_BIN (pipeline)));
gst_element_set_state (pipeline, GST_STATE_NULL); gst_element_set_state (pipeline, GST_STATE_NULL);
} }

View file

@ -28,7 +28,15 @@ construct_pipeline (GstElement *pipeline)
void void
state_changed (GstElement *el, gint arg1, gint arg2, gpointer user_data) state_changed (GstElement *el, gint arg1, gint arg2, gpointer user_data)
{ {
g_print ("element %s has changed state\n", GST_ELEMENT_NAME (el)); static gboolean running = FALSE;
GstElementState state = gst_element_get_state (el);
g_print ("element %s has changed state to %s\n",
GST_ELEMENT_NAME (el),
gst_element_state_get_name (state));
if (state == GST_STATE_PLAYING) running = TRUE;
/* if we move from PLAYING to PAUSED, we're done */
if (state == GST_STATE_PAUSED && running) gst_main_quit ();
} }
int int
@ -42,7 +50,8 @@ main (gint argc, gchar *argv[])
g_assert (thread); g_assert (thread);
/* connect state change signal */ /* connect state change signal */
g_signal_connect (G_OBJECT (thread), "state_change", state_changed, NULL); g_signal_connect (G_OBJECT (thread), "state_change",
G_CALLBACK (state_changed), NULL);
construct_pipeline (thread); construct_pipeline (thread);
g_print ("Setting thread to play\n"); g_print ("Setting thread to play\n");
@ -50,6 +59,7 @@ main (gint argc, gchar *argv[])
g_print ("Going into the main GStreamer loop\n"); g_print ("Going into the main GStreamer loop\n");
gst_main (); gst_main ();
g_print ("Coming out of the main GStreamer loop\n");
return 0; return 0;
} }