diff --git a/tests/old/testsuite/threads/Makefile.am b/tests/old/testsuite/threads/Makefile.am index 276a2393d6..1a4279a4bb 100644 --- a/tests/old/testsuite/threads/Makefile.am +++ b/tests/old/testsuite/threads/Makefile.am @@ -1,9 +1,19 @@ -testprogs = thread +testprogs = thread1 thread2 thread3 thread4 thread5 TESTS = $(testprogs) check_PROGRAMS = $(testprogs) -# we have nothing but apps here, we can do this safely -thread_LDADD = $(GST_LIBS) -thread_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +LDADD = $(GST_LIBS) +CFLAGS = $(GST_CFLAGS) + +thread1_SOURCES = thread.c +thread1_CFLAGS = -DTESTNUM=1 +thread2_SOURCES = thread.c +thread2_CFLAGS = -DTESTNUM=2 +thread3_SOURCES = thread.c +thread3_CFLAGS = -DTESTNUM=3 +thread4_SOURCES = thread.c +thread4_CFLAGS = -DTESTNUM=4 +thread5_SOURCES = thread.c +thread5_CFLAGS = -DTESTNUM=5 diff --git a/tests/old/testsuite/threads/thread.c b/tests/old/testsuite/threads/thread.c index efa0281e6e..5b9adcc707 100644 --- a/tests/old/testsuite/threads/thread.c +++ b/tests/old/testsuite/threads/thread.c @@ -1,10 +1,16 @@ #include +/* + * FIXME: + * these tests should have a maximum run length, so that they get killed + * if they lock up, which they're bound to do. + */ + void usage (void) { - g_print ("usage: thread \n" - " available testnums: \n" + g_print ("compile this test with TESTNUM defined.\n" + " available TESTNUMs: \n" " 1: stress test state change \n" " 2: iterate once \n" " 3: iterate twice \n" @@ -37,26 +43,23 @@ change_state (GstElement *element, GstBuffer *buf, GstElement *pipeline) gst_element_set_state (pipeline, GST_STATE_NULL); } -gint +int main (gint argc, gchar *argv[]) { GstElement *pipeline; - gint testnum; gst_init (&argc, &argv); - if (argc < 2) { - usage(); - return 0; - } +#ifndef TESTNUM + usage (); + return -1; +#endif - testnum = atoi (argv[1]); - pipeline = gst_pipeline_new ("main_pipeline"); construct_pipeline (pipeline); - if (testnum == 1) { - g_print ("stress test state changes...\n"); + if (TESTNUM == 1) { + g_print ("thread test 1: stress test state changes...\n"); g_print ("NULL\n"); gst_element_set_state (pipeline, GST_STATE_NULL); @@ -79,19 +82,19 @@ main (gint argc, gchar *argv[]) gst_element_set_state (pipeline, GST_STATE_NULL); } - if (testnum == 2 || testnum == 3) { + if (TESTNUM == 2 || TESTNUM == 3) { gst_element_set_state (pipeline, GST_STATE_PLAYING); g_print ("running ...\n"); while (gst_bin_iterate (GST_BIN (pipeline))); gst_element_set_state (pipeline, GST_STATE_NULL); } - if (testnum == 3) { + if (TESTNUM == 3) { gst_element_set_state (pipeline, GST_STATE_PLAYING); g_print ("running2 ...\n"); while (gst_bin_iterate (GST_BIN (pipeline))); gst_element_set_state (pipeline, GST_STATE_NULL); } - if (testnum == 4) { + if (TESTNUM == 4) { gint run; gst_element_set_state (pipeline, GST_STATE_PLAYING); @@ -101,7 +104,7 @@ main (gint argc, gchar *argv[]) } gst_element_set_state (pipeline, GST_STATE_NULL); } - if (testnum == 5) { + if (TESTNUM == 5) { GstElement *sink; sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink"); diff --git a/testsuite/threads/Makefile.am b/testsuite/threads/Makefile.am index 276a2393d6..1a4279a4bb 100644 --- a/testsuite/threads/Makefile.am +++ b/testsuite/threads/Makefile.am @@ -1,9 +1,19 @@ -testprogs = thread +testprogs = thread1 thread2 thread3 thread4 thread5 TESTS = $(testprogs) check_PROGRAMS = $(testprogs) -# we have nothing but apps here, we can do this safely -thread_LDADD = $(GST_LIBS) -thread_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +LDADD = $(GST_LIBS) +CFLAGS = $(GST_CFLAGS) + +thread1_SOURCES = thread.c +thread1_CFLAGS = -DTESTNUM=1 +thread2_SOURCES = thread.c +thread2_CFLAGS = -DTESTNUM=2 +thread3_SOURCES = thread.c +thread3_CFLAGS = -DTESTNUM=3 +thread4_SOURCES = thread.c +thread4_CFLAGS = -DTESTNUM=4 +thread5_SOURCES = thread.c +thread5_CFLAGS = -DTESTNUM=5 diff --git a/testsuite/threads/thread.c b/testsuite/threads/thread.c index efa0281e6e..5b9adcc707 100644 --- a/testsuite/threads/thread.c +++ b/testsuite/threads/thread.c @@ -1,10 +1,16 @@ #include +/* + * FIXME: + * these tests should have a maximum run length, so that they get killed + * if they lock up, which they're bound to do. + */ + void usage (void) { - g_print ("usage: thread \n" - " available testnums: \n" + g_print ("compile this test with TESTNUM defined.\n" + " available TESTNUMs: \n" " 1: stress test state change \n" " 2: iterate once \n" " 3: iterate twice \n" @@ -37,26 +43,23 @@ change_state (GstElement *element, GstBuffer *buf, GstElement *pipeline) gst_element_set_state (pipeline, GST_STATE_NULL); } -gint +int main (gint argc, gchar *argv[]) { GstElement *pipeline; - gint testnum; gst_init (&argc, &argv); - if (argc < 2) { - usage(); - return 0; - } +#ifndef TESTNUM + usage (); + return -1; +#endif - testnum = atoi (argv[1]); - pipeline = gst_pipeline_new ("main_pipeline"); construct_pipeline (pipeline); - if (testnum == 1) { - g_print ("stress test state changes...\n"); + if (TESTNUM == 1) { + g_print ("thread test 1: stress test state changes...\n"); g_print ("NULL\n"); gst_element_set_state (pipeline, GST_STATE_NULL); @@ -79,19 +82,19 @@ main (gint argc, gchar *argv[]) gst_element_set_state (pipeline, GST_STATE_NULL); } - if (testnum == 2 || testnum == 3) { + if (TESTNUM == 2 || TESTNUM == 3) { gst_element_set_state (pipeline, GST_STATE_PLAYING); g_print ("running ...\n"); while (gst_bin_iterate (GST_BIN (pipeline))); gst_element_set_state (pipeline, GST_STATE_NULL); } - if (testnum == 3) { + if (TESTNUM == 3) { gst_element_set_state (pipeline, GST_STATE_PLAYING); g_print ("running2 ...\n"); while (gst_bin_iterate (GST_BIN (pipeline))); gst_element_set_state (pipeline, GST_STATE_NULL); } - if (testnum == 4) { + if (TESTNUM == 4) { gint run; gst_element_set_state (pipeline, GST_STATE_PLAYING); @@ -101,7 +104,7 @@ main (gint argc, gchar *argv[]) } gst_element_set_state (pipeline, GST_STATE_NULL); } - if (testnum == 5) { + if (TESTNUM == 5) { GstElement *sink; sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");