mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
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:
parent
eec0875bd2
commit
4200f6ca41
4 changed files with 66 additions and 40 deletions
|
@ -1,9 +1,19 @@
|
||||||
testprogs = thread
|
testprogs = thread1 thread2 thread3 thread4 thread5
|
||||||
|
|
||||||
TESTS = $(testprogs)
|
TESTS = $(testprogs)
|
||||||
|
|
||||||
check_PROGRAMS = $(testprogs)
|
check_PROGRAMS = $(testprogs)
|
||||||
|
|
||||||
# we have nothing but apps here, we can do this safely
|
LDADD = $(GST_LIBS)
|
||||||
thread_LDADD = $(GST_LIBS)
|
CFLAGS = $(GST_CFLAGS)
|
||||||
thread_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_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
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
#include <gst/gst.h>
|
#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
|
void
|
||||||
usage (void)
|
usage (void)
|
||||||
{
|
{
|
||||||
g_print ("usage: thread <testnum> \n"
|
g_print ("compile this test with TESTNUM defined.\n"
|
||||||
" available testnums: \n"
|
" available TESTNUMs: \n"
|
||||||
" 1: stress test state change \n"
|
" 1: stress test state change \n"
|
||||||
" 2: iterate once \n"
|
" 2: iterate once \n"
|
||||||
" 3: iterate twice \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);
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
int
|
||||||
main (gint argc, gchar *argv[])
|
main (gint argc, gchar *argv[])
|
||||||
{
|
{
|
||||||
GstElement *pipeline;
|
GstElement *pipeline;
|
||||||
gint testnum;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
if (argc < 2) {
|
#ifndef TESTNUM
|
||||||
usage();
|
usage ();
|
||||||
return 0;
|
return -1;
|
||||||
}
|
#endif
|
||||||
|
|
||||||
testnum = atoi (argv[1]);
|
|
||||||
|
|
||||||
pipeline = gst_pipeline_new ("main_pipeline");
|
pipeline = gst_pipeline_new ("main_pipeline");
|
||||||
construct_pipeline (pipeline);
|
construct_pipeline (pipeline);
|
||||||
|
|
||||||
if (testnum == 1) {
|
if (TESTNUM == 1) {
|
||||||
g_print ("stress test state changes...\n");
|
g_print ("thread test 1: stress test state changes...\n");
|
||||||
|
|
||||||
g_print ("NULL\n");
|
g_print ("NULL\n");
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
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);
|
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);
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
g_print ("running ...\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);
|
||||||
}
|
}
|
||||||
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 ("running2 ...\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);
|
||||||
}
|
}
|
||||||
if (testnum == 4) {
|
if (TESTNUM == 4) {
|
||||||
gint run;
|
gint run;
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
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);
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
}
|
}
|
||||||
if (testnum == 5) {
|
if (TESTNUM == 5) {
|
||||||
GstElement *sink;
|
GstElement *sink;
|
||||||
|
|
||||||
sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
|
sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
testprogs = thread
|
testprogs = thread1 thread2 thread3 thread4 thread5
|
||||||
|
|
||||||
TESTS = $(testprogs)
|
TESTS = $(testprogs)
|
||||||
|
|
||||||
check_PROGRAMS = $(testprogs)
|
check_PROGRAMS = $(testprogs)
|
||||||
|
|
||||||
# we have nothing but apps here, we can do this safely
|
LDADD = $(GST_LIBS)
|
||||||
thread_LDADD = $(GST_LIBS)
|
CFLAGS = $(GST_CFLAGS)
|
||||||
thread_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_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
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
#include <gst/gst.h>
|
#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
|
void
|
||||||
usage (void)
|
usage (void)
|
||||||
{
|
{
|
||||||
g_print ("usage: thread <testnum> \n"
|
g_print ("compile this test with TESTNUM defined.\n"
|
||||||
" available testnums: \n"
|
" available TESTNUMs: \n"
|
||||||
" 1: stress test state change \n"
|
" 1: stress test state change \n"
|
||||||
" 2: iterate once \n"
|
" 2: iterate once \n"
|
||||||
" 3: iterate twice \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);
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
int
|
||||||
main (gint argc, gchar *argv[])
|
main (gint argc, gchar *argv[])
|
||||||
{
|
{
|
||||||
GstElement *pipeline;
|
GstElement *pipeline;
|
||||||
gint testnum;
|
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
if (argc < 2) {
|
#ifndef TESTNUM
|
||||||
usage();
|
usage ();
|
||||||
return 0;
|
return -1;
|
||||||
}
|
#endif
|
||||||
|
|
||||||
testnum = atoi (argv[1]);
|
|
||||||
|
|
||||||
pipeline = gst_pipeline_new ("main_pipeline");
|
pipeline = gst_pipeline_new ("main_pipeline");
|
||||||
construct_pipeline (pipeline);
|
construct_pipeline (pipeline);
|
||||||
|
|
||||||
if (testnum == 1) {
|
if (TESTNUM == 1) {
|
||||||
g_print ("stress test state changes...\n");
|
g_print ("thread test 1: stress test state changes...\n");
|
||||||
|
|
||||||
g_print ("NULL\n");
|
g_print ("NULL\n");
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
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);
|
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);
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
g_print ("running ...\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);
|
||||||
}
|
}
|
||||||
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 ("running2 ...\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);
|
||||||
}
|
}
|
||||||
if (testnum == 4) {
|
if (TESTNUM == 4) {
|
||||||
gint run;
|
gint run;
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
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);
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
}
|
}
|
||||||
if (testnum == 5) {
|
if (TESTNUM == 5) {
|
||||||
GstElement *sink;
|
GstElement *sink;
|
||||||
|
|
||||||
sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
|
sink = gst_bin_get_by_name (GST_BIN (pipeline), "sink");
|
||||||
|
|
Loading…
Reference in a new issue