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
|
|
|
|
*
|
|
|
|
* Copyright (C) <2004> 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
|
2012-11-03 20:44:48 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
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
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_CHECK_H__
|
|
|
|
#define __GST_CHECK_H__
|
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
2007-06-14 15:56:03 +00:00
|
|
|
#include <math.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
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2018-03-12 23:03:26 +00:00
|
|
|
#include <gst/check/check-prelude.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
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
#define CK_DLL_EXP GST_CHECK_API
|
2017-08-10 10:15:26 +00:00
|
|
|
#include <gst/check/internal-check.h>
|
|
|
|
|
2007-01-12 12:48:25 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API GstDebugCategory *check_debug;
|
2005-07-09 16:36:18 +00:00
|
|
|
#define GST_CAT_DEFAULT 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
|
|
|
|
*/
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API gboolean _gst_check_threads_running;
|
|
|
|
GST_CHECK_API gboolean _gst_check_raised_critical;
|
|
|
|
GST_CHECK_API gboolean _gst_check_raised_warning;
|
|
|
|
GST_CHECK_API gboolean _gst_check_expecting_log;
|
|
|
|
GST_CHECK_API gboolean _gst_check_list_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
|
|
|
|
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
|
|
|
/* global variables used in test methods */
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API GList * buffers;
|
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
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API GMutex check_mutex;
|
|
|
|
GST_CHECK_API GCond check_cond;
|
2006-06-02 16:41:02 +00:00
|
|
|
|
2006-06-06 13:48:20 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2010-03-03 10:45:38 +00:00
|
|
|
const char *name;
|
2006-06-06 13:48:20 +00:00
|
|
|
int size;
|
|
|
|
int abi_size;
|
|
|
|
}
|
|
|
|
GstCheckABIStruct;
|
|
|
|
|
2016-05-24 12:57:54 +00:00
|
|
|
typedef struct _GstCheckLogFilter GstCheckLogFilter;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstCheckLogFilterFunc:
|
|
|
|
* @log_domain: the log domain of the message
|
|
|
|
* @log_level: the log level of the message
|
2018-04-27 16:40:31 +00:00
|
|
|
* @message: the message that has occurred
|
2016-05-24 12:57:54 +00:00
|
|
|
* @user_data: user data
|
|
|
|
*
|
|
|
|
* A function that is called for messages matching the filter added by
|
|
|
|
* @gst_check_add_log_filter.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if message should be discarded by GstCheck.
|
|
|
|
*
|
|
|
|
* Since: 1.12
|
|
|
|
*/
|
|
|
|
typedef gboolean (*GstCheckLogFilterFunc) (const gchar * log_domain,
|
|
|
|
GLogLevelFlags log_level, const gchar * message, gpointer user_data);
|
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
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
|
|
|
void gst_check_init (int *argc, char **argv[]);
|
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2018-04-02 10:41:48 +00:00
|
|
|
GstCheckLogFilter * gst_check_add_log_filter (const gchar * log_domain,
|
2016-05-24 12:57:54 +00:00
|
|
|
GLogLevelFlags log_level, GRegex * regex, GstCheckLogFilterFunc func,
|
|
|
|
gpointer user_data, GDestroyNotify destroy_data);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2016-05-24 12:57:54 +00:00
|
|
|
void gst_check_remove_log_filter (GstCheckLogFilter * filter);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2016-05-24 12:57:54 +00:00
|
|
|
void gst_check_clear_log_filter (void);
|
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2011-11-17 11:40:45 +00:00
|
|
|
GstFlowReturn gst_check_chain_func (GstPad * pad, GstObject * parent, GstBuffer * buffer);
|
2008-02-01 17:16:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2008-02-01 17:16:26 +00:00
|
|
|
void gst_check_message_error (GstMessage * message, GstMessageType type,
|
|
|
|
GQuark domain, gint code);
|
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2008-02-01 17:16:26 +00:00
|
|
|
GstElement *gst_check_setup_element (const gchar * factory);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2008-02-01 17:16:26 +00:00
|
|
|
void gst_check_teardown_element (GstElement * element);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2008-02-01 17:16:26 +00:00
|
|
|
GstPad *gst_check_setup_src_pad (GstElement * element,
|
2011-11-24 20:36:12 +00:00
|
|
|
GstStaticPadTemplate * tmpl);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2014-04-15 10:58:59 +00:00
|
|
|
GstPad *gst_check_setup_src_pad_from_template (GstElement * element,
|
|
|
|
GstPadTemplate * tmpl);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2008-06-21 19:48:53 +00:00
|
|
|
GstPad * gst_check_setup_src_pad_by_name (GstElement * element,
|
2010-07-15 12:46:24 +00:00
|
|
|
GstStaticPadTemplate * tmpl, const gchar *name);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2014-04-15 10:58:59 +00:00
|
|
|
GstPad * gst_check_setup_src_pad_by_name_from_template (GstElement * element,
|
|
|
|
GstPadTemplate * tmpl, const gchar *name);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2014-04-15 10:58:59 +00:00
|
|
|
GstPad *gst_check_setup_sink_pad (GstElement * element,
|
|
|
|
GstStaticPadTemplate * tmpl);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2014-04-15 10:58:59 +00:00
|
|
|
GstPad *gst_check_setup_sink_pad_from_template (GstElement * element,
|
|
|
|
GstPadTemplate * tmpl);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2016-12-02 14:59:43 +00:00
|
|
|
GstPad * gst_check_setup_sink_pad_by_name (GstElement * element,
|
2010-07-15 12:46:24 +00:00
|
|
|
GstStaticPadTemplate * tmpl, const gchar *name);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2016-12-02 14:59:43 +00:00
|
|
|
GstPad * gst_check_setup_sink_pad_by_name_from_template (GstElement * element,
|
2014-04-15 10:58:59 +00:00
|
|
|
GstPadTemplate * tmpl, const gchar *name);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2010-03-03 10:45:38 +00:00
|
|
|
void gst_check_teardown_pad_by_name (GstElement * element, const gchar *name);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2008-02-01 17:16:26 +00:00
|
|
|
void gst_check_teardown_src_pad (GstElement * element);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2010-03-02 21:58:06 +00:00
|
|
|
void gst_check_drop_buffers (void);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2008-02-01 17:16:26 +00:00
|
|
|
void gst_check_caps_equal (GstCaps * caps1, GstCaps * caps2);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2011-03-28 13:52:17 +00:00
|
|
|
void gst_check_buffer_data (GstBuffer * buffer, gconstpointer data, gsize size);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2008-02-01 17:16:26 +00:00
|
|
|
void gst_check_element_push_buffer_list (const gchar * element_name,
|
2012-01-28 07:38:03 +00:00
|
|
|
GList * buffer_in, GstCaps * caps_in, GList * buffer_out,
|
|
|
|
GstCaps * caps_out, GstFlowReturn last_flow_return);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2008-02-01 17:16:26 +00:00
|
|
|
void gst_check_element_push_buffer (const gchar * element_name,
|
2012-01-28 07:38:03 +00:00
|
|
|
GstBuffer * buffer_in, GstCaps * caps_in, GstBuffer * buffer_out,
|
|
|
|
GstCaps *caps_out);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2008-02-01 17:16:26 +00:00
|
|
|
void gst_check_teardown_sink_pad (GstElement * element);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2006-06-06 13:48:20 +00:00
|
|
|
void gst_check_abi_list (GstCheckABIStruct list[], gboolean have_abi_sizes);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2008-02-01 17:16:26 +00:00
|
|
|
gint gst_check_run_suite (Suite * suite, const gchar * name,
|
|
|
|
const gchar * fname);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2013-05-09 21:17:14 +00:00
|
|
|
void gst_check_setup_events (GstPad * srcpad, GstElement * element,
|
|
|
|
GstCaps * caps, GstFormat format);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2013-07-01 09:10:00 +00:00
|
|
|
void gst_check_setup_events_with_stream_id (GstPad * srcpad,
|
2013-07-02 00:07:03 +00:00
|
|
|
GstElement * element, GstCaps * caps, GstFormat format,
|
|
|
|
const gchar * stream_id);
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2014-09-11 13:52:32 +00:00
|
|
|
void gst_check_objects_destroyed_on_unref (gpointer object_to_unref, gpointer first_object, ...)
|
|
|
|
G_GNUC_NULL_TERMINATED;
|
2017-08-10 10:15:26 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2014-09-11 13:52:32 +00:00
|
|
|
void gst_check_object_destroyed_on_unref (gpointer object_to_unref);
|
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
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define fail_unless_message_error(msg, domain, code) \
|
|
|
|
gst_check_message_error (msg, GST_MESSAGE_ERROR, \
|
2005-08-20 20:15:53 +00:00
|
|
|
GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code)
|
2006-07-02 22:05:48 +00:00
|
|
|
#define assert_message_error(m, d, c) fail_unless_message_error(m, d, c)
|
2005-08-20 20:15:53 +00:00
|
|
|
|
2015-04-23 14:54:08 +00:00
|
|
|
#ifdef GST_CHECK_TEST_ENVIRONMENT_BEACON
|
|
|
|
#define GST_DO_CHECK_TEST_ENVIRONMENT \
|
|
|
|
G_STMT_START { \
|
|
|
|
if (g_getenv (GST_CHECK_TEST_ENVIRONMENT_BEACON) == NULL) \
|
|
|
|
fail ("Test environment not set up correctly! Expected environment " \
|
|
|
|
"variable '%s' to be set.", GST_CHECK_TEST_ENVIRONMENT_BEACON); \
|
|
|
|
} G_STMT_END
|
|
|
|
|
|
|
|
#else
|
|
|
|
#define GST_DO_CHECK_TEST_ENVIRONMENT /* nothing to check */
|
|
|
|
#endif
|
|
|
|
|
2007-08-13 13:33:07 +00:00
|
|
|
/**
|
|
|
|
* GST_START_TEST:
|
|
|
|
* @__testname: test function name
|
|
|
|
*
|
|
|
|
* wrapper for checks START_TEST
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* GST_END_TEST:
|
|
|
|
*
|
|
|
|
* wrapper for checks END_TEST
|
2005-07-09 16:36:18 +00:00
|
|
|
*/
|
|
|
|
#define GST_START_TEST(__testname) \
|
2016-02-12 14:12:43 +00:00
|
|
|
static void __testname (int G_GNUC_UNUSED __i__) \
|
2005-07-09 16:36:18 +00:00
|
|
|
{\
|
|
|
|
GST_DEBUG ("test start"); \
|
2015-04-23 14:54:08 +00:00
|
|
|
GST_DO_CHECK_TEST_ENVIRONMENT; \
|
2005-07-09 16:36:18 +00:00
|
|
|
tcase_fn_start (""# __testname, __FILE__, __LINE__);
|
|
|
|
|
2009-08-10 10:43:52 +00:00
|
|
|
#define GST_END_TEST GST_LOG ("cleaning up tasks"); \
|
|
|
|
gst_task_cleanup_all (); \
|
2009-08-08 20:27:06 +00:00
|
|
|
END_TEST
|
2005-07-09 16:36:18 +00:00
|
|
|
|
2005-08-20 20:15:53 +00:00
|
|
|
/* additional fail macros */
|
2007-06-14 11:56:44 +00:00
|
|
|
/**
|
|
|
|
* fail_unless_equals_int:
|
|
|
|
* @a: a #gint value or expression
|
|
|
|
* @b: a #gint value or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal and aborts if this is not the
|
|
|
|
* case, printing both expressions and the values they evaluated to. This
|
|
|
|
* macro is for use in unit tests.
|
|
|
|
*/
|
2011-11-11 16:17:43 +00:00
|
|
|
#define fail_unless_equals_int(a, b) \
|
|
|
|
G_STMT_START { \
|
|
|
|
int first = a; \
|
|
|
|
int second = b; \
|
|
|
|
fail_unless(first == second, \
|
|
|
|
"'" #a "' (%d) is not equal to '" #b"' (%d)", first, second); \
|
2005-08-20 20:15:53 +00:00
|
|
|
} G_STMT_END;
|
2007-06-14 11:56:44 +00:00
|
|
|
/**
|
|
|
|
* assert_equals_int:
|
|
|
|
* @a: a #gint value or expression
|
|
|
|
* @b: a #gint value or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal and aborts if this is not the
|
|
|
|
* case, printing both expressions and the values they evaluated to. This
|
|
|
|
* macro is for use in unit tests.
|
|
|
|
*/
|
2006-07-02 22:05:48 +00:00
|
|
|
#define assert_equals_int(a, b) fail_unless_equals_int(a, b)
|
2005-08-20 20:15:53 +00:00
|
|
|
|
2013-02-19 17:36:50 +00:00
|
|
|
/**
|
|
|
|
* fail_unless_equals_int_hex:
|
|
|
|
* @a: a #gint value or expression
|
|
|
|
* @b: a #gint value or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal and aborts if this is not the
|
|
|
|
* case, printing both expressions and the values they evaluated to in
|
|
|
|
* hexadecimal format. This macro is for use in unit tests.
|
|
|
|
*
|
|
|
|
* Since: 1.2
|
|
|
|
*/
|
|
|
|
#define fail_unless_equals_int_hex(a, b) \
|
|
|
|
G_STMT_START { \
|
|
|
|
int first = a; \
|
|
|
|
int second = b; \
|
|
|
|
fail_unless(first == second, \
|
|
|
|
"'" #a "' (0x%08x) is not equal to '" #b"' (0x%08x)", first, second);\
|
|
|
|
} G_STMT_END;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* assert_equals_int_hex:
|
|
|
|
* @a: a #gint value or expression
|
|
|
|
* @b: a #gint value or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal and aborts if this is not the
|
|
|
|
* case, printing both expressions and the values they evaluated to in
|
|
|
|
* hexadecimal format. This macro is for use in unit tests.
|
|
|
|
*
|
|
|
|
* Since: 1.2
|
|
|
|
*/
|
|
|
|
#define assert_equals_int_hex(a, b) fail_unless_equals_int_hex(a, b)
|
|
|
|
|
2011-05-24 14:13:58 +00:00
|
|
|
/**
|
|
|
|
* fail_unless_equals_int64:
|
|
|
|
* @a: a #gint64 value or expression
|
|
|
|
* @b: a #gint64 value or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal and aborts if this is not the
|
|
|
|
* case, printing both expressions and the values they evaluated to. This
|
|
|
|
* macro is for use in unit tests.
|
|
|
|
*/
|
2011-11-11 16:17:43 +00:00
|
|
|
#define fail_unless_equals_int64(a, b) \
|
|
|
|
G_STMT_START { \
|
|
|
|
gint64 first = a; \
|
|
|
|
gint64 second = b; \
|
|
|
|
fail_unless(first == second, \
|
|
|
|
"'" #a "' (%" G_GINT64_FORMAT") is not equal to '" #b"' (%" \
|
|
|
|
G_GINT64_FORMAT")", first, second); \
|
2011-05-24 14:13:58 +00:00
|
|
|
} G_STMT_END;
|
|
|
|
/**
|
|
|
|
* assert_equals_int64:
|
|
|
|
* @a: a #gint64 value or expression
|
|
|
|
* @b: a #gint64 value or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal and aborts if this is not the
|
|
|
|
* case, printing both expressions and the values they evaluated to. This
|
|
|
|
* macro is for use in unit tests.
|
|
|
|
*/
|
|
|
|
#define assert_equals_int64(a, b) fail_unless_equals_int64(a, b)
|
|
|
|
|
2013-02-19 17:36:50 +00:00
|
|
|
/**
|
|
|
|
* fail_unless_equals_int64_hex:
|
|
|
|
* @a: a #gint64 value or expression
|
|
|
|
* @b: a #gint64 value or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal and aborts if this is not the
|
|
|
|
* case, printing both expressions and the values they evaluated to in
|
|
|
|
* hexadecimal format. This macro is for use in unit tests.
|
|
|
|
*
|
|
|
|
* Since: 1.2
|
|
|
|
*/
|
|
|
|
#define fail_unless_equals_int64_hex(a, b) \
|
|
|
|
G_STMT_START { \
|
|
|
|
gint64 first = a; \
|
|
|
|
gint64 second = b; \
|
|
|
|
fail_unless(first == second, \
|
|
|
|
"'" #a "' (0x%016x) is not equal to '" #b"' (0x%016x)", first, second);\
|
|
|
|
} G_STMT_END;
|
|
|
|
/**
|
|
|
|
* assert_equals_int64_hex:
|
|
|
|
* @a: a #gint64 value or expression
|
|
|
|
* @b: a #gint64 value or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal and aborts if this is not the
|
|
|
|
* case, printing both expressions and the values they evaluated to in
|
|
|
|
* hexadecimal format. This macro is for use in unit tests.
|
|
|
|
*
|
|
|
|
* Since: 1.2
|
|
|
|
*/
|
|
|
|
#define assert_equals_int64_hex(a,b) fail_unless_equals_int64_hex(a,b)
|
|
|
|
|
2007-06-14 11:56:44 +00:00
|
|
|
/**
|
|
|
|
* fail_unless_equals_uint64:
|
|
|
|
* @a: a #guint64 value or expression
|
|
|
|
* @b: a #guint64 value or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal and aborts if this is not the
|
|
|
|
* case, printing both expressions and the values they evaluated to. This
|
|
|
|
* macro is for use in unit tests.
|
|
|
|
*/
|
2011-11-11 16:17:43 +00:00
|
|
|
#define fail_unless_equals_uint64(a, b) \
|
|
|
|
G_STMT_START { \
|
|
|
|
guint64 first = a; \
|
|
|
|
guint64 second = b; \
|
|
|
|
fail_unless(first == second, \
|
|
|
|
"'" #a "' (%" G_GUINT64_FORMAT ") is not equal to '" #b"' (%" \
|
|
|
|
G_GUINT64_FORMAT ")", first, second); \
|
2005-08-25 16:27:44 +00:00
|
|
|
} G_STMT_END;
|
2007-06-14 11:56:44 +00:00
|
|
|
/**
|
|
|
|
* assert_equals_uint64:
|
|
|
|
* @a: a #guint64 value or expression
|
|
|
|
* @b: a #guint64 value or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal and aborts if this is not the
|
|
|
|
* case, printing both expressions and the values they evaluated to. This
|
|
|
|
* macro is for use in unit tests.
|
|
|
|
*/
|
2006-07-02 22:05:48 +00:00
|
|
|
#define assert_equals_uint64(a, b) fail_unless_equals_uint64(a, b)
|
2005-08-25 16:27:44 +00:00
|
|
|
|
2013-02-19 17:36:50 +00:00
|
|
|
/**
|
|
|
|
* fail_unless_equals_uint64_hex:
|
|
|
|
* @a: a #gint64 value or expression
|
|
|
|
* @b: a #gint64 value or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal and aborts if this is not the
|
|
|
|
* case, printing both expressions and the values they evaluated to in
|
|
|
|
* hexadecimal format. This macro is for use in unit tests.
|
|
|
|
*
|
|
|
|
* Since: 1.2
|
|
|
|
*/
|
|
|
|
#define fail_unless_equals_uint64_hex(a, b) \
|
|
|
|
G_STMT_START { \
|
|
|
|
guint64 first = a; \
|
|
|
|
guint64 second = b; \
|
|
|
|
fail_unless(first == second, \
|
|
|
|
"'" #a "' (0x%016x) is not equal to '" #b"' (0x%016x)", first, second);\
|
|
|
|
} G_STMT_END;
|
|
|
|
/**
|
|
|
|
* assert_equals_uint64_hex:
|
|
|
|
* @a: a #guint64 value or expression
|
|
|
|
* @b: a #guint64 value or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal and aborts if this is not the
|
|
|
|
* case, printing both expressions and the values they evaluated to in
|
|
|
|
* hexadecimal format. This macro is for use in unit tests.
|
|
|
|
*
|
|
|
|
* Since: 1.2
|
|
|
|
*/
|
|
|
|
#define assert_equals_uint64_hex(a,b) fail_unless_equals_uint64_hex(a,b)
|
|
|
|
|
2007-06-14 11:56:44 +00:00
|
|
|
/**
|
|
|
|
* fail_unless_equals_string:
|
|
|
|
* @a: a string literal or expression
|
|
|
|
* @b: a string literal or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal (as per strcmp) and aborts if
|
|
|
|
* this is not the case, printing both expressions and the values they
|
|
|
|
* evaluated to. This macro is for use in unit tests.
|
|
|
|
*/
|
2006-08-15 18:29:22 +00:00
|
|
|
#define fail_unless_equals_string(a, b) \
|
|
|
|
G_STMT_START { \
|
|
|
|
const gchar * first = a; \
|
|
|
|
const gchar * second = b; \
|
2010-08-30 10:47:31 +00:00
|
|
|
fail_unless(g_strcmp0 (first, second) == 0, \
|
2006-08-15 18:29:22 +00:00
|
|
|
"'" #a "' (%s) is not equal to '" #b"' (%s)", first, second); \
|
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
|
|
|
} G_STMT_END;
|
2007-06-14 11:56:44 +00:00
|
|
|
/**
|
|
|
|
* assert_equals_string:
|
|
|
|
* @a: a string literal or expression
|
|
|
|
* @b: a string literal or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal (as per strcmp) and aborts if
|
|
|
|
* this is not the case, printing both expressions and the values they
|
|
|
|
* evaluated to. This macro is for use in unit tests.
|
|
|
|
*/
|
2006-07-02 22:05:48 +00:00
|
|
|
#define assert_equals_string(a, b) fail_unless_equals_string(a, b)
|
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
|
|
|
|
2007-06-14 11:56:44 +00:00
|
|
|
/**
|
|
|
|
* fail_unless_equals_float:
|
|
|
|
* @a: a #gdouble or #gfloat value or expression
|
|
|
|
* @b: a #gdouble or #gfloat value or expression
|
|
|
|
*
|
2007-06-14 15:56:03 +00:00
|
|
|
* This macro checks that @a and @b are (almost) equal and aborts if this
|
|
|
|
* is not the case, printing both expressions and the values they evaluated
|
|
|
|
* to. This macro is for use in unit tests.
|
2007-06-14 11:56:44 +00:00
|
|
|
*/
|
|
|
|
#define fail_unless_equals_float(a, b) \
|
|
|
|
G_STMT_START { \
|
|
|
|
double first = a; \
|
|
|
|
double second = b; \
|
2007-06-14 15:56:03 +00:00
|
|
|
/* This will only work for 'normal' values and values around 0, \
|
|
|
|
* which should be good enough for our purposes here */ \
|
|
|
|
fail_unless(fabs (first - second) < 0.0000001, \
|
|
|
|
"'" #a "' (%g) is not equal to '" #b "' (%g)", first, second);\
|
2007-06-14 11:56:44 +00:00
|
|
|
} G_STMT_END;
|
2007-06-14 15:56:03 +00:00
|
|
|
|
2007-06-14 11:56:44 +00:00
|
|
|
/**
|
|
|
|
* assert_equals_float:
|
|
|
|
* @a: a #gdouble or #gfloat value or expression
|
|
|
|
* @b: a #gdouble or #gfloat value or expression
|
|
|
|
*
|
2007-06-14 15:56:03 +00:00
|
|
|
* This macro checks that @a and @b are (almost) equal and aborts if this
|
|
|
|
* is not the case, printing both expressions and the values they evaluated
|
|
|
|
* to. This macro is for use in unit tests.
|
2007-06-14 11:56:44 +00:00
|
|
|
*/
|
|
|
|
#define assert_equals_float(a, b) fail_unless_equals_float(a, b)
|
|
|
|
|
2013-02-19 17:36:50 +00:00
|
|
|
/**
|
|
|
|
* fail_unless_equals_pointer:
|
|
|
|
* @a: a pointer value or expression
|
|
|
|
* @b: a pointer value or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal and aborts if this
|
|
|
|
* is not the case, printing both expressions and the values they
|
|
|
|
* evaluated to. This macro is for use in unit tests.
|
|
|
|
*
|
|
|
|
* Since: 1.2
|
|
|
|
*/
|
|
|
|
#define fail_unless_equals_pointer(a, b) \
|
|
|
|
G_STMT_START { \
|
|
|
|
gpointer first = a; \
|
|
|
|
gpointer second = b; \
|
|
|
|
fail_unless(first == second, \
|
|
|
|
"'" #a "' (%p) is not equal to '" #b "' (%p)", first, second);\
|
|
|
|
} G_STMT_END;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* assert_equals_pointer:
|
|
|
|
* @a: a pointer value or expression
|
|
|
|
* @b: a pointer value or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal and aborts if this
|
|
|
|
* is not the case, printing both expressions and the values they
|
|
|
|
* evaluated to. This macro is for use in unit tests.
|
|
|
|
*
|
|
|
|
* Since: 1.2
|
|
|
|
*/
|
|
|
|
#define assert_equals_pointer(a, b) fail_unless_equals_pointer(a, b)
|
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
|
|
|
|
2018-07-09 00:52:08 +00:00
|
|
|
/**
|
|
|
|
* fail_unless_equals_clocktime:
|
|
|
|
* @a: a #GstClockTime value or expression
|
|
|
|
* @b: a #GstClockTime value or expression
|
|
|
|
*
|
|
|
|
* This macro checks that @a and @b are equal and aborts if this is not the
|
|
|
|
* case, printing both expressions and the values they evaluated to. This
|
|
|
|
* macro is for use in unit tests.
|
|
|
|
*/
|
|
|
|
#define fail_unless_equals_clocktime(a, b) \
|
|
|
|
G_STMT_START { \
|
|
|
|
GstClockTime first = a; \
|
|
|
|
GstClockTime second = b; \
|
|
|
|
fail_unless(first == second, \
|
|
|
|
"'" #a "' (%" GST_TIME_FORMAT") is not equal to '" #b"' (%" GST_TIME_FORMAT")", \
|
|
|
|
GST_TIME_ARGS (first), GST_TIME_ARGS (second)); \
|
|
|
|
} G_STMT_END;
|
|
|
|
|
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
|
|
|
/***
|
|
|
|
* thread test macros and variables
|
|
|
|
*/
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API GList *thread_list;
|
|
|
|
GST_CHECK_API GMutex mutex;
|
|
|
|
GST_CHECK_API GCond start_cond; /* used to notify main thread of thread startups */
|
|
|
|
GST_CHECK_API GCond sync_cond; /* used to synchronize all threads and main thread */
|
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
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define MAIN_START_THREADS(count, function, data) \
|
|
|
|
MAIN_INIT(); \
|
|
|
|
MAIN_START_THREAD_FUNCTIONS(count, function, data); \
|
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
|
|
|
MAIN_SYNCHRONIZE();
|
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define MAIN_INIT() \
|
|
|
|
G_STMT_START { \
|
2014-07-06 11:12:20 +00:00
|
|
|
g_mutex_init (&mutex); \
|
|
|
|
g_cond_init (&start_cond); \
|
|
|
|
g_cond_init (&sync_cond); \
|
2011-11-11 16:17:43 +00:00
|
|
|
_gst_check_threads_running = 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
|
|
|
} G_STMT_END;
|
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define MAIN_START_THREAD_FUNCTIONS(count, function, data) \
|
|
|
|
G_STMT_START { \
|
|
|
|
int i; \
|
|
|
|
for (i = 0; i < count; ++i) { \
|
|
|
|
MAIN_START_THREAD_FUNCTION (i, function, data); \
|
|
|
|
} \
|
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
|
|
|
} G_STMT_END;
|
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define MAIN_START_THREAD_FUNCTION(i, function, data) \
|
|
|
|
G_STMT_START { \
|
|
|
|
GThread *thread = NULL; \
|
|
|
|
GST_DEBUG ("MAIN: creating thread %d", i); \
|
2012-09-12 10:22:53 +00:00
|
|
|
g_mutex_lock (&mutex); \
|
|
|
|
thread = g_thread_try_new ("gst-check", \
|
|
|
|
(GThreadFunc) function, data, NULL); \
|
2011-11-11 16:17:43 +00:00
|
|
|
/* wait for thread to signal us that it's ready */ \
|
|
|
|
GST_DEBUG ("MAIN: waiting for thread %d", i); \
|
2012-09-12 10:22:53 +00:00
|
|
|
g_cond_wait (&start_cond, &mutex); \
|
|
|
|
g_mutex_unlock (&mutex); \
|
2011-11-11 16:17:43 +00:00
|
|
|
\
|
|
|
|
thread_list = g_list_append (thread_list, thread); \
|
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
|
|
|
} G_STMT_END;
|
|
|
|
|
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define MAIN_SYNCHRONIZE() \
|
|
|
|
G_STMT_START { \
|
|
|
|
GST_DEBUG ("MAIN: synchronizing"); \
|
2012-09-12 10:22:53 +00:00
|
|
|
g_cond_broadcast (&sync_cond); \
|
2011-11-11 16:17:43 +00:00
|
|
|
GST_DEBUG ("MAIN: synchronized"); \
|
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
|
|
|
} G_STMT_END;
|
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define MAIN_STOP_THREADS() \
|
|
|
|
G_STMT_START { \
|
|
|
|
_gst_check_threads_running = FALSE; \
|
|
|
|
\
|
|
|
|
/* join all threads */ \
|
|
|
|
GST_DEBUG ("MAIN: joining"); \
|
|
|
|
g_list_foreach (thread_list, (GFunc) g_thread_join, NULL); \
|
|
|
|
g_list_free (thread_list); \
|
|
|
|
thread_list = NULL; \
|
2014-07-06 11:12:20 +00:00
|
|
|
g_mutex_clear (&mutex); \
|
|
|
|
g_cond_clear (&start_cond); \
|
|
|
|
g_cond_clear (&sync_cond); \
|
2011-11-11 16:17:43 +00:00
|
|
|
GST_DEBUG ("MAIN: joined"); \
|
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
|
|
|
} G_STMT_END;
|
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define THREAD_START() \
|
|
|
|
THREAD_STARTED(); \
|
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
|
|
|
THREAD_SYNCHRONIZE();
|
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define THREAD_STARTED() \
|
|
|
|
G_STMT_START { \
|
|
|
|
/* signal main thread that we started */ \
|
|
|
|
GST_DEBUG ("THREAD %p: started", g_thread_self ()); \
|
2012-09-12 10:22:53 +00:00
|
|
|
g_mutex_lock (&mutex); \
|
|
|
|
g_cond_signal (&start_cond); \
|
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
|
|
|
} G_STMT_END;
|
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define THREAD_SYNCHRONIZE() \
|
|
|
|
G_STMT_START { \
|
|
|
|
/* synchronize everyone */ \
|
|
|
|
GST_DEBUG ("THREAD %p: syncing", g_thread_self ()); \
|
2014-07-06 11:13:04 +00:00
|
|
|
fail_if (g_mutex_trylock (&mutex), \
|
|
|
|
"bug in unit test, mutex should be locked at this point");\
|
2012-09-12 10:22:53 +00:00
|
|
|
g_cond_wait (&sync_cond, &mutex); \
|
2011-11-11 16:17:43 +00:00
|
|
|
GST_DEBUG ("THREAD %p: synced", g_thread_self ()); \
|
2012-09-12 10:22:53 +00:00
|
|
|
g_mutex_unlock (&mutex); \
|
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
|
|
|
} G_STMT_END;
|
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define THREAD_SWITCH() \
|
|
|
|
G_STMT_START { \
|
|
|
|
/* a minimal sleep is a context switch */ \
|
|
|
|
g_usleep (1); \
|
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
|
|
|
} G_STMT_END;
|
|
|
|
|
2014-11-28 13:17:54 +00:00
|
|
|
#define THREAD_TEST_RUNNING() (!!_gst_check_threads_running)
|
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-07-09 16:36:18 +00:00
|
|
|
/* additional assertions */
|
2011-11-11 16:17:43 +00:00
|
|
|
#define ASSERT_CRITICAL(code) \
|
|
|
|
G_STMT_START { \
|
|
|
|
_gst_check_expecting_log = TRUE; \
|
|
|
|
_gst_check_raised_critical = FALSE; \
|
|
|
|
code; \
|
check: Apply GStreamer-specific patches
Reintroduced patches:
* Make sure that fail_if(1) actually fails
from commit 9f99d056a263e71a5e6181224829def906cf0226
New patches due to updated libcheck (based on 0.9.14):
* Checks in m4/check-checks.m4 to cater for new dependencies
* Conditional compile-time compat POSIX fallbacks for libcheck
* Avoid relative paths for libcheck header files
* Make timer_create() usage depend on posix timers, not librt
* Rely on default AX_PTHREAD behavior to allow HAVE_PTHREAD to be used
when checking for types and functions (like clock_gettime())
* Avoid double declaration of clock_gettime() when availabe outside of
librt by making compat clock_gettime() declaration conditional
* check 0.9.9 renamed _fail_unless() and 0.9.12 later renamed it again
to _ck_assert_failed(), so ASSERT_{CRITICAL,WARNING}() now calls this
function
* Remove libcheck fallback infrastructure for malloc(), realloc(),
gettimeofday() and snprintf() since either they appear to be
available or they introduce even more dependencies.
The result is an embedded check in gstreamer that has been tested by
running check tests in core, -base, -good, -bad, -ugly and rtsp-server
on Linux, OSX and Windows.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=727826
2014-11-15 12:26:47 +00:00
|
|
|
if (!_gst_check_raised_critical) \
|
|
|
|
_ck_assert_failed (__FILE__, __LINE__, \
|
|
|
|
"Expected g_critical, got nothing", NULL); \
|
2011-11-11 16:17:43 +00:00
|
|
|
_gst_check_expecting_log = 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
|
|
|
} G_STMT_END
|
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define ASSERT_WARNING(code) \
|
|
|
|
G_STMT_START { \
|
|
|
|
_gst_check_expecting_log = TRUE; \
|
|
|
|
_gst_check_raised_warning = FALSE; \
|
|
|
|
code; \
|
check: Apply GStreamer-specific patches
Reintroduced patches:
* Make sure that fail_if(1) actually fails
from commit 9f99d056a263e71a5e6181224829def906cf0226
New patches due to updated libcheck (based on 0.9.14):
* Checks in m4/check-checks.m4 to cater for new dependencies
* Conditional compile-time compat POSIX fallbacks for libcheck
* Avoid relative paths for libcheck header files
* Make timer_create() usage depend on posix timers, not librt
* Rely on default AX_PTHREAD behavior to allow HAVE_PTHREAD to be used
when checking for types and functions (like clock_gettime())
* Avoid double declaration of clock_gettime() when availabe outside of
librt by making compat clock_gettime() declaration conditional
* check 0.9.9 renamed _fail_unless() and 0.9.12 later renamed it again
to _ck_assert_failed(), so ASSERT_{CRITICAL,WARNING}() now calls this
function
* Remove libcheck fallback infrastructure for malloc(), realloc(),
gettimeofday() and snprintf() since either they appear to be
available or they introduce even more dependencies.
The result is an embedded check in gstreamer that has been tested by
running check tests in core, -base, -good, -bad, -ugly and rtsp-server
on Linux, OSX and Windows.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=727826
2014-11-15 12:26:47 +00:00
|
|
|
if (!_gst_check_raised_warning) \
|
|
|
|
_ck_assert_failed (__FILE__, __LINE__, \
|
|
|
|
"Expected g_warning, got nothing", NULL); \
|
2011-11-11 16:17:43 +00:00
|
|
|
_gst_check_expecting_log = FALSE; \
|
2005-09-09 14:34:43 +00:00
|
|
|
} G_STMT_END
|
|
|
|
|
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define ASSERT_OBJECT_REFCOUNT(object, name, value) \
|
|
|
|
G_STMT_START { \
|
|
|
|
int rc; \
|
|
|
|
rc = GST_OBJECT_REFCOUNT_VALUE (object); \
|
|
|
|
fail_unless (rc == value, \
|
|
|
|
"%s (%p) refcount is %d instead of %d", \
|
|
|
|
name, object, rc, value); \
|
2005-06-19 00:52:31 +00:00
|
|
|
} G_STMT_END
|
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define ASSERT_OBJECT_REFCOUNT_BETWEEN(object, name, lower, upper) \
|
|
|
|
G_STMT_START { \
|
|
|
|
int rc = GST_OBJECT_REFCOUNT_VALUE (object); \
|
|
|
|
int lo = lower; \
|
|
|
|
int hi = upper; \
|
|
|
|
\
|
|
|
|
fail_unless (rc >= lo, \
|
|
|
|
"%s (%p) refcount %d is smaller than %d", \
|
|
|
|
name, object, rc, lo); \
|
|
|
|
fail_unless (rc <= hi, \
|
|
|
|
"%s (%p) refcount %d is bigger than %d", \
|
|
|
|
name, object, rc, hi); \
|
2005-08-22 09:25:51 +00:00
|
|
|
} G_STMT_END
|
|
|
|
|
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define ASSERT_CAPS_REFCOUNT(caps, name, value) \
|
|
|
|
ASSERT_MINI_OBJECT_REFCOUNT(caps, name, value)
|
2005-07-11 18:41:49 +00:00
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define ASSERT_BUFFER_REFCOUNT(buffer, name, value) \
|
|
|
|
ASSERT_MINI_OBJECT_REFCOUNT(buffer, name, value)
|
2005-08-14 22:29:07 +00:00
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define ASSERT_MINI_OBJECT_REFCOUNT(miniobj, name, value) \
|
|
|
|
G_STMT_START { \
|
|
|
|
int rc; \
|
|
|
|
rc = GST_MINI_OBJECT_REFCOUNT_VALUE (miniobj); \
|
|
|
|
fail_unless (rc == value, \
|
2011-10-17 07:28:43 +00:00
|
|
|
name " (%p) refcount is %d instead of %d", miniobj, rc, value); \
|
2005-06-19 00:52:31 +00:00
|
|
|
} G_STMT_END
|
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define ASSERT_SET_STATE(element, state, ret) \
|
2015-02-19 11:17:15 +00:00
|
|
|
fail_unless (gst_element_set_state (GST_ELEMENT(element), \
|
2011-11-11 16:17:43 +00:00
|
|
|
state) == ret, \
|
2006-05-10 15:49:30 +00:00
|
|
|
"could not change state to " #state);
|
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
|
|
|
|
2011-11-11 16:17:43 +00:00
|
|
|
#define GST_CHECK_MAIN(name) \
|
|
|
|
int main (int argc, char **argv) \
|
|
|
|
{ \
|
2009-04-02 08:43:16 +00:00
|
|
|
Suite *s; \
|
2011-11-11 16:17:43 +00:00
|
|
|
gst_check_init (&argc, &argv); \
|
|
|
|
s = name ## _suite (); \
|
|
|
|
return gst_check_run_suite (s, # name, __FILE__); \
|
2006-07-01 20:54:25 +00:00
|
|
|
}
|
2007-01-12 12:48:25 +00:00
|
|
|
|
2007-10-16 16:12:36 +00:00
|
|
|
/* Hack to allow run-time selection of unit tests to run via the
|
2014-02-19 09:57:33 +00:00
|
|
|
* GST_CHECKS environment variable (test function names globs, comma
|
|
|
|
* separated), or GST_CHECKS_IGNORE with the same semantics */
|
2007-10-16 16:12:36 +00:00
|
|
|
|
2018-03-12 23:03:26 +00:00
|
|
|
GST_CHECK_API
|
2007-10-16 16:12:36 +00:00
|
|
|
gboolean _gst_check_run_test_func (const gchar * func_name);
|
|
|
|
|
2009-03-19 21:27:48 +00:00
|
|
|
static inline void
|
|
|
|
__gst_tcase_add_test (TCase * tc, TFun tf, const char * fname, int signal,
|
|
|
|
int allowed_exit_value, int start, int end)
|
|
|
|
{
|
2016-12-02 14:59:43 +00:00
|
|
|
if (_gst_check_list_tests) {
|
|
|
|
g_print ("Test: %s\n", fname);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_gst_check_run_test_func (fname)) {
|
|
|
|
_tcase_add_test (tc, tf, fname, signal, allowed_exit_value, start, end);
|
|
|
|
}
|
2009-03-19 21:27:48 +00:00
|
|
|
}
|
2007-10-16 16:12:36 +00:00
|
|
|
|
2007-12-20 09:20:27 +00:00
|
|
|
#define _tcase_add_test __gst_tcase_add_test
|
2007-10-16 16:12:36 +00:00
|
|
|
|
2016-12-02 14:59:43 +00:00
|
|
|
/* A special variant to add broken tests. These are normally skipped, but can be
|
2014-02-19 09:57:33 +00:00
|
|
|
* forced to run via GST_CHECKS */
|
2012-08-05 16:16:27 +00:00
|
|
|
#define tcase_skip_broken_test(chain,test_func) \
|
2013-04-17 23:19:23 +00:00
|
|
|
G_STMT_START { \
|
|
|
|
const char *env = g_getenv ("GST_CHECKS"); \
|
|
|
|
\
|
2014-02-19 09:57:33 +00:00
|
|
|
if (env != NULL && g_pattern_match_simple (env, G_STRINGIFY (test_func))) { \
|
2013-04-17 23:19:23 +00:00
|
|
|
tcase_add_test(chain,test_func); \
|
|
|
|
} else { \
|
2012-09-23 18:56:43 +00:00
|
|
|
g_printerr ("FIXME: skipping test %s because it's broken\n", G_STRINGIFY (test_func)); \
|
2013-04-17 23:19:23 +00:00
|
|
|
} \
|
|
|
|
} G_STMT_END
|
2012-08-05 16:16:27 +00:00
|
|
|
|
2016-02-04 14:16:41 +00:00
|
|
|
#define tcase_skip_broken_loop_test(chain,test_func,a,b) \
|
|
|
|
tcase_skip_broken_test (chain, test_func)
|
|
|
|
|
2007-01-12 12:48:25 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GST_CHECK_H__ */
|