From ffdd6b3665a9bc93195ac13c0b81f672fc9ad28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 12 Sep 2007 17:15:12 +0000 Subject: [PATCH] tests/check/: Add basic libvisual test case in an attempt to reproduce bug #450336. Original commit message from CVS: * tests/check/Makefile.am: * tests/check/elements/.cvsignore: * tests/check/elements/libvisual.c: Add basic libvisual test case in an attempt to reproduce bug #450336. Doesn't reproduce that bug, but some other crasher instead (invalid free), at least with make elements/libvisual.forever and the bumscope plugin on x86-64/gutsy. Leaving test disabled for now. --- ChangeLog | 10 +++ tests/check/Makefile.am | 11 +++- tests/check/elements/.gitignore | 1 + tests/check/elements/libvisual.c | 102 +++++++++++++++++++++++++++++++ 4 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 tests/check/elements/libvisual.c diff --git a/ChangeLog b/ChangeLog index 63dffae1d9..febb0d21b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-09-12 Tim-Philipp Müller + + * tests/check/Makefile.am: + * tests/check/elements/.cvsignore: + * tests/check/elements/libvisual.c: + Add basic libvisual test case in an attempt to reproduce bug #450336. + Doesn't reproduce that bug, but some other crasher instead (invalid + free), at least with make elements/libvisual.forever and the bumscope + plugin on x86-64/gutsy. Leaving test disabled for now. + 2007-09-11 Wim Taymans Patch by: Tommi Myöhänen diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index bfcc091776..4049ed6729 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -37,6 +37,12 @@ else check_gnomevfs = endif +if USE_LIBVISUAL +check_libvisual = elements/libvisual +else +check_libvisual = +endif + if USE_OGG check_ogg = pipelines/oggmux else @@ -109,7 +115,7 @@ VALGRIND_TO_FIX = \ libs/video # these tests don't even pass -noinst_PROGRAMS = +noinst_PROGRAMS = $(check_libvisual) AM_CFLAGS = $(GST_CFLAGS) $(GST_CHECK_CFLAGS) LDADD = $(GST_LIBS) $(GST_CHECK_LIBS) @@ -208,6 +214,9 @@ elements_audioconvert_LDADD = \ elements_audiorate_LDADD = $(LDADD) elements_audiorate_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS) +elements_libvisual_LDADD = $(LDADD) +elements_libvisual_CFLAGS = $(CFLAGS) $(AM_CFLAGS) + elements_gdpdepay_LDADD = $(GST_GDP_LIBS) $(LDADD) elements_gdppay_LDADD = $(GST_GDP_LIBS) $(LDADD) diff --git a/tests/check/elements/.gitignore b/tests/check/elements/.gitignore index 6709ab5b77..230492edab 100644 --- a/tests/check/elements/.gitignore +++ b/tests/check/elements/.gitignore @@ -9,6 +9,7 @@ decodebin gdpdepay gdppay gnomevfssink +libvisual multifdsink videorate videotestsrc diff --git a/tests/check/elements/libvisual.c b/tests/check/elements/libvisual.c new file mode 100644 index 0000000000..2ef6f64c44 --- /dev/null +++ b/tests/check/elements/libvisual.c @@ -0,0 +1,102 @@ +/* GStreamer unit test for libvisual plugin + * + * Copyright (C) 2007 Tim-Philipp Müller + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include + +static gboolean +filter_func (GstPluginFeature * feature, gpointer user_data) +{ + return (g_str_has_prefix (GST_PLUGIN_FEATURE_NAME (feature), "libvisual_")); +} + +GST_START_TEST (test_shutdown) +{ + GstElement *pipeline, *src, *q, *ac, *vis, *cf, *q2, *sink; + GstCaps *caps; + GList *l; + guint i; + + pipeline = gst_pipeline_new (NULL); + + src = gst_check_setup_element ("audiotestsrc"); + q = gst_check_setup_element ("queue"); + ac = gst_check_setup_element ("audioconvert"); + + l = gst_default_registry_feature_filter (filter_func, TRUE, NULL); + if (l == NULL) { + g_print ("No libvisual plugins installed.\n"); + return; + } + fail_unless (l->data != NULL); + GST_INFO ("Using %s", GST_PLUGIN_FEATURE_NAME (l->data)); + vis = gst_check_setup_element (GST_PLUGIN_FEATURE_NAME (l->data)); + gst_plugin_feature_list_free (l); + + cf = gst_check_setup_element ("capsfilter"); + caps = gst_caps_new_simple ("video/x-raw-rgb", "width", G_TYPE_INT, 320, + "height", G_TYPE_INT, 240, "framerate", GST_TYPE_FRACTION, 15, 1, NULL); + g_object_set (cf, "caps", caps, NULL); + gst_caps_unref (caps); + + q2 = gst_check_setup_element ("queue"); + gst_object_set_name (GST_OBJECT (q2), "queue2"); + sink = gst_check_setup_element ("fakesink"); + + /* don't want to sync against the clock, the more throughput the better */ + g_object_set (src, "is-live", FALSE, NULL); + g_object_set (sink, "sync", FALSE, NULL); + + gst_bin_add_many (GST_BIN (pipeline), src, q, ac, vis, cf, q2, sink, NULL); + fail_if (!gst_element_link_many (src, q, ac, vis, cf, q2, sink, NULL)); + + /* now, wait until pipeline is running and then shut it down again; repeat; + * this makes sure we can shut down cleanly while stuff is going on in the + * chain function */ + for (i = 0; i < 200; ++i) { + gst_element_set_state (pipeline, GST_STATE_PAUSED); + gst_element_get_state (pipeline, NULL, NULL, -1); + gst_element_set_state (pipeline, GST_STATE_PLAYING); + g_usleep (100); + gst_element_set_state (pipeline, GST_STATE_NULL); + } + + gst_object_unref (pipeline); +} + +GST_END_TEST; + +static Suite * +libvisual_suite (void) +{ + Suite *s = suite_create ("libvisual"); + TCase *tc_chain = tcase_create ("general"); + + suite_add_tcase (s, tc_chain); + + /* set one manually, since we're currently built as uninst program with + * the default timeout of 3 seconds, which is way too short */ + tcase_set_timeout (tc_chain, 30); + + tcase_add_test (tc_chain, test_shutdown); + + return s; +} + +GST_CHECK_MAIN (libvisual);