mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
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.
This commit is contained in:
parent
7553c996a4
commit
155fa0066d
3 changed files with 99 additions and 46 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2007-02-28 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* 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 <wim@fluendo.com>
|
||||
|
||||
* docs/gst/gstreamer-sections.txt:
|
||||
|
|
|
@ -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`"; \
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <gst/check/gstcheck.h>
|
||||
|
@ -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;
|
||||
|
||||
features = gst_registry_get_feature_list (gst_registry_get_default (),
|
||||
GST_TYPE_ELEMENT_FACTORY);
|
||||
|
||||
for (f = features; f; f = f->next) {
|
||||
GstPluginFeature *feature = f->data;
|
||||
const gchar *name = gst_plugin_feature_get_name (feature);
|
||||
|
||||
GST_DEBUG ("testing element %s", name);
|
||||
element = gst_element_factory_make (name, 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_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);
|
||||
}
|
||||
gst_plugin_feature_list_free (features);
|
||||
gst_task_cleanup_all ();
|
||||
|
||||
plugins = gst_registry_get_plugin_list (gst_registry_get_default ());
|
||||
|
||||
for (p = plugins; p; p = p->next) {
|
||||
GstPlugin *plugin = p->data;
|
||||
|
||||
if (strcmp (gst_plugin_get_source (plugin), PACKAGE) != 0)
|
||||
continue;
|
||||
|
||||
features =
|
||||
gst_registry_get_feature_list_by_plugin (gst_registry_get_default (),
|
||||
gst_plugin_get_name (plugin));
|
||||
|
||||
for (f = features; f; f = f->next) {
|
||||
GstPluginFeature *feature = f->data;
|
||||
const gchar *name = gst_plugin_feature_get_name (feature);
|
||||
gboolean ignore = FALSE;
|
||||
|
||||
if (!GST_IS_ELEMENT_FACTORY (feature))
|
||||
continue;
|
||||
|
||||
if (ignorelist) {
|
||||
gchar **s;
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue