mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-18 20:25:25 +00:00
validate-report / reporter: rework the way we repeat issues.
+ runner: update reports count algorithm.
This commit is contained in:
parent
5690a02e0a
commit
c542d9c6bc
5 changed files with 59 additions and 13 deletions
|
@ -80,7 +80,6 @@ gst_validate_issue_new (GstValidateIssueId issue_id, const gchar * summary,
|
|||
issue->summary = g_strdup (summary);
|
||||
issue->description = g_strdup (description);
|
||||
issue->default_level = default_level;
|
||||
issue->repeat = FALSE;
|
||||
|
||||
return issue;
|
||||
}
|
||||
|
@ -450,6 +449,8 @@ gst_validate_report_unref (GstValidateReport * report)
|
|||
g_free (report->message);
|
||||
g_list_free_full (report->shadow_reports,
|
||||
(GDestroyNotify) gst_validate_report_unref);
|
||||
g_list_free_full (report->repeated_reports,
|
||||
(GDestroyNotify) gst_validate_report_unref);
|
||||
g_slice_free (GstValidateReport, report);
|
||||
g_mutex_clear (&report->shadow_reports_lock);
|
||||
}
|
||||
|
@ -690,9 +691,16 @@ gst_validate_report_print_description (GstValidateReport * report)
|
|||
void
|
||||
gst_validate_report_printf (GstValidateReport * report)
|
||||
{
|
||||
GList *tmp;
|
||||
|
||||
gst_validate_report_print_level (report);
|
||||
gst_validate_report_print_detected_on (report);
|
||||
gst_validate_report_print_details (report);
|
||||
|
||||
for (tmp = report->repeated_reports; tmp; tmp = tmp->next) {
|
||||
gst_validate_report_print_details (report);
|
||||
}
|
||||
|
||||
gst_validate_report_print_description (report);
|
||||
gst_validate_printf (NULL, "\n");
|
||||
}
|
||||
|
@ -703,3 +711,12 @@ gst_validate_report_set_reporting_level (GstValidateReport * report,
|
|||
{
|
||||
report->reporting_level = level;
|
||||
}
|
||||
|
||||
void
|
||||
gst_validate_report_add_repeated_report (GstValidateReport * report,
|
||||
GstValidateReport * repeated_report)
|
||||
{
|
||||
report->repeated_reports =
|
||||
g_list_append (report->repeated_reports,
|
||||
gst_validate_report_ref (repeated_report));
|
||||
}
|
||||
|
|
|
@ -144,9 +144,6 @@ typedef struct {
|
|||
* issue. */
|
||||
GstValidateReportLevel default_level;
|
||||
|
||||
/* repeat: whether the issue might be triggered
|
||||
* multiple times but only remembered once */
|
||||
gboolean repeat;
|
||||
} GstValidateIssue;
|
||||
|
||||
#define GST_VALIDATE_ISSUE_AREA(i) (GST_VALIDATE_ISSUE_ID_AREA (gst_validate_issue_get_id (i)))
|
||||
|
@ -177,6 +174,9 @@ struct _GstValidateReport {
|
|||
GstValidateReport *master_report;
|
||||
GList *shadow_reports;
|
||||
|
||||
/* Lists the reports that were repeated inside the same reporter */
|
||||
GList *repeated_reports;
|
||||
|
||||
GstValidateReportingLevel reporting_level;
|
||||
};
|
||||
|
||||
|
@ -227,6 +227,7 @@ void gst_validate_printf_valist (gpointer source,
|
|||
gboolean gst_validate_report_should_print (GstValidateReport * report);
|
||||
gboolean gst_validate_report_set_master_report(GstValidateReport *report, GstValidateReport *master_report);
|
||||
void gst_validate_report_set_reporting_level (GstValidateReport *report, GstValidateReportingLevel level);
|
||||
void gst_validate_report_add_repeated_report (GstValidateReport *report, GstValidateReport *repeated_report);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ void
|
|||
gst_validate_report_valist (GstValidateReporter * reporter,
|
||||
GstValidateIssueId issue_id, const gchar * format, va_list var_args)
|
||||
{
|
||||
GstValidateReport *report;
|
||||
GstValidateReport *report, *prev_report;
|
||||
gchar *message, *combo;
|
||||
va_list vacopy;
|
||||
GstValidateIssue *issue;
|
||||
|
@ -168,15 +168,25 @@ gst_validate_report_valist (GstValidateReporter * reporter,
|
|||
return;
|
||||
}
|
||||
|
||||
if (issue->repeat == FALSE) {
|
||||
GstValidateIssueId issue_id = gst_validate_issue_get_id (issue);
|
||||
prev_report = g_hash_table_lookup (priv->reports, (gconstpointer) issue_id);
|
||||
|
||||
if (g_hash_table_lookup (priv->reports, (gconstpointer) issue_id)) {
|
||||
GST_DEBUG ("Report \"%" G_GUINTPTR_FORMAT ":%s\" already present",
|
||||
issue_id, issue->summary);
|
||||
gst_validate_report_unref (report);
|
||||
return;
|
||||
}
|
||||
if (prev_report) {
|
||||
GstValidateReportingLevel reporter_level =
|
||||
gst_validate_reporter_get_reporting_level (reporter);
|
||||
GstValidateReportingLevel runner_level =
|
||||
GST_VALIDATE_REPORTING_LEVEL_UNKNOWN;
|
||||
|
||||
if (priv->runner)
|
||||
runner_level =
|
||||
gst_validate_runner_get_default_reporting_level (priv->runner);
|
||||
|
||||
if (reporter_level == GST_VALIDATE_REPORTING_LEVEL_ALL ||
|
||||
(runner_level == GST_VALIDATE_REPORTING_LEVEL_ALL &&
|
||||
reporter_level == GST_VALIDATE_REPORTING_LEVEL_UNKNOWN))
|
||||
gst_validate_report_add_repeated_report (prev_report, report);
|
||||
|
||||
gst_validate_report_unref (report);
|
||||
return;
|
||||
}
|
||||
|
||||
GST_VALIDATE_REPORTER_REPORTS_LOCK (reporter);
|
||||
|
|
|
@ -384,12 +384,15 @@ gst_validate_runner_add_report (GstValidateRunner * runner,
|
|||
guint
|
||||
gst_validate_runner_get_reports_count (GstValidateRunner * runner)
|
||||
{
|
||||
GList *tmp;
|
||||
guint l;
|
||||
|
||||
g_return_val_if_fail (runner != NULL, 0);
|
||||
|
||||
GST_VALIDATE_RUNNER_LOCK (runner);
|
||||
l = g_list_length (runner->priv->reports);
|
||||
for (tmp = runner->priv->reports; tmp; tmp = tmp->next)
|
||||
l += g_list_length (((GstValidateReport *) tmp->data)->repeated_reports);
|
||||
l += g_hash_table_size (runner->priv->reports_by_type);
|
||||
GST_VALIDATE_RUNNER_UNLOCK (runner);
|
||||
|
||||
|
|
|
@ -232,6 +232,13 @@ GST_START_TEST (test_global_levels)
|
|||
/* One report for each pad monitor */
|
||||
fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 6);
|
||||
g_object_unref (runner);
|
||||
|
||||
fail_unless (g_setenv ("GST_VALIDATE_REPORT_LEVEL", "all", TRUE));
|
||||
runner = gst_validate_runner_new ();
|
||||
_create_issues (runner);
|
||||
/* One report for each pad monitor, plus one for funnel src and fakesink sink */
|
||||
fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 8);
|
||||
g_object_unref (runner);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
@ -276,6 +283,14 @@ GST_START_TEST (test_specific_levels)
|
|||
* sink will not find a report immediately upstream */
|
||||
fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 4);
|
||||
g_object_unref (runner);
|
||||
|
||||
fail_unless (g_setenv ("GST_VALIDATE_REPORT_LEVEL", "none,fakesink*:all",
|
||||
TRUE));
|
||||
runner = gst_validate_runner_new ();
|
||||
_create_issues (runner);
|
||||
/* 2 issues repeated on the fakesink's sink */
|
||||
fail_unless_equals_int (gst_validate_runner_get_reports_count (runner), 2);
|
||||
g_object_unref (runner);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
|
Loading…
Reference in a new issue