From: Thomas Vander Stichele Date: Wed, 28 Feb 2007 12:40:45 +0000 (+0000) Subject: tests/check/generic/states.c: Copy the current generic/states example from -base... X-Git-Tag: RELEASE-0_10_12~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=155fa0066d64741c0c258c8de2c730643babeec0;p=platform%2Fupstream%2Fgstreamer.git tests/check/generic/states.c: Copy the current generic/states example from -base and adapt so we can use the exact sa... Original commit message from CVS: * tests/check/generic/states.c: (GST_START_TEST), (states_suite): Copy the current generic/states example from -base and adapt so we can use the exact same code everywhere. Check a STATES_IGNORE_ELEMENTS env var which can be used to ignore certain element factories for this test, which is what is being done in -base * tests/check/Makefile.am: Mention this environment variable. --- diff --git a/ChangeLog b/ChangeLog index bb45255..49c6791 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-02-28 Thomas Vander Stichele + + * tests/check/generic/states.c: (GST_START_TEST), (states_suite): + Copy the current generic/states example from -base and adapt so + we can use the exact same code everywhere. + Check a STATES_IGNORE_ELEMENTS env var which can be used + to ignore certain element factories for this test, which is + what is being done in -base + * tests/check/Makefile.am: + Mention this environment variable. + 2007-02-27 Wim Taymans * docs/gst/gstreamer-sections.txt: diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index d279d96..efa5211 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -8,7 +8,7 @@ REGISTRY_ENVIRONMENT = \ GST_REGISTRY=$(CHECK_REGISTRY) TESTS_ENVIRONMENT = \ - $(REGISTRY_ENVIRONMENT) \ + $(REGISTRY_ENVIRONMENT) \ GST_PLUGIN_SYSTEM_PATH= \ GST_PLUGIN_PATH=$(top_builddir)/plugins @@ -43,8 +43,8 @@ if GST_DISABLE_REGISTRY REGISTRY_CHECKS = else REGISTRY_CHECKS = \ - gst/gst \ - gst/gstbin \ + gst/gst \ + gst/gstbin \ gst/gstelement \ gst/gstevent \ gst/gstghostpad \ @@ -54,9 +54,9 @@ REGISTRY_CHECKS = \ gst/gstutils \ generic/sinks \ elements/fakesink \ - elements/fakesrc \ - elements/fdsrc \ - elements/filesrc \ + elements/fakesrc \ + elements/fdsrc \ + elements/filesrc \ elements/identity \ libs/basesrc \ libs/controller \ @@ -64,30 +64,30 @@ REGISTRY_CHECKS = \ pipelines/stress endif -check_PROGRAMS = \ +check_PROGRAMS = \ gst/gstabi \ gst/gstbuffer \ gst/gstbus \ - gst/gstcaps \ + gst/gstcaps \ gst/gstinfo \ - gst/gstiterator \ + gst/gstiterator \ gst/gstmessage \ gst/gstminiobject \ gst/gstobject \ gst/gstpad \ gst/gstsegment \ gst/gstsystemclock \ - gst/gststructure \ + gst/gststructure \ gst/gsttag \ - gst/gsttagsetter \ + gst/gsttagsetter \ gst/gsttask \ gst/gstvalue \ - $(LOADSAVE_CHECKS) \ + $(LOADSAVE_CHECKS) \ generic/states \ $(PARSE_CHECKS) \ $(REGISTRY_CHECKS) \ libs/libsabi \ - libs/gdp \ + libs/gdp \ libs/adapter \ libs/gstnetclientclock \ libs/gstnettimeprovider @@ -95,10 +95,13 @@ check_PROGRAMS = \ # failing tests # queue : tests is unstable (race conditions) noinst_PROGRAMS = \ - gst/gstpipeline \ - libs/collectpads \ + gst/gstpipeline \ + libs/collectpads \ elements/queue +# elements to ignore for the state tests +# STATE_IGNORE_ELEMENTS = +# TESTS = $(check_PROGRAMS) noinst_HEADERS = \ @@ -207,7 +210,7 @@ coverage-report: rm -r coverage for dir in $(COVERAGE_DIRS); do \ mkdir -p coverage/$$dir; \ - make -C $(top_builddir)/$$dir gcov; \ + make -C $(top_builddir)/$$dir gcov; \ done for dir in $(COVERAGE_DIRS); do \ files="`ls $(top_builddir)/$$dir/*.gcov.out 2> /dev/null`"; \ diff --git a/tests/check/generic/states.c b/tests/check/generic/states.c index 30a6ea6..a9f217e 100644 --- a/tests/check/generic/states.c +++ b/tests/check/generic/states.c @@ -20,6 +20,10 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include @@ -28,34 +32,73 @@ GST_START_TEST (test_state_changes) { GstElement *element; GList *features, *f; + GList *plugins, *p; + gchar **ignorelist = NULL; + const gchar *STATE_IGNORE_ELEMENTS = NULL; + + GST_DEBUG ("testing elements from source %s", PACKAGE); + STATE_IGNORE_ELEMENTS = g_getenv ("STATE_IGNORE_ELEMENTS"); + if (STATE_IGNORE_ELEMENTS) { + GST_DEBUG ("Will ignore element factories: '%s'", STATE_IGNORE_ELEMENTS); + ignorelist = g_strsplit (STATE_IGNORE_ELEMENTS, " ", 0); + } + + plugins = gst_registry_get_plugin_list (gst_registry_get_default ()); + + for (p = plugins; p; p = p->next) { + GstPlugin *plugin = p->data; - features = gst_registry_get_feature_list (gst_registry_get_default (), - GST_TYPE_ELEMENT_FACTORY); + if (strcmp (gst_plugin_get_source (plugin), PACKAGE) != 0) + continue; - for (f = features; f; f = f->next) { - GstPluginFeature *feature = f->data; - const gchar *name = gst_plugin_feature_get_name (feature); + features = + gst_registry_get_feature_list_by_plugin (gst_registry_get_default (), + gst_plugin_get_name (plugin)); - GST_DEBUG ("testing element %s", name); - element = gst_element_factory_make (name, name); + for (f = features; f; f = f->next) { + GstPluginFeature *feature = f->data; + const gchar *name = gst_plugin_feature_get_name (feature); + gboolean ignore = FALSE; - gst_element_set_state (element, GST_STATE_READY); - gst_element_set_state (element, GST_STATE_PAUSED); - gst_element_set_state (element, GST_STATE_PLAYING); + if (!GST_IS_ELEMENT_FACTORY (feature)) + continue; - gst_element_set_state (element, GST_STATE_PAUSED); - gst_element_set_state (element, GST_STATE_READY); - gst_element_set_state (element, GST_STATE_NULL); - gst_element_set_state (element, GST_STATE_PAUSED); - gst_element_set_state (element, GST_STATE_READY); - gst_element_set_state (element, GST_STATE_PLAYING); - gst_element_set_state (element, GST_STATE_PAUSED); - gst_element_set_state (element, GST_STATE_NULL); + if (ignorelist) { + gchar **s; - gst_object_unref (GST_OBJECT (element)); + for (s = ignorelist; s && *s; ++s) { + if (g_str_has_prefix (name, *s)) { + GST_DEBUG ("ignoring element %s", name); + ignore = TRUE; + } + } + if (ignore) + continue; + } + + GST_DEBUG ("testing element %s", name); + element = gst_element_factory_make (name, name); + fail_if (element == NULL, "Could not make element from factory %s", name); + + if (GST_IS_PIPELINE (element)) { + GST_DEBUG ("element %s is a pipeline", name); + } + + gst_element_set_state (element, GST_STATE_READY); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_PLAYING); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_READY); + gst_element_set_state (element, GST_STATE_NULL); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_READY); + gst_element_set_state (element, GST_STATE_PLAYING); + gst_element_set_state (element, GST_STATE_PAUSED); + gst_element_set_state (element, GST_STATE_NULL); + gst_object_unref (GST_OBJECT (element)); + } } - gst_plugin_feature_list_free (features); - gst_task_cleanup_all (); + g_strfreev (ignorelist); } GST_END_TEST; @@ -66,10 +109,6 @@ states_suite (void) Suite *s = suite_create ("states"); TCase *tc_chain = tcase_create ("general"); - /* Use a long timeout, as we test all elements and take - * at least 0.2 seconds each */ - tcase_set_timeout (tc_chain, 120); - suite_add_tcase (s, tc_chain); tcase_add_test (tc_chain, test_state_changes);