converting this to separate binaries so they can be run as a testsuite

Original commit message from CVS:
converting this to separate binaries so they can be run as a testsuite
This commit is contained in:
Thomas Vander Stichele 2002-09-12 11:56:08 +00:00
parent eec0875bd2
commit 4200f6ca41
4 changed files with 66 additions and 40 deletions

View file

@ -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

View file

@ -1,10 +1,16 @@
#include <gst/gst.h>
/*
* 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 <testnum> \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) {
#ifndef TESTNUM
usage ();
return 0;
}
testnum = atoi (argv[1]);
return -1;
#endif
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");

View file

@ -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

View file

@ -1,10 +1,16 @@
#include <gst/gst.h>
/*
* 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 <testnum> \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) {
#ifndef TESTNUM
usage ();
return 0;
}
testnum = atoi (argv[1]);
return -1;
#endif
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");