mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-15 11:55:32 +00:00
validate-pad-monitor / runner: Check per-object reporting levels.
This commit is contained in:
parent
167c29125d
commit
0b1d00df25
3 changed files with 94 additions and 16 deletions
|
@ -234,19 +234,9 @@ _find_master_report_for_src_pad (GstValidatePadMonitor * pad_monitor,
|
|||
}
|
||||
|
||||
static GstValidateInterceptionReturn
|
||||
gst_validate_pad_monitor_intercept_report (GstValidateReporter *
|
||||
reporter, GstValidateReport * report)
|
||||
_concatenate_issues (GstValidatePadMonitor * pad_monitor,
|
||||
GstValidateReport * report)
|
||||
{
|
||||
GstValidateReporterInterface *iface_class, *old_iface_class;
|
||||
GstValidatePadMonitor *pad_monitor = GST_VALIDATE_PAD_MONITOR (reporter);
|
||||
|
||||
iface_class =
|
||||
G_TYPE_INSTANCE_GET_INTERFACE (reporter, GST_TYPE_VALIDATE_REPORTER,
|
||||
GstValidateReporterInterface);
|
||||
old_iface_class = g_type_interface_peek_parent (iface_class);
|
||||
|
||||
old_iface_class->intercept_report (reporter, report);
|
||||
|
||||
if (GST_PAD_IS_SINK (pad_monitor->pad)
|
||||
&& _find_master_report_for_sink_pad (pad_monitor, report))
|
||||
return GST_VALIDATE_REPORTER_KEEP;
|
||||
|
@ -257,6 +247,41 @@ gst_validate_pad_monitor_intercept_report (GstValidateReporter *
|
|||
return GST_VALIDATE_REPORTER_REPORT;
|
||||
}
|
||||
|
||||
static GstValidateInterceptionReturn
|
||||
gst_validate_pad_monitor_intercept_report (GstValidateReporter *
|
||||
reporter, GstValidateReport * report)
|
||||
{
|
||||
GstValidateReporterInterface *iface_class, *old_iface_class;
|
||||
GstValidatePadMonitor *pad_monitor = GST_VALIDATE_PAD_MONITOR (reporter);
|
||||
GstValidateReportingLevel monitor_reporting_level;
|
||||
GstValidateInterceptionReturn ret;
|
||||
|
||||
monitor_reporting_level =
|
||||
gst_validate_reporter_get_reporting_level (reporter);
|
||||
|
||||
iface_class =
|
||||
G_TYPE_INSTANCE_GET_INTERFACE (reporter, GST_TYPE_VALIDATE_REPORTER,
|
||||
GstValidateReporterInterface);
|
||||
old_iface_class = g_type_interface_peek_parent (iface_class);
|
||||
|
||||
old_iface_class->intercept_report (reporter, report);
|
||||
|
||||
switch (monitor_reporting_level) {
|
||||
case GST_VALIDATE_REPORTING_LEVEL_NONE:
|
||||
ret = GST_VALIDATE_REPORTER_DROP;
|
||||
break;
|
||||
case GST_VALIDATE_REPORTING_LEVEL_UNKNOWN:
|
||||
ret = _concatenate_issues (pad_monitor, report);
|
||||
break;
|
||||
default:
|
||||
ret = GST_VALIDATE_REPORTER_REPORT;
|
||||
break;
|
||||
}
|
||||
|
||||
gst_validate_report_set_reporting_level (report, monitor_reporting_level);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
debug_pending_event (GstPad * pad, GPtrArray * array)
|
||||
{
|
||||
|
|
|
@ -352,6 +352,8 @@ gst_validate_runner_add_report (GstValidateRunner * runner,
|
|||
|
||||
/* Let's use our own reporting strategy */
|
||||
if (reporter_level == GST_VALIDATE_REPORTING_LEVEL_UNKNOWN) {
|
||||
gst_validate_report_set_reporting_level (report,
|
||||
runner->priv->default_level);
|
||||
switch (runner->priv->default_level) {
|
||||
case GST_VALIDATE_REPORTING_LEVEL_NONE:
|
||||
return;
|
||||
|
|
|
@ -212,12 +212,11 @@ GST_START_TEST (test_global_levels)
|
|||
{
|
||||
GstValidateRunner *runner;
|
||||
|
||||
fail_unless (g_setenv ("GST_VALIDATE_REPORT_LEVEL", "none,fakesrc1:synthetic",
|
||||
TRUE));
|
||||
fail_unless (g_setenv ("GST_VALIDATE_REPORT_LEVEL", "none", TRUE));
|
||||
runner = gst_validate_runner_new ();
|
||||
_create_issues (runner);
|
||||
/* One issue should get through the none filter */
|
||||
fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 1);
|
||||
/* None shall pass */
|
||||
fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 0);
|
||||
g_object_unref (runner);
|
||||
|
||||
fail_unless (g_setenv ("GST_VALIDATE_REPORT_LEVEL", "synthetic", TRUE));
|
||||
|
@ -226,6 +225,57 @@ GST_START_TEST (test_global_levels)
|
|||
/* Two reports of the same type */
|
||||
fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 1);
|
||||
g_object_unref (runner);
|
||||
|
||||
fail_unless (g_setenv ("GST_VALIDATE_REPORT_LEVEL", "monitor", TRUE));
|
||||
runner = gst_validate_runner_new ();
|
||||
_create_issues (runner);
|
||||
/* One report for each pad monitor */
|
||||
fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 6);
|
||||
g_object_unref (runner);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_specific_levels)
|
||||
{
|
||||
GstValidateRunner *runner;
|
||||
|
||||
fail_unless (g_setenv ("GST_VALIDATE_REPORT_LEVEL", "none,fakesrc1:synthetic",
|
||||
TRUE));
|
||||
runner = gst_validate_runner_new ();
|
||||
_create_issues (runner);
|
||||
/* One issue should go through the none filter */
|
||||
fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 1);
|
||||
g_object_unref (runner);
|
||||
|
||||
fail_unless (g_setenv ("GST_VALIDATE_REPORT_LEVEL", "monitor,sink:none",
|
||||
TRUE));
|
||||
runner = gst_validate_runner_new ();
|
||||
_create_issues (runner);
|
||||
/* 5 issues because all pads will report their own issues separately, except
|
||||
* for the sink which will not report an issue */
|
||||
fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 5);
|
||||
g_object_unref (runner);
|
||||
|
||||
fail_unless (g_setenv ("GST_VALIDATE_REPORT_LEVEL", "subchain,sink:monitor",
|
||||
TRUE));
|
||||
runner = gst_validate_runner_new ();
|
||||
_create_issues (runner);
|
||||
/* 3 issues because both fake sources will have subsequent subchains of
|
||||
* issues, and the sink will report its issue separately */
|
||||
fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 3);
|
||||
g_object_unref (runner);
|
||||
|
||||
fail_unless (g_setenv ("GST_VALIDATE_REPORT_LEVEL",
|
||||
"synthetic,fakesrc1:subchain,fakesrc2:subchain,funnel*::src*:monitor",
|
||||
TRUE));
|
||||
runner = gst_validate_runner_new ();
|
||||
_create_issues (runner);
|
||||
/* 4 issues because the funnel sink issues will be concatenated with the
|
||||
* fakesrc issues, the funnel src will report its issue separately, and the
|
||||
* sink will not find a report immediately upstream */
|
||||
fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 4);
|
||||
g_object_unref (runner);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -241,6 +291,7 @@ gst_validate_suite (void)
|
|||
|
||||
tcase_add_test (tc_chain, test_report_levels);
|
||||
tcase_add_test (tc_chain, test_global_levels);
|
||||
tcase_add_test (tc_chain, test_specific_levels);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue