check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
|
|
|
* Common code for GStreamer unittests
|
|
|
|
*
|
2006-07-01 20:54:25 +00:00
|
|
|
* Copyright (C) 2004,2006 Thomas Vander Stichele <thomas at apestaart dot org>
|
2008-02-01 17:16:26 +00:00
|
|
|
* Copyright (C) 2008 Thijs Vermeir <thijsvermeir@gmail.com>
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2005-08-30 08:17:48 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstcheck
|
2005-11-24 18:40:58 +00:00
|
|
|
* @short_description: Common code for GStreamer unit tests
|
2005-08-30 08:17:48 +00:00
|
|
|
*
|
2005-11-24 18:40:58 +00:00
|
|
|
* These macros and functions are for internal use of the unit tests found
|
|
|
|
* inside the 'check' directories of various GStreamer packages.
|
2005-08-30 08:17:48 +00:00
|
|
|
*/
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
|
2008-03-22 14:56:17 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
#include "gstcheck.h"
|
|
|
|
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_DEBUG_CATEGORY (check_debug);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
|
|
|
|
/* logging function for tests
|
|
|
|
* a test uses g_message() to log a debug line
|
|
|
|
* a gst unit test can be run with GST_TEST_DEBUG env var set to see the
|
|
|
|
* messages
|
|
|
|
*/
|
|
|
|
|
|
|
|
gboolean _gst_check_threads_running = FALSE;
|
|
|
|
GList *thread_list = NULL;
|
|
|
|
GMutex *mutex;
|
|
|
|
GCond *start_cond; /* used to notify main thread of thread startups */
|
|
|
|
GCond *sync_cond; /* used to synchronize all threads and main thread */
|
|
|
|
|
2008-01-12 20:22:30 +00:00
|
|
|
GList *buffers = NULL;
|
|
|
|
GMutex *check_mutex = NULL;
|
|
|
|
GCond *check_cond = NULL;
|
|
|
|
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
/* FIXME 0.11: shouldn't _gst_check_debug be static? Not used anywhere */
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
gboolean _gst_check_debug = FALSE;
|
|
|
|
gboolean _gst_check_raised_critical = FALSE;
|
2005-09-09 14:34:43 +00:00
|
|
|
gboolean _gst_check_raised_warning = FALSE;
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
gboolean _gst_check_expecting_log = FALSE;
|
|
|
|
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
static void gst_check_log_message_func
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
(const gchar * log_domain, GLogLevelFlags log_level,
|
|
|
|
const gchar * message, gpointer user_data)
|
|
|
|
{
|
|
|
|
if (_gst_check_debug) {
|
2005-09-09 14:34:43 +00:00
|
|
|
g_print ("%s", message);
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
static void gst_check_log_critical_func
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
(const gchar * log_domain, GLogLevelFlags log_level,
|
|
|
|
const gchar * message, gpointer user_data)
|
|
|
|
{
|
|
|
|
if (!_gst_check_expecting_log) {
|
|
|
|
g_print ("\n\nUnexpected critical/warning: %s\n", message);
|
|
|
|
fail ("Unexpected critical/warning: %s", message);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_gst_check_debug) {
|
|
|
|
g_print ("\nExpected critical/warning: %s\n", message);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (log_level & G_LOG_LEVEL_CRITICAL)
|
|
|
|
_gst_check_raised_critical = TRUE;
|
2005-09-09 14:34:43 +00:00
|
|
|
if (log_level & G_LOG_LEVEL_WARNING)
|
|
|
|
_gst_check_raised_warning = TRUE;
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
}
|
|
|
|
|
2008-03-22 14:56:17 +00:00
|
|
|
#if defined(G_OS_UNIX) && defined(HAVE_EXECINFO_H)
|
|
|
|
#include <signal.h>
|
|
|
|
#include <execinfo.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
static struct sigaction oldaction_segv;
|
|
|
|
static struct sigaction oldaction_ill;
|
|
|
|
static struct sigaction oldaction_bus;
|
|
|
|
static struct sigaction oldaction_abrt;
|
|
|
|
static gboolean _gst_check_fault_handler_is_setup; /* FALSE */
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gst_check_fault_handler_restore (void)
|
|
|
|
{
|
|
|
|
if (!_gst_check_fault_handler_is_setup)
|
|
|
|
return;
|
|
|
|
|
|
|
|
_gst_check_fault_handler_is_setup = FALSE;
|
|
|
|
|
|
|
|
sigaction (SIGSEGV, &oldaction_segv, NULL);
|
|
|
|
sigaction (SIGILL, &oldaction_ill, NULL);
|
|
|
|
sigaction (SIGBUS, &oldaction_bus, NULL);
|
|
|
|
sigaction (SIGABRT, &oldaction_abrt, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gst_check_fault_handler_sighandler (int signum)
|
|
|
|
{
|
|
|
|
void *bt_arr[100];
|
|
|
|
int num;
|
|
|
|
char *signame;
|
|
|
|
|
|
|
|
/* We need to restore the fault handler or we'll keep getting it */
|
|
|
|
_gst_check_fault_handler_restore ();
|
|
|
|
|
|
|
|
switch (signum) {
|
|
|
|
case SIGSEGV:
|
|
|
|
signame = "SIGSEGV";
|
|
|
|
break;
|
|
|
|
case SIGILL:
|
|
|
|
signame = "SIGILL";
|
|
|
|
break;
|
|
|
|
case SIGBUS:
|
|
|
|
signame = "SIGBUS";
|
|
|
|
break;
|
|
|
|
case SIGABRT:
|
|
|
|
signame = "SIGABRT";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
signame = "Unknown Signal";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf (stderr, "\nERROR: Caught signal '%s' while running test.\n",
|
|
|
|
signame);
|
|
|
|
|
|
|
|
fprintf (stderr, "Backtrace:\n");
|
|
|
|
|
|
|
|
if ((num = backtrace ((void **) bt_arr, G_N_ELEMENTS (bt_arr))))
|
|
|
|
backtrace_symbols_fd (bt_arr, num, STDERR_FILENO);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gst_check_fault_handler_setup (void)
|
|
|
|
{
|
|
|
|
struct sigaction action;
|
|
|
|
|
|
|
|
if (_gst_check_fault_handler_is_setup)
|
|
|
|
return;
|
|
|
|
|
|
|
|
_gst_check_fault_handler_is_setup = TRUE;
|
|
|
|
|
|
|
|
memset (&action, 0, sizeof (action));
|
|
|
|
action.sa_handler = _gst_check_fault_handler_sighandler;
|
|
|
|
|
|
|
|
sigaction (SIGSEGV, &action, &oldaction_segv);
|
|
|
|
sigaction (SIGILL, &action, &oldaction_ill);
|
|
|
|
sigaction (SIGBUS, &action, &oldaction_bus);
|
|
|
|
sigaction (SIGABRT, &action, &oldaction_abrt);
|
|
|
|
}
|
|
|
|
#endif /* G_OS_UNIX && HAVE_EXECINFO_H */
|
|
|
|
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
/* initialize GStreamer testing */
|
|
|
|
void
|
|
|
|
gst_check_init (int *argc, char **argv[])
|
|
|
|
{
|
|
|
|
gst_init (argc, argv);
|
|
|
|
|
2005-07-09 16:36:18 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (check_debug, "check", 0, "check regression tests");
|
|
|
|
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
if (g_getenv ("GST_TEST_DEBUG"))
|
|
|
|
_gst_check_debug = TRUE;
|
|
|
|
|
|
|
|
g_log_set_handler (NULL, G_LOG_LEVEL_MESSAGE, gst_check_log_message_func,
|
|
|
|
NULL);
|
|
|
|
g_log_set_handler (NULL, G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
|
|
|
|
gst_check_log_critical_func, NULL);
|
|
|
|
g_log_set_handler ("GStreamer", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
|
|
|
|
gst_check_log_critical_func, NULL);
|
|
|
|
g_log_set_handler ("GLib-GObject", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
|
|
|
|
gst_check_log_critical_func, NULL);
|
2007-06-14 17:36:19 +00:00
|
|
|
g_log_set_handler ("Gst-Phonon", G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING,
|
|
|
|
gst_check_log_critical_func, NULL);
|
2006-06-02 16:41:02 +00:00
|
|
|
|
|
|
|
check_cond = g_cond_new ();
|
|
|
|
check_mutex = g_mutex_new ();
|
2008-03-22 14:56:17 +00:00
|
|
|
|
|
|
|
#if defined(G_OS_UNIX) && defined(HAVE_EXECINFO_H)
|
|
|
|
_gst_check_fault_handler_setup ();
|
|
|
|
#endif
|
check/: Added checks.
Original commit message from CVS:
* check/.cvsignore:
* check/Makefile.am:
* check/gst-libs/.cvsignore:
* check/gst-libs/gdp.c: (START_TEST), (gst_object_suite), (main):
* check/gst/.cvsignore:
* check/gst/gstbus.c: (pound_bus_with_messages), (pull_messages),
(START_TEST), (gstbus_suite), (main):
* check/gst/gstcaps.c: (START_TEST), (gst_caps_suite), (main):
* check/gst/gstdata.c: (START_TEST), (thread_ref), (thread_unref),
(gst_data_suite), (main):
* check/gst/gstiterator.c: (make_list_of_ints), (START_TEST),
(add_fold_func), (gstiterator_suite), (main):
* check/gst/gstobject.c: (gst_fake_object_get_type), (START_TEST),
(thread_name_object), (thread_name_object_default),
(gst_object_name_compare), (gst_object_suite), (main):
* check/gst/gstpad.c: (START_TEST), (thread_link_unlink),
(gst_pad_suite), (main):
* check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_init):
* check/gstcheck.h:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (START_TEST), (simple_launch_lines_suite), (main):
Added checks.
2005-03-07 18:33:37 +00:00
|
|
|
}
|
2005-08-20 20:15:53 +00:00
|
|
|
|
|
|
|
/* message checking */
|
|
|
|
void
|
|
|
|
gst_check_message_error (GstMessage * message, GstMessageType type,
|
|
|
|
GQuark domain, gint code)
|
|
|
|
{
|
|
|
|
GError *error;
|
|
|
|
gchar *debug;
|
|
|
|
|
2006-07-02 23:22:31 +00:00
|
|
|
fail_unless (GST_MESSAGE_TYPE (message) == type,
|
|
|
|
"message is of type %s instead of expected type %s",
|
|
|
|
gst_message_type_get_name (GST_MESSAGE_TYPE (message)),
|
|
|
|
gst_message_type_get_name (type));
|
2005-08-20 20:15:53 +00:00
|
|
|
gst_message_parse_error (message, &error, &debug);
|
|
|
|
fail_unless_equals_int (error->domain, domain);
|
|
|
|
fail_unless_equals_int (error->code, code);
|
|
|
|
g_error_free (error);
|
|
|
|
g_free (debug);
|
|
|
|
}
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
|
|
|
|
/* helper functions */
|
|
|
|
GstFlowReturn
|
|
|
|
gst_check_chain_func (GstPad * pad, GstBuffer * buffer)
|
|
|
|
{
|
|
|
|
GST_DEBUG ("chain_func: received buffer %p", buffer);
|
|
|
|
buffers = g_list_append (buffers, buffer);
|
|
|
|
|
2006-06-02 16:41:02 +00:00
|
|
|
g_mutex_lock (check_mutex);
|
|
|
|
g_cond_signal (check_cond);
|
|
|
|
g_mutex_unlock (check_mutex);
|
|
|
|
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* setup an element for a filter test with mysrcpad and mysinkpad */
|
|
|
|
GstElement *
|
|
|
|
gst_check_setup_element (const gchar * factory)
|
|
|
|
{
|
|
|
|
GstElement *element;
|
|
|
|
|
|
|
|
GST_DEBUG ("setup_element");
|
|
|
|
|
|
|
|
element = gst_element_factory_make (factory, factory);
|
2008-02-01 17:16:26 +00:00
|
|
|
fail_if (element == NULL, "Could not create a '%s' element", factory);
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (element, factory, 1);
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_check_teardown_element (GstElement * element)
|
|
|
|
{
|
|
|
|
GST_DEBUG ("teardown_element");
|
|
|
|
|
|
|
|
fail_unless (gst_element_set_state (element, GST_STATE_NULL) ==
|
2005-09-02 15:42:00 +00:00
|
|
|
GST_STATE_CHANGE_SUCCESS, "could not set to null");
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (element, "element", 1);
|
|
|
|
gst_object_unref (element);
|
|
|
|
}
|
|
|
|
|
2005-08-25 16:27:44 +00:00
|
|
|
/* FIXME: set_caps isn't that useful
|
|
|
|
*/
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
GstPad *
|
|
|
|
gst_check_setup_src_pad (GstElement * element,
|
2005-11-16 16:09:49 +00:00
|
|
|
GstStaticPadTemplate * template, GstCaps * caps)
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
{
|
|
|
|
GstPad *srcpad, *sinkpad;
|
|
|
|
|
|
|
|
/* sending pad */
|
2005-11-16 16:09:49 +00:00
|
|
|
srcpad = gst_pad_new_from_static_template (template, "src");
|
2006-05-22 13:31:48 +00:00
|
|
|
GST_DEBUG_OBJECT (element, "setting up sending pad %p", srcpad);
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
fail_if (srcpad == NULL, "Could not create a srcpad");
|
|
|
|
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
|
|
|
|
|
|
|
|
sinkpad = gst_element_get_pad (element, "sink");
|
|
|
|
fail_if (sinkpad == NULL, "Could not get sink pad from %s",
|
|
|
|
GST_ELEMENT_NAME (element));
|
|
|
|
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
|
2005-10-15 16:16:04 +00:00
|
|
|
if (caps)
|
2007-10-25 14:50:48 +00:00
|
|
|
fail_unless (gst_pad_set_caps (srcpad, caps), "could not set caps on pad");
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
|
|
|
|
"Could not link source and %s sink pads", GST_ELEMENT_NAME (element));
|
|
|
|
gst_object_unref (sinkpad); /* because we got it higher up */
|
|
|
|
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 1);
|
|
|
|
|
|
|
|
return srcpad;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_check_teardown_src_pad (GstElement * element)
|
|
|
|
{
|
|
|
|
GstPad *srcpad, *sinkpad;
|
|
|
|
|
|
|
|
/* clean up floating src pad */
|
|
|
|
sinkpad = gst_element_get_pad (element, "sink");
|
|
|
|
ASSERT_OBJECT_REFCOUNT (sinkpad, "sinkpad", 2);
|
|
|
|
srcpad = gst_pad_get_peer (sinkpad);
|
|
|
|
|
|
|
|
gst_pad_unlink (srcpad, sinkpad);
|
|
|
|
|
2006-06-02 16:45:08 +00:00
|
|
|
/* caps could have been set, make sure they get unset */
|
|
|
|
gst_pad_set_caps (srcpad, NULL);
|
|
|
|
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
/* pad refs held by both creator and this function (through _get) */
|
2006-05-22 13:31:48 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (sinkpad, "element sinkpad", 2);
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
/* one more ref is held by element itself */
|
|
|
|
|
|
|
|
/* pad refs held by both creator and this function (through _get_peer) */
|
2006-05-22 13:31:48 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (srcpad, "check srcpad", 2);
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
gst_object_unref (srcpad);
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
}
|
|
|
|
|
2005-08-25 16:27:44 +00:00
|
|
|
/* FIXME: set_caps isn't that useful; might want to check if fixed,
|
|
|
|
* then use set_use_fixed or somesuch */
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
GstPad *
|
|
|
|
gst_check_setup_sink_pad (GstElement * element, GstStaticPadTemplate * template,
|
|
|
|
GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstPad *srcpad, *sinkpad;
|
|
|
|
|
|
|
|
/* receiving pad */
|
2005-11-16 16:09:49 +00:00
|
|
|
sinkpad = gst_pad_new_from_static_template (template, "sink");
|
2006-05-22 13:31:48 +00:00
|
|
|
GST_DEBUG_OBJECT (element, "setting up receiving pad %p", sinkpad);
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
fail_if (sinkpad == NULL, "Could not create a sinkpad");
|
|
|
|
|
|
|
|
srcpad = gst_element_get_pad (element, "src");
|
|
|
|
fail_if (srcpad == NULL, "Could not get source pad from %s",
|
|
|
|
GST_ELEMENT_NAME (element));
|
2005-10-15 16:16:04 +00:00
|
|
|
if (caps)
|
2007-10-25 14:50:48 +00:00
|
|
|
fail_unless (gst_pad_set_caps (sinkpad, caps), "Could not set pad caps");
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
gst_pad_set_chain_function (sinkpad, gst_check_chain_func);
|
|
|
|
|
2006-05-22 13:31:48 +00:00
|
|
|
GST_DEBUG_OBJECT (element, "Linking element src pad and receiving sink pad");
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
fail_unless (gst_pad_link (srcpad, sinkpad) == GST_PAD_LINK_OK,
|
|
|
|
"Could not link %s source and sink pads", GST_ELEMENT_NAME (element));
|
|
|
|
gst_object_unref (srcpad); /* because we got it higher up */
|
|
|
|
ASSERT_OBJECT_REFCOUNT (srcpad, "srcpad", 1);
|
|
|
|
|
2006-05-22 13:31:48 +00:00
|
|
|
GST_DEBUG_OBJECT (element, "set up srcpad, refcount is 1");
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
return sinkpad;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_check_teardown_sink_pad (GstElement * element)
|
|
|
|
{
|
|
|
|
GstPad *srcpad, *sinkpad;
|
|
|
|
|
|
|
|
/* clean up floating sink pad */
|
|
|
|
srcpad = gst_element_get_pad (element, "src");
|
|
|
|
sinkpad = gst_pad_get_peer (srcpad);
|
2006-10-10 14:09:43 +00:00
|
|
|
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
gst_pad_unlink (srcpad, sinkpad);
|
|
|
|
|
|
|
|
/* pad refs held by both creator and this function (through _get_pad) */
|
2006-05-22 13:31:48 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (srcpad, "element srcpad", 2);
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
gst_object_unref (srcpad);
|
|
|
|
/* one more ref is held by element itself */
|
|
|
|
|
|
|
|
/* pad refs held by both creator and this function (through _get_peer) */
|
2006-05-22 13:31:48 +00:00
|
|
|
ASSERT_OBJECT_REFCOUNT (sinkpad, "check sinkpad", 2);
|
check/Makefile.am: don't valgrind the controller test - it's leaking - Stefan, HELP
Original commit message from CVS:
* check/Makefile.am:
don't valgrind the controller test - it's leaking - Stefan, HELP
* gst/check/gstcheck.c: (gst_check_message_error),
(gst_check_chain_func), (gst_check_setup_element),
(gst_check_teardown_element), (gst_check_setup_src_pad),
(gst_check_teardown_src_pad), (gst_check_setup_sink_pad),
(gst_check_teardown_sink_pad):
* gst/check/gstcheck.h:
add a bunch of methods to set up elements, and src and sink pads
* check/elements/fakesrc.c: (setup_fakesrc), (cleanup_fakesrc):
* check/elements/identity.c: (setup_identity), (cleanup_identity),
(GST_START_TEST):
use them
* gst/gstmessage.c:
* gst/gsttag.h:
whitespace/doc fixes
2005-08-21 10:39:39 +00:00
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
gst_object_unref (sinkpad);
|
|
|
|
}
|
2006-06-06 13:48:20 +00:00
|
|
|
|
2008-02-01 17:16:26 +00:00
|
|
|
/**
|
|
|
|
* gst_check_drop_buffers:
|
|
|
|
*
|
2008-02-19 12:56:28 +00:00
|
|
|
* Unref and remove all buffers that are in the global @buffers GList,
|
|
|
|
* emptying the list.
|
2008-02-01 17:16:26 +00:00
|
|
|
*
|
2008-02-19 12:56:28 +00:00
|
|
|
* Since: 0.10.18
|
2008-02-01 17:16:26 +00:00
|
|
|
*/
|
|
|
|
void
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
gst_check_drop_buffers (void)
|
2008-02-01 17:16:26 +00:00
|
|
|
{
|
|
|
|
GstBuffer *temp_buffer;
|
|
|
|
|
|
|
|
while (g_list_length (buffers)) {
|
|
|
|
temp_buffer = GST_BUFFER (buffers->data);
|
|
|
|
gst_buffer_unref (temp_buffer);
|
2008-02-19 12:56:28 +00:00
|
|
|
buffers = g_list_delete_link (buffers, buffers);
|
2008-02-01 17:16:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_check_caps_equal:
|
|
|
|
* @caps1: first caps to compare
|
|
|
|
* @caps2: second caps to compare
|
|
|
|
*
|
2008-02-19 12:56:28 +00:00
|
|
|
* Compare two caps with gst_caps_is_equal and fail unless they are
|
|
|
|
* equal.
|
2008-02-01 17:16:26 +00:00
|
|
|
*
|
2008-02-19 12:56:28 +00:00
|
|
|
* Since: 0.10.18
|
2008-02-01 17:16:26 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_check_caps_equal (GstCaps * caps1, GstCaps * caps2)
|
|
|
|
{
|
|
|
|
gchar *name1 = gst_caps_to_string (caps1);
|
|
|
|
gchar *name2 = gst_caps_to_string (caps2);
|
|
|
|
|
|
|
|
fail_unless (gst_caps_is_equal (caps1, caps2),
|
|
|
|
"caps ('%s') is not equal to caps ('%s')", name1, name2);
|
|
|
|
g_free (name1);
|
|
|
|
g_free (name2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_check_element_push_buffer:
|
|
|
|
* @element: name of the element that needs to be created
|
|
|
|
* @buffer_in: a list of buffers that needs to be puched to the element
|
|
|
|
* @buffer_out: a list of buffers that we expect from the element
|
|
|
|
* @last_flow_return: the last buffer push needs to give this GstFlowReturn
|
|
|
|
*
|
|
|
|
* Create an @element with the factory with the name and push the buffers in
|
2008-02-19 12:56:28 +00:00
|
|
|
* @buffer_in to this element. The element should create the buffers equal to
|
|
|
|
* the buffers in @buffer_out. We only check the caps, size and the data of the
|
|
|
|
* buffers. This function unrefs the buffers in the two lists.
|
|
|
|
* The last_flow_return parameter indicates the expected flow return value from
|
|
|
|
* pushing the final buffer in the list.
|
|
|
|
* This can be used to set up a test which pushes some buffers and then an
|
|
|
|
* invalid buffer, when the final buffer is expected to fail, for example.
|
|
|
|
*
|
|
|
|
* Since: 0.10.18
|
2008-02-01 17:16:26 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_check_element_push_buffer_list (const gchar * element_name,
|
|
|
|
GList * buffer_in, GList * buffer_out, GstFlowReturn last_flow_return)
|
|
|
|
{
|
|
|
|
GstCaps *sink_caps;
|
|
|
|
GstCaps *src_caps = NULL;
|
|
|
|
GstElement *element;
|
|
|
|
GstPad *pad_peer;
|
|
|
|
GstPad *sink_pad = NULL;
|
|
|
|
GstPad *src_pad;
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
GstBuffer *buffer;
|
2008-02-01 17:16:26 +00:00
|
|
|
|
|
|
|
/* check that there are no buffers waiting */
|
|
|
|
gst_check_drop_buffers ();
|
|
|
|
/* create the element */
|
|
|
|
element = gst_check_setup_element (element_name);
|
|
|
|
fail_if (element == NULL, "failed to create the element '%s'", element_name);
|
|
|
|
fail_unless (GST_IS_ELEMENT (element), "the element is no element");
|
|
|
|
/* create the src pad */
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
buffer = GST_BUFFER (buffer_in->data);
|
2008-02-01 17:16:26 +00:00
|
|
|
|
|
|
|
fail_unless (GST_IS_BUFFER (buffer), "There should be a buffer in buffer_in");
|
|
|
|
src_caps = GST_BUFFER_CAPS (buffer);
|
|
|
|
src_pad = gst_pad_new (NULL, GST_PAD_SRC);
|
|
|
|
gst_pad_set_caps (src_pad, src_caps);
|
|
|
|
pad_peer = gst_element_get_pad (element, "sink");
|
|
|
|
fail_if (pad_peer == NULL);
|
|
|
|
fail_unless (gst_pad_link (src_pad, pad_peer) == GST_PAD_LINK_OK,
|
|
|
|
"Could not link source and %s sink pads", GST_ELEMENT_NAME (element));
|
|
|
|
gst_object_unref (pad_peer);
|
|
|
|
/* activate the pad */
|
|
|
|
gst_pad_set_active (src_pad, TRUE);
|
|
|
|
GST_DEBUG ("src pad activated");
|
|
|
|
/* don't create the sink_pad if there is no buffer_out list */
|
|
|
|
if (buffer_out != NULL) {
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
gchar *temp;
|
|
|
|
|
2008-02-01 17:16:26 +00:00
|
|
|
GST_DEBUG ("buffer out detected, creating the sink pad");
|
|
|
|
/* get the sink caps */
|
|
|
|
sink_caps = GST_BUFFER_CAPS (GST_BUFFER (buffer_out->data));
|
|
|
|
fail_unless (GST_IS_CAPS (sink_caps), "buffer out don't have caps");
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* gst/gstconfig.h.in:
* libs/gst/base/gstcollectpads.c: (gst_collect_pads_read_buffer):
* libs/gst/check/gstcheck.c: (gst_check_log_message_func),
(gst_check_log_critical_func), (gst_check_drop_buffers),
(gst_check_element_push_buffer_list):
* libs/gst/controller/gstcontroller.c: (gst_controller_get),
(gst_controller_get_type):
* libs/gst/controller/gsthelper.c: (gst_object_control_properties),
(gst_object_get_controller), (gst_object_get_control_source):
* libs/gst/controller/gstinterpolationcontrolsource.c:
(gst_interpolation_control_source_new):
* libs/gst/controller/gstlfocontrolsource.c:
(gst_lfo_control_source_new):
* libs/gst/dataprotocol/dataprotocol.c:
(gst_dp_event_from_packet_0_2):
* plugins/elements/gstfdsrc.c:
* plugins/elements/gstmultiqueue.c:
* plugins/elements/gsttee.c:
* plugins/elements/gsttypefindelement.c:
* plugins/indexers/gstfileindex.c: (_file_index_id_save_xml),
(gst_file_index_add_association):
* plugins/indexers/gstmemindex.c:
* tests/benchmarks/gstpollstress.c: (mess_some_more):
* tests/check/elements/queue.c: (setup_queue):
* tests/check/gst/gstpipeline.c:
* tests/check/libs/collectpads.c: (setup), (teardown),
(gst_collect_pads_suite):
* tests/examples/adapter/adapter_test.c:
* tests/examples/metadata/read-metadata.c: (make_pipeline):
* tests/examples/xml/createxml.c:
* tests/examples/xml/runxml.c:
* tools/gst-inspect.c:
* tools/gst-run.c:
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers, not using variable sized arrays
on the stack, moving variable declarations to the beginning of
a block and using "foo (void)" instead of "foo ()" for declarations.
2008-02-29 12:41:33 +00:00
|
|
|
temp = gst_caps_to_string (sink_caps);
|
2008-02-01 17:16:26 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("sink caps requested by buffer out: '%s'", temp);
|
|
|
|
g_free (temp);
|
|
|
|
fail_unless (gst_caps_is_fixed (sink_caps), "we need fixed caps");
|
|
|
|
/* get the sink pad */
|
|
|
|
sink_pad = gst_pad_new (NULL, GST_PAD_SINK);
|
|
|
|
fail_unless (GST_IS_PAD (sink_pad));
|
|
|
|
gst_pad_set_caps (sink_pad, sink_caps);
|
|
|
|
/* get the peer pad */
|
|
|
|
pad_peer = gst_element_get_pad (element, "src");
|
|
|
|
fail_unless (gst_pad_link (pad_peer, sink_pad) == GST_PAD_LINK_OK,
|
|
|
|
"Could not link sink and %s source pads", GST_ELEMENT_NAME (element));
|
|
|
|
gst_object_unref (pad_peer);
|
|
|
|
/* configure the sink pad */
|
|
|
|
gst_pad_set_chain_function (sink_pad, gst_check_chain_func);
|
|
|
|
gst_pad_set_active (sink_pad, TRUE);
|
|
|
|
}
|
|
|
|
fail_unless (gst_element_set_state (element,
|
|
|
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
|
|
|
"could not set to playing");
|
|
|
|
/* push all the buffers in the buffer_in list */
|
|
|
|
fail_unless (g_list_length (buffer_in) > 0, "the buffer_in list is empty");
|
|
|
|
while (g_list_length (buffer_in) > 0) {
|
|
|
|
GstBuffer *next_buffer = GST_BUFFER (buffer_in->data);
|
|
|
|
|
|
|
|
fail_unless (GST_IS_BUFFER (next_buffer),
|
|
|
|
"data in buffer_in should be a buffer");
|
|
|
|
/* remove the buffer from the list */
|
|
|
|
buffer_in = g_list_remove (buffer_in, next_buffer);
|
|
|
|
if (g_list_length (buffer_in) == 0) {
|
|
|
|
fail_unless (gst_pad_push (src_pad, next_buffer) == last_flow_return,
|
2008-02-19 12:56:28 +00:00
|
|
|
"we expect something else from the last buffer");
|
2008-02-01 17:16:26 +00:00
|
|
|
} else {
|
|
|
|
fail_unless (gst_pad_push (src_pad, next_buffer) == GST_FLOW_OK,
|
|
|
|
"Failed to push buffer in");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fail_unless (gst_element_set_state (element,
|
|
|
|
GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
|
|
|
|
/* check that there is a buffer out */
|
|
|
|
fail_unless (g_list_length (buffers) == g_list_length (buffer_out),
|
|
|
|
"We expected %d buffers, but there are %d buffers",
|
|
|
|
g_list_length (buffer_out), g_list_length (buffers));
|
|
|
|
while (g_list_length (buffers) > 0) {
|
|
|
|
GstBuffer *new = GST_BUFFER (buffers->data);
|
|
|
|
GstBuffer *orig = GST_BUFFER (buffer_out->data);
|
|
|
|
|
|
|
|
/* remove the buffers */
|
|
|
|
buffers = g_list_remove (buffers, new);
|
|
|
|
buffer_out = g_list_remove (buffer_out, orig);
|
|
|
|
fail_unless (GST_BUFFER_SIZE (orig) == GST_BUFFER_SIZE (new),
|
|
|
|
"size of the buffers are not the same");
|
|
|
|
fail_unless (memcmp (GST_BUFFER_DATA (orig), GST_BUFFER_DATA (new),
|
|
|
|
GST_BUFFER_SIZE (new)) == 0, "data is not the same");
|
|
|
|
gst_check_caps_equal (GST_BUFFER_CAPS (orig), GST_BUFFER_CAPS (new));
|
|
|
|
gst_buffer_unref (new);
|
|
|
|
gst_buffer_unref (orig);
|
|
|
|
}
|
|
|
|
/* teardown the element and pads */
|
|
|
|
gst_pad_set_active (src_pad, FALSE);
|
|
|
|
gst_check_teardown_src_pad (element);
|
|
|
|
gst_pad_set_active (sink_pad, FALSE);
|
|
|
|
gst_check_teardown_sink_pad (element);
|
|
|
|
gst_check_teardown_element (element);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_check_element_push_buffer:
|
2008-03-24 16:44:25 +00:00
|
|
|
* @element_name: name of the element that needs to be created
|
2008-02-01 17:16:26 +00:00
|
|
|
* @buffer_in: push this buffer to the element
|
|
|
|
* @buffer_out: compare the result with this buffer
|
|
|
|
*
|
|
|
|
* Create an @element with the factory with the name and push the
|
|
|
|
* @buffer_in to this element. The element should create one buffer
|
|
|
|
* and this will be compared with @buffer_out. We only check the caps
|
|
|
|
* and the data of the buffers. This function unrefs the buffers.
|
2008-02-19 12:56:28 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.18
|
2008-02-01 17:16:26 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_check_element_push_buffer (const gchar * element_name,
|
|
|
|
GstBuffer * buffer_in, GstBuffer * buffer_out)
|
|
|
|
{
|
|
|
|
GList *in = NULL;
|
|
|
|
GList *out = NULL;
|
|
|
|
|
|
|
|
in = g_list_append (in, buffer_in);
|
|
|
|
out = g_list_append (out, buffer_out);
|
|
|
|
|
|
|
|
gst_check_element_push_buffer_list (element_name, in, out, GST_FLOW_OK);
|
|
|
|
|
|
|
|
g_list_free (in);
|
|
|
|
g_list_free (out);
|
|
|
|
}
|
|
|
|
|
2006-06-06 13:48:20 +00:00
|
|
|
void
|
|
|
|
gst_check_abi_list (GstCheckABIStruct list[], gboolean have_abi_sizes)
|
|
|
|
{
|
|
|
|
if (have_abi_sizes) {
|
|
|
|
gboolean ok = TRUE;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; list[i].name; i++) {
|
|
|
|
if (list[i].size != list[i].abi_size) {
|
|
|
|
ok = FALSE;
|
|
|
|
g_print ("sizeof(%s) is %d, expected %d\n",
|
|
|
|
list[i].name, list[i].size, list[i].abi_size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fail_unless (ok, "failed ABI check");
|
|
|
|
} else {
|
2007-01-16 09:57:50 +00:00
|
|
|
const gchar *fn;
|
|
|
|
|
|
|
|
if ((fn = g_getenv ("GST_ABI"))) {
|
|
|
|
GError *err = NULL;
|
|
|
|
GString *s;
|
2006-06-06 13:48:20 +00:00
|
|
|
gint i;
|
|
|
|
|
2007-01-16 09:57:50 +00:00
|
|
|
s = g_string_new ("\nGstCheckABIStruct list[] = {\n");
|
2006-06-06 13:48:20 +00:00
|
|
|
for (i = 0; list[i].name; i++) {
|
2007-01-16 09:57:50 +00:00
|
|
|
g_string_append_printf (s, " {\"%s\", sizeof (%s), %d},\n",
|
|
|
|
list[i].name, list[i].name, list[i].size);
|
|
|
|
}
|
|
|
|
g_string_append (s, " {NULL, 0, 0}\n");
|
|
|
|
g_string_append (s, "};\n");
|
|
|
|
if (!g_file_set_contents (fn, s->str, s->len, &err)) {
|
|
|
|
g_print ("%s", s->str);
|
|
|
|
g_printerr ("\nFailed to write ABI information: %s\n", err->message);
|
|
|
|
} else {
|
|
|
|
g_print ("\nWrote ABI information to '%s'.\n", fn);
|
2006-06-06 13:48:20 +00:00
|
|
|
}
|
2007-01-16 09:57:50 +00:00
|
|
|
g_string_free (s, TRUE);
|
2006-06-06 13:48:20 +00:00
|
|
|
} else {
|
|
|
|
g_print ("No structure size list was generated for this architecture.\n");
|
|
|
|
g_print ("Run with GST_ABI environment variable set to output header.\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-07-01 20:54:25 +00:00
|
|
|
|
|
|
|
gint
|
|
|
|
gst_check_run_suite (Suite * suite, const gchar * name, const gchar * fname)
|
|
|
|
{
|
|
|
|
gint nf;
|
|
|
|
|
|
|
|
SRunner *sr = srunner_create (suite);
|
|
|
|
|
|
|
|
if (g_getenv ("GST_CHECK_XML")) {
|
|
|
|
/* how lucky we are to have __FILE__ end in .c */
|
|
|
|
gchar *xmlfilename = g_strdup_printf ("%sheck.xml", fname);
|
|
|
|
|
|
|
|
srunner_set_xml (sr, xmlfilename);
|
|
|
|
}
|
|
|
|
|
|
|
|
srunner_run_all (sr, CK_NORMAL);
|
|
|
|
nf = srunner_ntests_failed (sr);
|
|
|
|
srunner_free (sr);
|
|
|
|
return nf;
|
|
|
|
}
|
2007-10-16 16:12:36 +00:00
|
|
|
|
|
|
|
gboolean
|
|
|
|
_gst_check_run_test_func (const gchar * func_name)
|
|
|
|
{
|
|
|
|
const gchar *gst_checks;
|
|
|
|
gboolean res = FALSE;
|
|
|
|
gchar **funcs, **f;
|
|
|
|
|
|
|
|
gst_checks = g_getenv ("GST_CHECKS");
|
|
|
|
|
|
|
|
/* no filter specified => run all checks */
|
|
|
|
if (gst_checks == NULL || *gst_checks == '\0')
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* only run specified functions */
|
|
|
|
funcs = g_strsplit (gst_checks, ",", -1);
|
|
|
|
for (f = funcs; f != NULL && *f != NULL; ++f) {
|
|
|
|
if (strcmp (*f, func_name) == 0) {
|
|
|
|
res = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_strfreev (funcs);
|
|
|
|
return res;
|
|
|
|
}
|