mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
check: Allow listing unit tests names
Adding options while running gst_check_init https://bugzilla.gnome.org/show_bug.cgi?id=775540
This commit is contained in:
parent
1bfd04a5fe
commit
f7255f318f
2 changed files with 42 additions and 8 deletions
|
@ -60,6 +60,7 @@ gboolean _gst_check_debug = FALSE;
|
|||
gboolean _gst_check_raised_critical = FALSE;
|
||||
gboolean _gst_check_raised_warning = FALSE;
|
||||
gboolean _gst_check_expecting_log = FALSE;
|
||||
gboolean _gst_check_list_tests = FALSE;
|
||||
|
||||
static void gst_check_log_message_func
|
||||
(const gchar * log_domain, GLogLevelFlags log_level,
|
||||
|
@ -118,13 +119,40 @@ print_plugins (void)
|
|||
gst_plugin_list_free (plugins);
|
||||
}
|
||||
|
||||
/* initialize GStreamer testing */
|
||||
/* gst_check_init:
|
||||
* @argc: (inout) (allow-none): pointer to application's argc
|
||||
* @argv: (inout) (array length=argc) (allow-none): pointer to application's argv
|
||||
*
|
||||
* Tnitialize GStreamer testing
|
||||
*
|
||||
* NOTE: Needs to be called before creating the testsuite
|
||||
* so that the tests can be listed.
|
||||
* */
|
||||
void
|
||||
gst_check_init (int *argc, char **argv[])
|
||||
{
|
||||
guint timeout_multiplier = 1;
|
||||
GOptionContext *ctx;
|
||||
GError *err = NULL;
|
||||
GOptionEntry options[] = {
|
||||
{"list-tests", 'l', 0, G_OPTION_ARG_NONE, &_gst_check_list_tests,
|
||||
"List tests present in the testsuite", NULL},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
gst_init (argc, argv);
|
||||
ctx = g_option_context_new ("gst-check");
|
||||
g_option_context_add_main_entries (ctx, options, NULL);
|
||||
g_option_context_add_group (ctx, gst_init_get_option_group ());
|
||||
|
||||
if (!g_option_context_parse (ctx, argc, argv, &err)) {
|
||||
if (err)
|
||||
g_printerr ("Error initializing: %s\n", GST_STR_NULL (err->message));
|
||||
else
|
||||
g_printerr ("Error initializing: Unknown error!\n");
|
||||
g_clear_error (&err);
|
||||
g_option_context_free (ctx);
|
||||
}
|
||||
g_option_context_free (ctx);
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (check_debug, "check", 0, "check regression tests");
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ extern gboolean _gst_check_threads_running;
|
|||
extern gboolean _gst_check_raised_critical;
|
||||
extern gboolean _gst_check_raised_warning;
|
||||
extern gboolean _gst_check_expecting_log;
|
||||
extern gboolean _gst_check_list_tests;
|
||||
|
||||
/* global variables used in test methods */
|
||||
extern GList * buffers;
|
||||
|
@ -83,9 +84,9 @@ GstPad *gst_check_setup_sink_pad (GstElement * element,
|
|||
GstStaticPadTemplate * tmpl);
|
||||
GstPad *gst_check_setup_sink_pad_from_template (GstElement * element,
|
||||
GstPadTemplate * tmpl);
|
||||
GstPad * gst_check_setup_sink_pad_by_name (GstElement * element,
|
||||
GstPad * gst_check_setup_sink_pad_by_name (GstElement * element,
|
||||
GstStaticPadTemplate * tmpl, const gchar *name);
|
||||
GstPad * gst_check_setup_sink_pad_by_name_from_template (GstElement * element,
|
||||
GstPad * gst_check_setup_sink_pad_by_name_from_template (GstElement * element,
|
||||
GstPadTemplate * tmpl, const gchar *name);
|
||||
void gst_check_teardown_pad_by_name (GstElement * element, const gchar *name);
|
||||
void gst_check_teardown_src_pad (GstElement * element);
|
||||
|
@ -601,14 +602,19 @@ static inline void
|
|||
__gst_tcase_add_test (TCase * tc, TFun tf, const char * fname, int signal,
|
||||
int allowed_exit_value, int start, int end)
|
||||
{
|
||||
if (_gst_check_run_test_func (fname)) {
|
||||
_tcase_add_test (tc, tf, fname, signal, allowed_exit_value, start, end);
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
#define _tcase_add_test __gst_tcase_add_test
|
||||
|
||||
/* A special variant to add broken tests. These are normally skipped, but can be
|
||||
/* A special variant to add broken tests. These are normally skipped, but can be
|
||||
* forced to run via GST_CHECKS */
|
||||
#define tcase_skip_broken_test(chain,test_func) \
|
||||
G_STMT_START { \
|
||||
|
|
Loading…
Reference in a new issue