From 9c87c528e72178dd9357a8ff9c958d9fdac562ef Mon Sep 17 00:00:00 2001 From: David Schleef Date: Wed, 15 Oct 2003 01:25:41 +0000 Subject: [PATCH] Massive patch to make 'make check' work properly. Many compilation fixes -- everything should compile now. Some tes... Original commit message from CVS: Massive patch to make 'make check' work properly. Many compilation fixes -- everything should compile now. Some tests pass, some fail; the expected sucess/failure is coded in the Makefile.am's. gst-register is properly run for both 'make check' and 'make distcheck'. Much of the common infrastructure is coded in testsuite/Rules. --- tests/old/testsuite/Makefile.am | 40 ++++------ tests/old/testsuite/Rules | 24 ++++++ tests/old/testsuite/bytestream/Makefile.am | 11 +-- tests/old/testsuite/bytestream/gstbstest.c | 45 +++++------ tests/old/testsuite/bytestream/mem.c | 23 ------ tests/old/testsuite/bytestream/mem.h | 1 - tests/old/testsuite/bytestream/test1.c | 4 +- tests/old/testsuite/caps/Makefile.am | 33 ++++---- tests/old/testsuite/cleanup/Makefile.am | 18 +---- tests/old/testsuite/clock/Makefile.am | 12 +-- tests/old/testsuite/debug/Makefile.am | 11 +-- tests/old/testsuite/dynparams/Makefile.am | 10 +-- tests/old/testsuite/dynparams/dparamstest.c | 12 ++- tests/old/testsuite/elements/Makefile.am | 19 +---- tests/old/testsuite/indexers/Makefile.am | 11 +-- tests/old/testsuite/parse/Makefile.am | 10 +-- tests/old/testsuite/parse/parse1.c | 3 + tests/old/testsuite/plugin/Makefile.am | 16 +--- tests/old/testsuite/refcounting/Makefile.am | 20 +---- tests/old/testsuite/refcounting/bin.c | 76 +++++++++++++------ tests/old/testsuite/refcounting/element.c | 47 +++++++----- tests/old/testsuite/refcounting/element_pad.c | 2 +- tests/old/testsuite/refcounting/pad.c | 22 +++++- tests/old/testsuite/refcounting/sched.c | 2 +- tests/old/testsuite/states/Makefile.am | 9 +-- tests/old/testsuite/threads/Makefile.am | 15 +--- tests/old/testsuite/threads/thread.c | 4 +- tests/old/testsuite/threads/threadd.c | 3 + tests/old/testsuite/threads/threade.c | 3 + testsuite/Makefile.am | 40 ++++------ testsuite/Rules | 24 ++++++ testsuite/bytestream/Makefile.am | 11 +-- testsuite/bytestream/gstbstest.c | 45 +++++------ testsuite/bytestream/mem.c | 23 ------ testsuite/bytestream/mem.h | 1 - testsuite/bytestream/test1.c | 4 +- testsuite/caps/Makefile.am | 33 ++++---- testsuite/cleanup/Makefile.am | 18 +---- testsuite/clock/Makefile.am | 12 +-- testsuite/debug/Makefile.am | 11 +-- testsuite/dynparams/Makefile.am | 10 +-- testsuite/dynparams/dparamstest.c | 12 ++- testsuite/elements/Makefile.am | 19 +---- testsuite/indexers/Makefile.am | 11 +-- testsuite/parse/Makefile.am | 10 +-- testsuite/parse/parse1.c | 3 + testsuite/plugin/Makefile.am | 16 +--- testsuite/refcounting/Makefile.am | 20 +---- testsuite/refcounting/bin.c | 76 +++++++++++++------ testsuite/refcounting/element.c | 47 +++++++----- testsuite/refcounting/element_pad.c | 2 +- testsuite/refcounting/pad.c | 22 +++++- testsuite/refcounting/sched.c | 2 +- testsuite/states/Makefile.am | 9 +-- testsuite/threads/Makefile.am | 15 +--- testsuite/threads/thread.c | 4 +- testsuite/threads/threadd.c | 3 + testsuite/threads/threade.c | 3 + 58 files changed, 478 insertions(+), 534 deletions(-) create mode 100644 tests/old/testsuite/Rules delete mode 100644 tests/old/testsuite/bytestream/mem.c delete mode 100644 tests/old/testsuite/bytestream/mem.h create mode 100644 testsuite/Rules delete mode 100644 testsuite/bytestream/mem.c delete mode 100644 testsuite/bytestream/mem.h diff --git a/tests/old/testsuite/Makefile.am b/tests/old/testsuite/Makefile.am index 3dbaa23dee..0e181893d5 100644 --- a/tests/old/testsuite/Makefile.am +++ b/tests/old/testsuite/Makefile.am @@ -1,3 +1,6 @@ +include Rules + + if GST_DISABLE_PARSE GST_PARSE_DIRS = else @@ -10,35 +13,18 @@ else GST_DEBUG_DIRS = debug endif -# FIXME : threads bytestream -SUBDIRS = caps plugin elements clock refcounting threads indexers debug $(GST_PARSE_DIRS) $(GST_DEBUG_DIRS) ## cleanup dynparams - -TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml - -if BUILD_FAILING_TESTS -testprogs = test_gst_init -inspectcheck = gst-inspect-check -else -testprogs = -inspectcheck = -endif - -# since these TESTS are only run after recursing into subdirs, -# gst-register should be run before that, in the first subdir that uses it -# TESTS = $(top_builddir)/tools/gst-register $(testprogs) $(inspectcheck) -TESTS = $(testprogs) $(inspectcheck) - -check_PROGRAMS = $(testprogs) - -# we have nothing but apps here, we can do this safely -LIBS = $(GST_LIBS) -AM_CFLAGS = $(GST_CFLAGS) - -# we makes them, we gots to clean them -CLEANFILES = test-registry.xml +SUBDIRS = bytestream cleanup dynparams \ + caps plugin elements clock refcounting threads \ + indexers debug $(GST_PARSE_DIRS) $(GST_DEBUG_DIRS) DIST_SUBDIRS = bytestream caps cleanup clock dynparams elements indexers \ plugin refcounting threads parse debug +tests_pass = test_gst_init +tests_fail = + +# we makes them, we gots to clean them +CLEANFILES += test-registry.xml + EXTRA_DIST = gst-inspect-check + diff --git a/tests/old/testsuite/Rules b/tests/old/testsuite/Rules new file mode 100644 index 0000000000..dbde511054 --- /dev/null +++ b/tests/old/testsuite/Rules @@ -0,0 +1,24 @@ + +TESTS_ENVIRONMENT=\ + G_DEBUG=fatal_warnings \ + GST_PLUGIN_PATH=$(top_builddir) \ + GST_REGISTRY=$(top_builddir)/testsuite/test-registry.xml + + +plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ + +check_PROGRAMS = $(tests_pass) $(tests_fail) + +TESTS = $(top_builddir)/tools/gst-register $(tests_pass) $(tests_fail) +XFAIL_TESTS = $(tests_fail) + +AM_CFLAGS = $(GST_CFLAGS) +LIBS = $(GST_LIBS) + +# override to _not_ install the test plugins +install-pluginLTLIBRARIES: + +# This rule is here so make distcheck works on machines where core +# dumps have PIDs appended +CLEANFILES = core.* + diff --git a/tests/old/testsuite/bytestream/Makefile.am b/tests/old/testsuite/bytestream/Makefile.am index 696ad98228..317e3d46b0 100644 --- a/tests/old/testsuite/bytestream/Makefile.am +++ b/tests/old/testsuite/bytestream/Makefile.am @@ -1,11 +1,8 @@ -## filterdir = $(libdir)/gst +include ../Rules -testprogs = test1 +tests_pass = +tests_fail = test1 -check_PROGRAMS = $(testprogs) +test1_SOURCES = test1.c gstbstest.c -test1_SOURCES = test1.c gstbstest.c mem.c -test1_CFLAGS = $(GST_CFLAGS) -test1_LDFLAGS = $(GST_LIBS) -L$(top_builddir)/libs/gst/bytestream/ -lgstbytestream -noinst_HEADERS = mem.h diff --git a/tests/old/testsuite/bytestream/gstbstest.c b/tests/old/testsuite/bytestream/gstbstest.c index 48057031d4..9a718c461e 100644 --- a/tests/old/testsuite/bytestream/gstbstest.c +++ b/tests/old/testsuite/bytestream/gstbstest.c @@ -20,11 +20,14 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include #include -#include +#include #define GST_TYPE_BSTEST (gst_bstest_get_type()) #define GST_BSTEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BSTEST,GstBsTest)) @@ -64,9 +67,11 @@ GType gst_bstest_get_type (void); GstElementDetails gst_bstest_details = { "ByteStreamTest", "Filter", + "LGPL", "Test for the GstByteStream code", VERSION, - "Erik Walthinsen ," "Wim Taymans ", + "Erik Walthinsen ," + "Wim Taymans ", "(C) 2001", }; @@ -160,22 +165,15 @@ gst_bstest_class_init (GstBsTestClass * klass) } -static GstPadLinkReturn -gst_bstest_negotiate_src (GstPad * pad, GstCaps ** caps, gpointer * data) +static GstCaps * +gst_bstest_getcaps (GstPad *pad, GstCaps *caps) { GstBsTest *bstest = GST_BSTEST (gst_pad_get_parent (pad)); + GstPad *otherpad; - /* thomas: I was trying to fix this old test, one of these two pads - * needs to be dropped according to the new api, which one ? */ - return gst_pad_proxy_link (pad, bstest->sinkpad, caps); -} + otherpad = (pad == bstest->srcpad) ? bstest->sinkpad : bstest->srcpad; -static GstPadLinkReturn -gst_bstest_negotiate_sink (GstPad * pad, GstCaps ** caps, gpointer * data) -{ - GstBsTest *bstest = GST_BSTEST (gst_pad_get_parent (pad)); - - return gst_pad_negotiate_proxy (pad, bstest->srcpad, caps); + return gst_pad_get_allowed_caps (otherpad); } static void @@ -183,11 +181,11 @@ gst_bstest_init (GstBsTest * bstest) { bstest->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); gst_element_add_pad (GST_ELEMENT (bstest), bstest->sinkpad); - gst_pad_set_negotiate_function (bstest->sinkpad, gst_bstest_negotiate_sink); + gst_pad_set_getcaps_function (bstest->sinkpad, gst_bstest_getcaps); bstest->srcpad = gst_pad_new ("src", GST_PAD_SRC); gst_element_add_pad (GST_ELEMENT (bstest), bstest->srcpad); - gst_pad_set_negotiate_function (bstest->srcpad, gst_bstest_negotiate_src); + gst_pad_set_getcaps_function (bstest->srcpad, gst_bstest_getcaps); gst_element_set_loop_function (GST_ELEMENT (bstest), gst_bstest_loop); @@ -237,6 +235,7 @@ gst_bstest_loop (GstElement * element) do { guint size = 0; guint i = 0; + guint8 *ptr; while (i < bstest->num_patterns) { buf = NULL; @@ -244,7 +243,7 @@ gst_bstest_loop (GstElement * element) if (bstest->patterns[i][0] == 'r') { size = gst_bstest_get_size (bstest, &bstest->patterns[i][1], size); if (!bstest->silent) g_print ("bstest: ***** read %d bytes\n", size); - buf = gst_bytestream_read (bstest->bs, size); + gst_bytestream_read (bstest->bs, &buf, size); } else if (bstest->patterns[i][0] == 'f') { size = gst_bstest_get_size (bstest, &bstest->patterns[i][1], size); @@ -254,18 +253,18 @@ gst_bstest_loop (GstElement * element) else if (!strncmp (bstest->patterns[i], "pb", 2)) { size = gst_bstest_get_size (bstest, &bstest->patterns[i][2], size); if (!bstest->silent) g_print ("bstest: ***** peek bytes %d bytes\n", size); - gst_bytestream_peek_bytes (bstest->bs, size); + gst_bytestream_peek_bytes (bstest->bs, &ptr, size); } else if (bstest->patterns[i][0] == 'p') { size = gst_bstest_get_size (bstest, &bstest->patterns[i][1], size); if (!bstest->silent) g_print ("bstest: ***** peek %d bytes\n", size); - buf = gst_bytestream_peek (bstest->bs, size); + gst_bytestream_peek (bstest->bs, &buf, size); gst_buffer_unref (buf); buf = NULL; } if (buf) - gst_pad_push (bstest->srcpad, buf); + gst_pad_push (bstest->srcpad, GST_DATA (buf)); i++; } @@ -385,12 +384,6 @@ plugin_init (GModule * module, GstPlugin * plugin) { GstElementFactory *factory; - /* we need gstbytestream */ - if (!gst_library_load ("gstbytestream")) { - g_print ("can't load bytestream\n"); - return FALSE; - } - /* We need to create an ElementFactory for each element we provide. * This consists of the name of the element, the GType identifier, * and a pointer to the details structure at the top of the file. diff --git a/tests/old/testsuite/bytestream/mem.c b/tests/old/testsuite/bytestream/mem.c deleted file mode 100644 index d1c36cb5aa..0000000000 --- a/tests/old/testsuite/bytestream/mem.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include -#include -#include - -int vmsize() { - int pid,fd,size,i,mem; - char filename[17], buf[256], *ptr, *end; - - pid = getpid(); - snprintf(filename,17,"/proc/%d/stat",pid); - fd = open(filename,O_RDONLY); - size = read(fd,buf,240); - ptr = buf; - for (i=0;i<22;i++) - ptr = (char *)strchr(ptr,' ') + 1; - end = (char *)strchr(ptr,' '); - *end = 0; - sscanf(ptr,"%d",&mem); - close(fd); - return mem; -} diff --git a/tests/old/testsuite/bytestream/mem.h b/tests/old/testsuite/bytestream/mem.h deleted file mode 100644 index 28999db2c3..0000000000 --- a/tests/old/testsuite/bytestream/mem.h +++ /dev/null @@ -1 +0,0 @@ -int vmsize(); diff --git a/tests/old/testsuite/bytestream/test1.c b/tests/old/testsuite/bytestream/test1.c index 0000682a72..4545f9d7a9 100644 --- a/tests/old/testsuite/bytestream/test1.c +++ b/tests/old/testsuite/bytestream/test1.c @@ -2,7 +2,6 @@ #include #include -#include "mem.h" #define VM_THRES 1000 #define MAX_CONFIG_LINE 255 @@ -112,7 +111,7 @@ run_test (GstBin *pipeline, gint iters) gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); while (iters) { - gint newvm = vmsize(); + gint newvm = gst_alloc_trace_live_all (); gint percent; percent = (gint)((maxiters-iters+1)*100.0/maxiters); @@ -146,6 +145,7 @@ main (int argc, char *argv[]) GSList *walk; gint arg_walk; + gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE); gst_init (&argc, &argv); arg_walk = 1; diff --git a/tests/old/testsuite/caps/Makefile.am b/tests/old/testsuite/caps/Makefile.am index b93500388b..02f82a3e4e 100644 --- a/tests/old/testsuite/caps/Makefile.am +++ b/tests/old/testsuite/caps/Makefile.am @@ -1,27 +1,30 @@ -TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml +include ../Rules -testprogs = intersection compatibility normalisation union string-conversions fixed intersect2 -# we run gst-register here, which is a HACK to generate the test registry -# before we actually run the real tests -# a better fix is welcome :) -TESTS = $(top_builddir)/tools/gst-register $(testprogs) +tests_pass = \ + intersection \ + compatibility \ + normalisation \ + union \ + string-conversions \ + fixed \ + intersect2 + +tests_fail = -check_PROGRAMS = $(testprogs) intersection_LDADD = $(GST_LIBS) -intersection_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +intersection_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) compatibility_LDADD = $(GST_LIBS) -compatibility_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +compatibility_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) normalisation_LDADD = $(GST_LIBS) -normalisation_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +normalisation_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) union_LDADD = $(GST_LIBS) -union_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +union_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) string_conversions_LDADD = $(GST_LIBS) -string_conversions_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +string_conversions_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) fixed_LDADD = $(GST_LIBS) -fixed_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +fixed_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) intersect2_LDADD = $(GST_LIBS) -intersect2_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +intersect2_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) diff --git a/tests/old/testsuite/cleanup/Makefile.am b/tests/old/testsuite/cleanup/Makefile.am index f59c691567..c3eafa7ed6 100644 --- a/tests/old/testsuite/cleanup/Makefile.am +++ b/tests/old/testsuite/cleanup/Makefile.am @@ -1,20 +1,10 @@ -TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml +include ../Rules -if BUILD_FAILING_TESTS -FAILING = cleanup3 cleanup4 -else -FAILING = -endif - -testprogs = cleanup1 cleanup2 $(FAILING) cleanup5 - -TESTS = $(testprogs) - -check_PROGRAMS = $(testprogs) +tests_pass = cleanup1 cleanup2 cleanup4 cleanup5 +tests_fail = cleanup3 # we have nothing but apps here, we can do this safely -cleanup1_LDADD = $(GST_LIBS) #-ldmallocth +cleanup1_LDADD = $(GST_LIBS) cleanup1_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) $(GLIB_CFLAGS) cleanup2_LDADD = $(GST_LIBS) cleanup2_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) $(GLIB_CFLAGS) diff --git a/tests/old/testsuite/clock/Makefile.am b/tests/old/testsuite/clock/Makefile.am index 21c3ce7387..25b830ba6c 100644 --- a/tests/old/testsuite/clock/Makefile.am +++ b/tests/old/testsuite/clock/Makefile.am @@ -1,12 +1,6 @@ -TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml +include ../Rules -testprogs = clock1 clock2 +tests_pass = clock1 clock2 +tests_fail = -TESTS = $(testprogs) - -check_PROGRAMS = $(testprogs) - -LDADD = $(GST_LIBS) -AM_CFLAGS = $(GST_CFLAGS) diff --git a/tests/old/testsuite/debug/Makefile.am b/tests/old/testsuite/debug/Makefile.am index 67513d7575..dfcfd02716 100644 --- a/tests/old/testsuite/debug/Makefile.am +++ b/tests/old/testsuite/debug/Makefile.am @@ -1,10 +1,5 @@ -#testprogs = global output commandline category -testprogs = commandline category +include ../Rules -TESTS = $(testprogs) +tests_pass = commandline category global output +tests_fail = -check_PROGRAMS = $(testprogs) - -# we have nothing but apps here, we can do this safely -LIBS = $(GST_LIBS) -AM_CFLAGS = $(GST_CFLAGS) diff --git a/tests/old/testsuite/dynparams/Makefile.am b/tests/old/testsuite/dynparams/Makefile.am index 69cbfe71e1..119eeed260 100644 --- a/tests/old/testsuite/dynparams/Makefile.am +++ b/tests/old/testsuite/dynparams/Makefile.am @@ -1,10 +1,10 @@ -testprogs = dparamstest +include ../Rules -TESTS = $(testprogs) - -check_PROGRAMS = $(testprogs) +tests_pass = +tests_fail = dparamstest dparamstest_CFLAGS = $(GST_CFLAGS) -dparamstest_LDFLAGS = $(GST_LIBS) -L$(top_builddir)/libs/gst/control/ -lgstcontrol +dparamstest_LDFLAGS = $(GST_LIBS) +dparamstest_LDADD = $(top_builddir)/libs/gst/control/libgstcontrol-@GST_MAJORMINOR@.la dparamstest_SOURCES = dparamstest.c diff --git a/tests/old/testsuite/dynparams/dparamstest.c b/tests/old/testsuite/dynparams/dparamstest.c index 0e576f19ff..6f1fbb2226 100644 --- a/tests/old/testsuite/dynparams/dparamstest.c +++ b/tests/old/testsuite/dynparams/dparamstest.c @@ -21,6 +21,9 @@ #include #include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include @@ -59,6 +62,7 @@ GType gst_dptest_get_type (void); GstElementDetails gst_dptest_details = { "DParamsTest", "Filter", + "LGPL", "Test for the GstDParam code", VERSION, "Steve Baker ", @@ -78,7 +82,7 @@ static void gst_dptest_set_property (GObject * object, guint prop_id, const GVal GParamSpec * pspec); static GstElementStateReturn gst_dptest_change_state (GstElement *element); -static void gst_dptest_chain (GstPad *pad, GstBuffer *buf); +static void gst_dptest_chain (GstPad *pad, GstData *buf); static GstElementClass *parent_class = NULL; @@ -178,10 +182,10 @@ gst_dptest_change_state (GstElement *element) } static void -gst_dptest_chain (GstPad *pad, GstBuffer *buf) +gst_dptest_chain (GstPad *pad, GstData *data) { GstDpTest *dptest; - gint i=0, frame_countdown; + gint frame_countdown; dptest = GST_DPTEST(gst_pad_get_parent (pad)); g_assert(dptest); @@ -189,7 +193,7 @@ gst_dptest_chain (GstPad *pad, GstBuffer *buf) /* we're using a made up buffer size of 64 and a timestamp of zero */ frame_countdown = GST_DPMAN_PREPROCESS(dptest->dpman, 64, 0LL); - while(GST_DPMAN_PROCESS_COUNTDOWN(dptest->dpman, frame_countdown, i)); + while(GST_DPMAN_PROCESS(dptest->dpman, frame_countdown)); g_print("dp chain\n"); } diff --git a/tests/old/testsuite/elements/Makefile.am b/tests/old/testsuite/elements/Makefile.am index af78be0617..232f10e465 100644 --- a/tests/old/testsuite/elements/Makefile.am +++ b/tests/old/testsuite/elements/Makefile.am @@ -1,18 +1,7 @@ -TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml +include ../Rules -if BUILD_FAILING_TESTS -tests_failing = fake -else -tests_failing = -endif -tests_working = name tee property +tests_pass = name tee property fake +tests_fail = -TESTS = $(tests_working) - -check_PROGRAMS = $(tests_failing) $(tests_working) - -EXTRA_DIST = property.h -LDADD = $(GST_LIBS) -AM_CFLAGS = $(GST_CFLAGS) +noinst_HEADERS = property.h diff --git a/tests/old/testsuite/indexers/Makefile.am b/tests/old/testsuite/indexers/Makefile.am index e1c8d6e363..76730104e9 100644 --- a/tests/old/testsuite/indexers/Makefile.am +++ b/tests/old/testsuite/indexers/Makefile.am @@ -1,11 +1,6 @@ -TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml +include ../Rules -testprogs = cache1 indexdump +tests_pass = cache1 indexdump +tests_fail = -TESTS = $(testprogs) -check_PROGRAMS = $(testprogs) - -LDADD = $(GST_LIBS) -AM_CFLAGS = $(GST_CFLAGS) diff --git a/tests/old/testsuite/parse/Makefile.am b/tests/old/testsuite/parse/Makefile.am index 0c431f77ba..3edad6d06c 100644 --- a/tests/old/testsuite/parse/Makefile.am +++ b/tests/old/testsuite/parse/Makefile.am @@ -1,12 +1,8 @@ +include ../Rules -check_PROGRAMS = parse1 parse2 - -# parse1 is broken -TESTS = parse2 +tests_pass = parse2 +tests_fail = parse1 parse1_SOURCES = parse1.c parse2_SOURCES = parse2.c -# we have nothing but apps here, we can do this safely -LIBS = $(GST_LIBS) -AM_CFLAGS = $(GST_CFLAGS) diff --git a/tests/old/testsuite/parse/parse1.c b/tests/old/testsuite/parse/parse1.c index 4598e9735e..debf5ff0de 100644 --- a/tests/old/testsuite/parse/parse1.c +++ b/tests/old/testsuite/parse/parse1.c @@ -21,6 +21,7 @@ #include #include +#include /* variables used by the TEST_* macros */ static gint test = 0; @@ -58,6 +59,7 @@ static gchar *s; g_print ("TEST %2d line %3d COMPLETE\n", test, __LINE__); \ }G_STMT_END #define TEST_RUN G_STMT_START{ \ + alarm(10); \ g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \ if (gst_element_set_state (cur, GST_STATE_PLAYING) == GST_STATE_FAILURE) { \ g_print ("TEST %2d line %3d FAILED : pipeline could not be set to state PLAYING\n", test, __LINE__); \ @@ -70,6 +72,7 @@ static gchar *s; return -test; \ } \ g_print ("TEST %2d line %3d STOPPED : %u iterations\n", test, __LINE__, iterations); \ + alarm(0); \ }G_STMT_END #define PIPELINE1 "fakesrc" #define PIPELINE2 "fakesrc name=donald num-buffers= 27 silent =TruE sizetype = 3 eos = yesyo data= Subbuffer\\ data" diff --git a/tests/old/testsuite/plugin/Makefile.am b/tests/old/testsuite/plugin/Makefile.am index 4ef486d3aa..a8d1887bbc 100644 --- a/tests/old/testsuite/plugin/Makefile.am +++ b/tests/old/testsuite/plugin/Makefile.am @@ -1,13 +1,10 @@ -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(top_builddir) GST_REGISTRY=$(top_builddir)/testsuite/test-registry.xml +include ../Rules -plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ plugin_LTLIBRARIES = libtestplugin.la libtestplugin2.la -# FIXME : tests need fixing -testprogs = static dynamic linked loading registry static2 +tests_pass = static dynamic static2 linked loading registry +tests_fail = -AM_CFLAGS = $(GST_CFLAGS) -LIBS = $(GST_LIBS) libtestplugin_la_SOURCES = testplugin.c libtestplugin_la_CFLAGS = $(GST_CFLAGS) @@ -20,10 +17,3 @@ linked_LIBS = libtestplugin.la libtestplugin2.la static_SOURCES = static.c testplugin_s.c testplugin2_s.c -check_PROGRAMS = $(testprogs) - -TESTS = $(top_builddir)/tools/gst-register $(testprogs) - -# override to _not_ install the test plugins -install-pluginLTLIBRARIES: - diff --git a/tests/old/testsuite/refcounting/Makefile.am b/tests/old/testsuite/refcounting/Makefile.am index b7fbe22361..41365ece2f 100644 --- a/tests/old/testsuite/refcounting/Makefile.am +++ b/tests/old/testsuite/refcounting/Makefile.am @@ -1,29 +1,15 @@ -TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml +include ../Rules -if BUILD_FAILING_TESTS -tests_failing = element bin element_pad pad -else -tests_failing = -endif -tests_working = mainloop sched +tests_pass = bin element mainloop pad +tests_fail = element_pad sched element_SOURCES = element.c mem.c pad_SOURCES = pad.c mem.c - element_pad_SOURCES = element_pad.c mem.c bin_SOURCES = bin.c mem.c -TESTS = $(tests_working) - -check_PROGRAMS = $(TESTS) -noinst_PROGRAMS = $(tests_failing) - EXTRA_DIST = thread.c object.c noinst_HEADERS = mem.h -# we have nothing but apps here, we can do this safely -LIBS = $(GST_LIBS) -AM_CFLAGS = $(GLIB_CFLAGS) $(XML_CFLAGS) $(GST_CFLAGS) diff --git a/tests/old/testsuite/refcounting/bin.c b/tests/old/testsuite/refcounting/bin.c index a2811fac55..81c867180b 100644 --- a/tests/old/testsuite/refcounting/bin.c +++ b/tests/old/testsuite/refcounting/bin.c @@ -1,8 +1,7 @@ #include -#define ITERS 100000 +#define ITERS 100 #include -#include "mem.h" static GstElement* create_bin (void) @@ -73,12 +72,16 @@ add_remove_test2 (void) g_assert (!GST_OBJECT_DESTROYED (element)); gst_object_unref (GST_OBJECT (element)); +#if 0 g_assert (GST_OBJECT_DESTROYED (element)); gst_object_unref (GST_OBJECT (element)); +#endif gst_object_unref (GST_OBJECT (bin)); } +#if 0 +/* This code is bogus */ static void add_remove_test3 (void) { @@ -97,7 +100,10 @@ add_remove_test3 (void) gst_object_unref (GST_OBJECT (bin)); } +#endif +#if 0 +/* This code is bogus */ static void add_remove_test4 (void) { @@ -123,14 +129,17 @@ add_remove_test4 (void) gst_object_unref (GST_OBJECT (bin)); } +#endif int main (int argc, gchar *argv[]) { GstElement *bin; - long usage1; + int usage1; gint i, iters; + gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE); + gst_init (&argc, &argv); if (argc == 2) @@ -138,18 +147,21 @@ main (int argc, gchar *argv[]) else iters = ITERS; + g_print ("starting test\n"); - usage1 = vmsize(); + + usage1 = gst_alloc_trace_live_all (); + //gst_alloc_trace_print_all (); bin = gst_bin_new ("somebin"); gst_object_unref (GST_OBJECT (bin)); - g_print ("create/unref new bin %ld\n", vmsize()-usage1); + g_print ("create/unref new bin %d\n", gst_alloc_trace_live_all ()-usage1); for (i=0; i -#define ITERS 10000 +#define ITERS 100 #include -#include "mem.h" int main (int argc, gchar *argv[]) { GstElement *element; - long usage1; + int usage1; gint i, iters; gst_init (&argc, &argv); @@ -19,17 +18,19 @@ main (int argc, gchar *argv[]) iters = ITERS; g_print ("starting test\n"); - usage1 = vmsize(); + + usage1 = gst_alloc_trace_live_all (); + //gst_alloc_trace_print_all (); element = gst_element_factory_make ("fakesrc", NULL); gst_object_unref (GST_OBJECT (element)); - g_print ("create/unref new element %ld\n", vmsize()-usage1); + g_print ("create/unref new element %d\n", gst_alloc_trace_live_all ()-usage1); for (i=0; i -#define ITERS 100000 +#define ITERS 100 #include #include "mem.h" diff --git a/tests/old/testsuite/refcounting/pad.c b/tests/old/testsuite/refcounting/pad.c index 1aa259bb2f..a353c5dd74 100644 --- a/tests/old/testsuite/refcounting/pad.c +++ b/tests/old/testsuite/refcounting/pad.c @@ -1,6 +1,6 @@ #include -#define ITERS 100000 +#define ITERS 100 #include #include "mem.h" @@ -12,13 +12,19 @@ main (int argc, gchar *argv[]) long usage1; gint i, iters; + gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE); + gst_init (&argc, &argv); + g_mem_profile (); + if (argc == 2) iters = atoi (argv[1]); else iters = ITERS; + //gst_alloc_trace_print_all (); + g_print ("starting pad test\n"); usage1 = vmsize(); @@ -48,19 +54,23 @@ main (int argc, gchar *argv[]) } g_print ("create/ref/sink/unref %d pads %ld\n", iters, vmsize()-usage1); +#if 0 pad = gst_pad_new ("padname", GST_PAD_SINK); g_assert (!GST_OBJECT_DESTROYED (pad)); gst_object_unref (GST_OBJECT (pad)); g_assert (GST_OBJECT_DESTROYED (pad)); gst_object_unref (GST_OBJECT (pad)); g_print ("create/destroy/unref pad %ld\n", vmsize()-usage1); +#endif +#if 0 for (i=0; i +#include /* threadc.c * this tests if we can make a GstThread, with enough cothreads to stress it @@ -59,6 +60,8 @@ main (gint argc, gchar *argv[]) gulong id; GstElement *thread; + alarm(10); + gst_init (&argc, &argv); for (i = 0; i < runs; ++i) diff --git a/tests/old/testsuite/threads/threade.c b/tests/old/testsuite/threads/threade.c index 79e6213213..98b15dd3c0 100644 --- a/tests/old/testsuite/threads/threade.c +++ b/tests/old/testsuite/threads/threade.c @@ -1,4 +1,5 @@ #include +#include /* threadc.c * this tests if we can make a GstBin and iterate it inside a GThread @@ -54,6 +55,8 @@ main (gint argc, gchar *argv[]) int i; GstElement *pipeline; + alarm(10); + g_thread_init (NULL); gst_init (&argc, &argv); diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index 3dbaa23dee..0e181893d5 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -1,3 +1,6 @@ +include Rules + + if GST_DISABLE_PARSE GST_PARSE_DIRS = else @@ -10,35 +13,18 @@ else GST_DEBUG_DIRS = debug endif -# FIXME : threads bytestream -SUBDIRS = caps plugin elements clock refcounting threads indexers debug $(GST_PARSE_DIRS) $(GST_DEBUG_DIRS) ## cleanup dynparams - -TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml - -if BUILD_FAILING_TESTS -testprogs = test_gst_init -inspectcheck = gst-inspect-check -else -testprogs = -inspectcheck = -endif - -# since these TESTS are only run after recursing into subdirs, -# gst-register should be run before that, in the first subdir that uses it -# TESTS = $(top_builddir)/tools/gst-register $(testprogs) $(inspectcheck) -TESTS = $(testprogs) $(inspectcheck) - -check_PROGRAMS = $(testprogs) - -# we have nothing but apps here, we can do this safely -LIBS = $(GST_LIBS) -AM_CFLAGS = $(GST_CFLAGS) - -# we makes them, we gots to clean them -CLEANFILES = test-registry.xml +SUBDIRS = bytestream cleanup dynparams \ + caps plugin elements clock refcounting threads \ + indexers debug $(GST_PARSE_DIRS) $(GST_DEBUG_DIRS) DIST_SUBDIRS = bytestream caps cleanup clock dynparams elements indexers \ plugin refcounting threads parse debug +tests_pass = test_gst_init +tests_fail = + +# we makes them, we gots to clean them +CLEANFILES += test-registry.xml + EXTRA_DIST = gst-inspect-check + diff --git a/testsuite/Rules b/testsuite/Rules new file mode 100644 index 0000000000..dbde511054 --- /dev/null +++ b/testsuite/Rules @@ -0,0 +1,24 @@ + +TESTS_ENVIRONMENT=\ + G_DEBUG=fatal_warnings \ + GST_PLUGIN_PATH=$(top_builddir) \ + GST_REGISTRY=$(top_builddir)/testsuite/test-registry.xml + + +plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ + +check_PROGRAMS = $(tests_pass) $(tests_fail) + +TESTS = $(top_builddir)/tools/gst-register $(tests_pass) $(tests_fail) +XFAIL_TESTS = $(tests_fail) + +AM_CFLAGS = $(GST_CFLAGS) +LIBS = $(GST_LIBS) + +# override to _not_ install the test plugins +install-pluginLTLIBRARIES: + +# This rule is here so make distcheck works on machines where core +# dumps have PIDs appended +CLEANFILES = core.* + diff --git a/testsuite/bytestream/Makefile.am b/testsuite/bytestream/Makefile.am index 696ad98228..317e3d46b0 100644 --- a/testsuite/bytestream/Makefile.am +++ b/testsuite/bytestream/Makefile.am @@ -1,11 +1,8 @@ -## filterdir = $(libdir)/gst +include ../Rules -testprogs = test1 +tests_pass = +tests_fail = test1 -check_PROGRAMS = $(testprogs) +test1_SOURCES = test1.c gstbstest.c -test1_SOURCES = test1.c gstbstest.c mem.c -test1_CFLAGS = $(GST_CFLAGS) -test1_LDFLAGS = $(GST_LIBS) -L$(top_builddir)/libs/gst/bytestream/ -lgstbytestream -noinst_HEADERS = mem.h diff --git a/testsuite/bytestream/gstbstest.c b/testsuite/bytestream/gstbstest.c index 48057031d4..9a718c461e 100644 --- a/testsuite/bytestream/gstbstest.c +++ b/testsuite/bytestream/gstbstest.c @@ -20,11 +20,14 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include #include -#include +#include #define GST_TYPE_BSTEST (gst_bstest_get_type()) #define GST_BSTEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BSTEST,GstBsTest)) @@ -64,9 +67,11 @@ GType gst_bstest_get_type (void); GstElementDetails gst_bstest_details = { "ByteStreamTest", "Filter", + "LGPL", "Test for the GstByteStream code", VERSION, - "Erik Walthinsen ," "Wim Taymans ", + "Erik Walthinsen ," + "Wim Taymans ", "(C) 2001", }; @@ -160,22 +165,15 @@ gst_bstest_class_init (GstBsTestClass * klass) } -static GstPadLinkReturn -gst_bstest_negotiate_src (GstPad * pad, GstCaps ** caps, gpointer * data) +static GstCaps * +gst_bstest_getcaps (GstPad *pad, GstCaps *caps) { GstBsTest *bstest = GST_BSTEST (gst_pad_get_parent (pad)); + GstPad *otherpad; - /* thomas: I was trying to fix this old test, one of these two pads - * needs to be dropped according to the new api, which one ? */ - return gst_pad_proxy_link (pad, bstest->sinkpad, caps); -} + otherpad = (pad == bstest->srcpad) ? bstest->sinkpad : bstest->srcpad; -static GstPadLinkReturn -gst_bstest_negotiate_sink (GstPad * pad, GstCaps ** caps, gpointer * data) -{ - GstBsTest *bstest = GST_BSTEST (gst_pad_get_parent (pad)); - - return gst_pad_negotiate_proxy (pad, bstest->srcpad, caps); + return gst_pad_get_allowed_caps (otherpad); } static void @@ -183,11 +181,11 @@ gst_bstest_init (GstBsTest * bstest) { bstest->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); gst_element_add_pad (GST_ELEMENT (bstest), bstest->sinkpad); - gst_pad_set_negotiate_function (bstest->sinkpad, gst_bstest_negotiate_sink); + gst_pad_set_getcaps_function (bstest->sinkpad, gst_bstest_getcaps); bstest->srcpad = gst_pad_new ("src", GST_PAD_SRC); gst_element_add_pad (GST_ELEMENT (bstest), bstest->srcpad); - gst_pad_set_negotiate_function (bstest->srcpad, gst_bstest_negotiate_src); + gst_pad_set_getcaps_function (bstest->srcpad, gst_bstest_getcaps); gst_element_set_loop_function (GST_ELEMENT (bstest), gst_bstest_loop); @@ -237,6 +235,7 @@ gst_bstest_loop (GstElement * element) do { guint size = 0; guint i = 0; + guint8 *ptr; while (i < bstest->num_patterns) { buf = NULL; @@ -244,7 +243,7 @@ gst_bstest_loop (GstElement * element) if (bstest->patterns[i][0] == 'r') { size = gst_bstest_get_size (bstest, &bstest->patterns[i][1], size); if (!bstest->silent) g_print ("bstest: ***** read %d bytes\n", size); - buf = gst_bytestream_read (bstest->bs, size); + gst_bytestream_read (bstest->bs, &buf, size); } else if (bstest->patterns[i][0] == 'f') { size = gst_bstest_get_size (bstest, &bstest->patterns[i][1], size); @@ -254,18 +253,18 @@ gst_bstest_loop (GstElement * element) else if (!strncmp (bstest->patterns[i], "pb", 2)) { size = gst_bstest_get_size (bstest, &bstest->patterns[i][2], size); if (!bstest->silent) g_print ("bstest: ***** peek bytes %d bytes\n", size); - gst_bytestream_peek_bytes (bstest->bs, size); + gst_bytestream_peek_bytes (bstest->bs, &ptr, size); } else if (bstest->patterns[i][0] == 'p') { size = gst_bstest_get_size (bstest, &bstest->patterns[i][1], size); if (!bstest->silent) g_print ("bstest: ***** peek %d bytes\n", size); - buf = gst_bytestream_peek (bstest->bs, size); + gst_bytestream_peek (bstest->bs, &buf, size); gst_buffer_unref (buf); buf = NULL; } if (buf) - gst_pad_push (bstest->srcpad, buf); + gst_pad_push (bstest->srcpad, GST_DATA (buf)); i++; } @@ -385,12 +384,6 @@ plugin_init (GModule * module, GstPlugin * plugin) { GstElementFactory *factory; - /* we need gstbytestream */ - if (!gst_library_load ("gstbytestream")) { - g_print ("can't load bytestream\n"); - return FALSE; - } - /* We need to create an ElementFactory for each element we provide. * This consists of the name of the element, the GType identifier, * and a pointer to the details structure at the top of the file. diff --git a/testsuite/bytestream/mem.c b/testsuite/bytestream/mem.c deleted file mode 100644 index d1c36cb5aa..0000000000 --- a/testsuite/bytestream/mem.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include -#include -#include - -int vmsize() { - int pid,fd,size,i,mem; - char filename[17], buf[256], *ptr, *end; - - pid = getpid(); - snprintf(filename,17,"/proc/%d/stat",pid); - fd = open(filename,O_RDONLY); - size = read(fd,buf,240); - ptr = buf; - for (i=0;i<22;i++) - ptr = (char *)strchr(ptr,' ') + 1; - end = (char *)strchr(ptr,' '); - *end = 0; - sscanf(ptr,"%d",&mem); - close(fd); - return mem; -} diff --git a/testsuite/bytestream/mem.h b/testsuite/bytestream/mem.h deleted file mode 100644 index 28999db2c3..0000000000 --- a/testsuite/bytestream/mem.h +++ /dev/null @@ -1 +0,0 @@ -int vmsize(); diff --git a/testsuite/bytestream/test1.c b/testsuite/bytestream/test1.c index 0000682a72..4545f9d7a9 100644 --- a/testsuite/bytestream/test1.c +++ b/testsuite/bytestream/test1.c @@ -2,7 +2,6 @@ #include #include -#include "mem.h" #define VM_THRES 1000 #define MAX_CONFIG_LINE 255 @@ -112,7 +111,7 @@ run_test (GstBin *pipeline, gint iters) gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); while (iters) { - gint newvm = vmsize(); + gint newvm = gst_alloc_trace_live_all (); gint percent; percent = (gint)((maxiters-iters+1)*100.0/maxiters); @@ -146,6 +145,7 @@ main (int argc, char *argv[]) GSList *walk; gint arg_walk; + gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE); gst_init (&argc, &argv); arg_walk = 1; diff --git a/testsuite/caps/Makefile.am b/testsuite/caps/Makefile.am index b93500388b..02f82a3e4e 100644 --- a/testsuite/caps/Makefile.am +++ b/testsuite/caps/Makefile.am @@ -1,27 +1,30 @@ -TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml +include ../Rules -testprogs = intersection compatibility normalisation union string-conversions fixed intersect2 -# we run gst-register here, which is a HACK to generate the test registry -# before we actually run the real tests -# a better fix is welcome :) -TESTS = $(top_builddir)/tools/gst-register $(testprogs) +tests_pass = \ + intersection \ + compatibility \ + normalisation \ + union \ + string-conversions \ + fixed \ + intersect2 + +tests_fail = -check_PROGRAMS = $(testprogs) intersection_LDADD = $(GST_LIBS) -intersection_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +intersection_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) compatibility_LDADD = $(GST_LIBS) -compatibility_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +compatibility_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) normalisation_LDADD = $(GST_LIBS) -normalisation_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +normalisation_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) union_LDADD = $(GST_LIBS) -union_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +union_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) string_conversions_LDADD = $(GST_LIBS) -string_conversions_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +string_conversions_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) fixed_LDADD = $(GST_LIBS) -fixed_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +fixed_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) intersect2_LDADD = $(GST_LIBS) -intersect2_CFLAGS = $(GST_CFLAGS) $(GNOME_CFLAGS) $(XML_CFLAGS) +intersect2_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) diff --git a/testsuite/cleanup/Makefile.am b/testsuite/cleanup/Makefile.am index f59c691567..c3eafa7ed6 100644 --- a/testsuite/cleanup/Makefile.am +++ b/testsuite/cleanup/Makefile.am @@ -1,20 +1,10 @@ -TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml +include ../Rules -if BUILD_FAILING_TESTS -FAILING = cleanup3 cleanup4 -else -FAILING = -endif - -testprogs = cleanup1 cleanup2 $(FAILING) cleanup5 - -TESTS = $(testprogs) - -check_PROGRAMS = $(testprogs) +tests_pass = cleanup1 cleanup2 cleanup4 cleanup5 +tests_fail = cleanup3 # we have nothing but apps here, we can do this safely -cleanup1_LDADD = $(GST_LIBS) #-ldmallocth +cleanup1_LDADD = $(GST_LIBS) cleanup1_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) $(GLIB_CFLAGS) cleanup2_LDADD = $(GST_LIBS) cleanup2_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) $(GLIB_CFLAGS) diff --git a/testsuite/clock/Makefile.am b/testsuite/clock/Makefile.am index 21c3ce7387..25b830ba6c 100644 --- a/testsuite/clock/Makefile.am +++ b/testsuite/clock/Makefile.am @@ -1,12 +1,6 @@ -TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml +include ../Rules -testprogs = clock1 clock2 +tests_pass = clock1 clock2 +tests_fail = -TESTS = $(testprogs) - -check_PROGRAMS = $(testprogs) - -LDADD = $(GST_LIBS) -AM_CFLAGS = $(GST_CFLAGS) diff --git a/testsuite/debug/Makefile.am b/testsuite/debug/Makefile.am index 67513d7575..dfcfd02716 100644 --- a/testsuite/debug/Makefile.am +++ b/testsuite/debug/Makefile.am @@ -1,10 +1,5 @@ -#testprogs = global output commandline category -testprogs = commandline category +include ../Rules -TESTS = $(testprogs) +tests_pass = commandline category global output +tests_fail = -check_PROGRAMS = $(testprogs) - -# we have nothing but apps here, we can do this safely -LIBS = $(GST_LIBS) -AM_CFLAGS = $(GST_CFLAGS) diff --git a/testsuite/dynparams/Makefile.am b/testsuite/dynparams/Makefile.am index 69cbfe71e1..119eeed260 100644 --- a/testsuite/dynparams/Makefile.am +++ b/testsuite/dynparams/Makefile.am @@ -1,10 +1,10 @@ -testprogs = dparamstest +include ../Rules -TESTS = $(testprogs) - -check_PROGRAMS = $(testprogs) +tests_pass = +tests_fail = dparamstest dparamstest_CFLAGS = $(GST_CFLAGS) -dparamstest_LDFLAGS = $(GST_LIBS) -L$(top_builddir)/libs/gst/control/ -lgstcontrol +dparamstest_LDFLAGS = $(GST_LIBS) +dparamstest_LDADD = $(top_builddir)/libs/gst/control/libgstcontrol-@GST_MAJORMINOR@.la dparamstest_SOURCES = dparamstest.c diff --git a/testsuite/dynparams/dparamstest.c b/testsuite/dynparams/dparamstest.c index 0e576f19ff..6f1fbb2226 100644 --- a/testsuite/dynparams/dparamstest.c +++ b/testsuite/dynparams/dparamstest.c @@ -21,6 +21,9 @@ #include #include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include @@ -59,6 +62,7 @@ GType gst_dptest_get_type (void); GstElementDetails gst_dptest_details = { "DParamsTest", "Filter", + "LGPL", "Test for the GstDParam code", VERSION, "Steve Baker ", @@ -78,7 +82,7 @@ static void gst_dptest_set_property (GObject * object, guint prop_id, const GVal GParamSpec * pspec); static GstElementStateReturn gst_dptest_change_state (GstElement *element); -static void gst_dptest_chain (GstPad *pad, GstBuffer *buf); +static void gst_dptest_chain (GstPad *pad, GstData *buf); static GstElementClass *parent_class = NULL; @@ -178,10 +182,10 @@ gst_dptest_change_state (GstElement *element) } static void -gst_dptest_chain (GstPad *pad, GstBuffer *buf) +gst_dptest_chain (GstPad *pad, GstData *data) { GstDpTest *dptest; - gint i=0, frame_countdown; + gint frame_countdown; dptest = GST_DPTEST(gst_pad_get_parent (pad)); g_assert(dptest); @@ -189,7 +193,7 @@ gst_dptest_chain (GstPad *pad, GstBuffer *buf) /* we're using a made up buffer size of 64 and a timestamp of zero */ frame_countdown = GST_DPMAN_PREPROCESS(dptest->dpman, 64, 0LL); - while(GST_DPMAN_PROCESS_COUNTDOWN(dptest->dpman, frame_countdown, i)); + while(GST_DPMAN_PROCESS(dptest->dpman, frame_countdown)); g_print("dp chain\n"); } diff --git a/testsuite/elements/Makefile.am b/testsuite/elements/Makefile.am index af78be0617..232f10e465 100644 --- a/testsuite/elements/Makefile.am +++ b/testsuite/elements/Makefile.am @@ -1,18 +1,7 @@ -TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml +include ../Rules -if BUILD_FAILING_TESTS -tests_failing = fake -else -tests_failing = -endif -tests_working = name tee property +tests_pass = name tee property fake +tests_fail = -TESTS = $(tests_working) - -check_PROGRAMS = $(tests_failing) $(tests_working) - -EXTRA_DIST = property.h -LDADD = $(GST_LIBS) -AM_CFLAGS = $(GST_CFLAGS) +noinst_HEADERS = property.h diff --git a/testsuite/indexers/Makefile.am b/testsuite/indexers/Makefile.am index e1c8d6e363..76730104e9 100644 --- a/testsuite/indexers/Makefile.am +++ b/testsuite/indexers/Makefile.am @@ -1,11 +1,6 @@ -TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml +include ../Rules -testprogs = cache1 indexdump +tests_pass = cache1 indexdump +tests_fail = -TESTS = $(testprogs) -check_PROGRAMS = $(testprogs) - -LDADD = $(GST_LIBS) -AM_CFLAGS = $(GST_CFLAGS) diff --git a/testsuite/parse/Makefile.am b/testsuite/parse/Makefile.am index 0c431f77ba..3edad6d06c 100644 --- a/testsuite/parse/Makefile.am +++ b/testsuite/parse/Makefile.am @@ -1,12 +1,8 @@ +include ../Rules -check_PROGRAMS = parse1 parse2 - -# parse1 is broken -TESTS = parse2 +tests_pass = parse2 +tests_fail = parse1 parse1_SOURCES = parse1.c parse2_SOURCES = parse2.c -# we have nothing but apps here, we can do this safely -LIBS = $(GST_LIBS) -AM_CFLAGS = $(GST_CFLAGS) diff --git a/testsuite/parse/parse1.c b/testsuite/parse/parse1.c index 4598e9735e..debf5ff0de 100644 --- a/testsuite/parse/parse1.c +++ b/testsuite/parse/parse1.c @@ -21,6 +21,7 @@ #include #include +#include /* variables used by the TEST_* macros */ static gint test = 0; @@ -58,6 +59,7 @@ static gchar *s; g_print ("TEST %2d line %3d COMPLETE\n", test, __LINE__); \ }G_STMT_END #define TEST_RUN G_STMT_START{ \ + alarm(10); \ g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \ if (gst_element_set_state (cur, GST_STATE_PLAYING) == GST_STATE_FAILURE) { \ g_print ("TEST %2d line %3d FAILED : pipeline could not be set to state PLAYING\n", test, __LINE__); \ @@ -70,6 +72,7 @@ static gchar *s; return -test; \ } \ g_print ("TEST %2d line %3d STOPPED : %u iterations\n", test, __LINE__, iterations); \ + alarm(0); \ }G_STMT_END #define PIPELINE1 "fakesrc" #define PIPELINE2 "fakesrc name=donald num-buffers= 27 silent =TruE sizetype = 3 eos = yesyo data= Subbuffer\\ data" diff --git a/testsuite/plugin/Makefile.am b/testsuite/plugin/Makefile.am index 4ef486d3aa..a8d1887bbc 100644 --- a/testsuite/plugin/Makefile.am +++ b/testsuite/plugin/Makefile.am @@ -1,13 +1,10 @@ -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(top_builddir) GST_REGISTRY=$(top_builddir)/testsuite/test-registry.xml +include ../Rules -plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@ plugin_LTLIBRARIES = libtestplugin.la libtestplugin2.la -# FIXME : tests need fixing -testprogs = static dynamic linked loading registry static2 +tests_pass = static dynamic static2 linked loading registry +tests_fail = -AM_CFLAGS = $(GST_CFLAGS) -LIBS = $(GST_LIBS) libtestplugin_la_SOURCES = testplugin.c libtestplugin_la_CFLAGS = $(GST_CFLAGS) @@ -20,10 +17,3 @@ linked_LIBS = libtestplugin.la libtestplugin2.la static_SOURCES = static.c testplugin_s.c testplugin2_s.c -check_PROGRAMS = $(testprogs) - -TESTS = $(top_builddir)/tools/gst-register $(testprogs) - -# override to _not_ install the test plugins -install-pluginLTLIBRARIES: - diff --git a/testsuite/refcounting/Makefile.am b/testsuite/refcounting/Makefile.am index b7fbe22361..41365ece2f 100644 --- a/testsuite/refcounting/Makefile.am +++ b/testsuite/refcounting/Makefile.am @@ -1,29 +1,15 @@ -TOP_BUILDDIR=$(shell cd $(top_builddir) && pwd) -TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(TOP_BUILDDIR) GST_REGISTRY=$(TOP_BUILDDIR)/testsuite/test-registry.xml +include ../Rules -if BUILD_FAILING_TESTS -tests_failing = element bin element_pad pad -else -tests_failing = -endif -tests_working = mainloop sched +tests_pass = bin element mainloop pad +tests_fail = element_pad sched element_SOURCES = element.c mem.c pad_SOURCES = pad.c mem.c - element_pad_SOURCES = element_pad.c mem.c bin_SOURCES = bin.c mem.c -TESTS = $(tests_working) - -check_PROGRAMS = $(TESTS) -noinst_PROGRAMS = $(tests_failing) - EXTRA_DIST = thread.c object.c noinst_HEADERS = mem.h -# we have nothing but apps here, we can do this safely -LIBS = $(GST_LIBS) -AM_CFLAGS = $(GLIB_CFLAGS) $(XML_CFLAGS) $(GST_CFLAGS) diff --git a/testsuite/refcounting/bin.c b/testsuite/refcounting/bin.c index a2811fac55..81c867180b 100644 --- a/testsuite/refcounting/bin.c +++ b/testsuite/refcounting/bin.c @@ -1,8 +1,7 @@ #include -#define ITERS 100000 +#define ITERS 100 #include -#include "mem.h" static GstElement* create_bin (void) @@ -73,12 +72,16 @@ add_remove_test2 (void) g_assert (!GST_OBJECT_DESTROYED (element)); gst_object_unref (GST_OBJECT (element)); +#if 0 g_assert (GST_OBJECT_DESTROYED (element)); gst_object_unref (GST_OBJECT (element)); +#endif gst_object_unref (GST_OBJECT (bin)); } +#if 0 +/* This code is bogus */ static void add_remove_test3 (void) { @@ -97,7 +100,10 @@ add_remove_test3 (void) gst_object_unref (GST_OBJECT (bin)); } +#endif +#if 0 +/* This code is bogus */ static void add_remove_test4 (void) { @@ -123,14 +129,17 @@ add_remove_test4 (void) gst_object_unref (GST_OBJECT (bin)); } +#endif int main (int argc, gchar *argv[]) { GstElement *bin; - long usage1; + int usage1; gint i, iters; + gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE); + gst_init (&argc, &argv); if (argc == 2) @@ -138,18 +147,21 @@ main (int argc, gchar *argv[]) else iters = ITERS; + g_print ("starting test\n"); - usage1 = vmsize(); + + usage1 = gst_alloc_trace_live_all (); + //gst_alloc_trace_print_all (); bin = gst_bin_new ("somebin"); gst_object_unref (GST_OBJECT (bin)); - g_print ("create/unref new bin %ld\n", vmsize()-usage1); + g_print ("create/unref new bin %d\n", gst_alloc_trace_live_all ()-usage1); for (i=0; i -#define ITERS 10000 +#define ITERS 100 #include -#include "mem.h" int main (int argc, gchar *argv[]) { GstElement *element; - long usage1; + int usage1; gint i, iters; gst_init (&argc, &argv); @@ -19,17 +18,19 @@ main (int argc, gchar *argv[]) iters = ITERS; g_print ("starting test\n"); - usage1 = vmsize(); + + usage1 = gst_alloc_trace_live_all (); + //gst_alloc_trace_print_all (); element = gst_element_factory_make ("fakesrc", NULL); gst_object_unref (GST_OBJECT (element)); - g_print ("create/unref new element %ld\n", vmsize()-usage1); + g_print ("create/unref new element %d\n", gst_alloc_trace_live_all ()-usage1); for (i=0; i -#define ITERS 100000 +#define ITERS 100 #include #include "mem.h" diff --git a/testsuite/refcounting/pad.c b/testsuite/refcounting/pad.c index 1aa259bb2f..a353c5dd74 100644 --- a/testsuite/refcounting/pad.c +++ b/testsuite/refcounting/pad.c @@ -1,6 +1,6 @@ #include -#define ITERS 100000 +#define ITERS 100 #include #include "mem.h" @@ -12,13 +12,19 @@ main (int argc, gchar *argv[]) long usage1; gint i, iters; + gst_alloc_trace_set_flags_all (GST_ALLOC_TRACE_LIVE); + gst_init (&argc, &argv); + g_mem_profile (); + if (argc == 2) iters = atoi (argv[1]); else iters = ITERS; + //gst_alloc_trace_print_all (); + g_print ("starting pad test\n"); usage1 = vmsize(); @@ -48,19 +54,23 @@ main (int argc, gchar *argv[]) } g_print ("create/ref/sink/unref %d pads %ld\n", iters, vmsize()-usage1); +#if 0 pad = gst_pad_new ("padname", GST_PAD_SINK); g_assert (!GST_OBJECT_DESTROYED (pad)); gst_object_unref (GST_OBJECT (pad)); g_assert (GST_OBJECT_DESTROYED (pad)); gst_object_unref (GST_OBJECT (pad)); g_print ("create/destroy/unref pad %ld\n", vmsize()-usage1); +#endif +#if 0 for (i=0; i +#include /* threadc.c * this tests if we can make a GstThread, with enough cothreads to stress it @@ -59,6 +60,8 @@ main (gint argc, gchar *argv[]) gulong id; GstElement *thread; + alarm(10); + gst_init (&argc, &argv); for (i = 0; i < runs; ++i) diff --git a/testsuite/threads/threade.c b/testsuite/threads/threade.c index 79e6213213..98b15dd3c0 100644 --- a/testsuite/threads/threade.c +++ b/testsuite/threads/threade.c @@ -1,4 +1,5 @@ #include +#include /* threadc.c * this tests if we can make a GstBin and iterate it inside a GThread @@ -54,6 +55,8 @@ main (gint argc, gchar *argv[]) int i; GstElement *pipeline; + alarm(10); + g_thread_init (NULL); gst_init (&argc, &argv);