mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-05-11 02:44:48 +00:00
validate: Add a flags to issues
Currently those allow registering issue that: - Won't print backtrace as it is sometimes useless info - Will repeat the details even in smart mode
This commit is contained in:
parent
a12cb70422
commit
1a6f404c5d
5 changed files with 71 additions and 13 deletions
|
@ -901,12 +901,14 @@ gst_validate_ssim_finalize (GObject * object)
|
|||
static gpointer
|
||||
_register_issues (gpointer data)
|
||||
{
|
||||
gst_validate_issue_register (gst_validate_issue_new (SIMILARITY_ISSUE,
|
||||
gst_validate_issue_register (gst_validate_issue_new_full (SIMILARITY_ISSUE,
|
||||
"Compared images were not similar enough",
|
||||
"The images checker detected that the images"
|
||||
" it is comparing do not have the similarity"
|
||||
" level defined with min-avg-similarity or"
|
||||
" min-lowest-similarity", GST_VALIDATE_REPORT_LEVEL_CRITICAL));
|
||||
" min-lowest-similarity", GST_VALIDATE_REPORT_LEVEL_CRITICAL,
|
||||
GST_VALIDATE_ISSUE_FLAGS_FULL_DETAILS |
|
||||
GST_VALIDATE_ISSUE_FLAGS_NO_BACKTRACE));
|
||||
|
||||
gst_validate_issue_register (gst_validate_issue_new
|
||||
(SIMILARITY_ISSUE_WITH_PREVIOUS,
|
||||
|
|
|
@ -141,6 +141,45 @@ gst_validate_issue_get_id (GstValidateIssue * issue)
|
|||
return issue->issue_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_validate_issue_new_full:
|
||||
* @issue_id: The ID of the issue, should be a GQuark
|
||||
* @summary: A summary of the issue
|
||||
* @description: A more complete description of the issue
|
||||
* @default_level: The level at which the issue will be reported by default
|
||||
* @flags: The flags to determine behaviour of the issue
|
||||
*
|
||||
* Returns: (transfer full): The newly created #GstValidateIssue
|
||||
*/
|
||||
GstValidateIssue *
|
||||
gst_validate_issue_new_full (GstValidateIssueId issue_id, const gchar * summary,
|
||||
const gchar * description, GstValidateReportLevel default_level,
|
||||
GstValidateIssueFlags flags)
|
||||
{
|
||||
GstValidateIssue *issue;
|
||||
gchar **area_name = g_strsplit (g_quark_to_string (issue_id), "::", 2);
|
||||
|
||||
if (!(area_name[0] != NULL && area_name[1] != NULL && area_name[2] == NULL)) {
|
||||
g_warning ("Wrong issue ID: %s (should be in the form: area::name)",
|
||||
g_quark_to_string (issue_id));
|
||||
g_strfreev (area_name);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
issue = g_slice_new (GstValidateIssue);
|
||||
issue->issue_id = issue_id;
|
||||
issue->summary = g_strdup (summary);
|
||||
issue->description = g_strdup (description);
|
||||
issue->default_level = default_level;
|
||||
issue->area = area_name[0];
|
||||
issue->name = area_name[1];
|
||||
issue->flags = flags;
|
||||
|
||||
g_free (area_name);
|
||||
return issue;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_validate_issue_new:
|
||||
* @issue_id: The ID of the issue, should be a GQuark
|
||||
|
@ -172,6 +211,7 @@ gst_validate_issue_new (GstValidateIssueId issue_id, const gchar * summary,
|
|||
issue->default_level = default_level;
|
||||
issue->area = area_name[0];
|
||||
issue->name = area_name[1];
|
||||
issue->flags = GST_VALIDATE_ISSUE_FLAGS_NONE;
|
||||
|
||||
g_free (area_name);
|
||||
return issue;
|
||||
|
@ -739,10 +779,11 @@ gst_validate_report_new (GstValidateIssue * issue,
|
|||
reporter_details != GST_VALIDATE_SHOW_UNKNOWN)
|
||||
return report;
|
||||
|
||||
if (default_details == GST_VALIDATE_SHOW_ALL ||
|
||||
issue_type_details == GST_VALIDATE_SHOW_ALL ||
|
||||
gst_validate_report_check_abort (report) ||
|
||||
report->level == GST_VALIDATE_REPORT_LEVEL_CRITICAL)
|
||||
if ((default_details == GST_VALIDATE_SHOW_ALL ||
|
||||
issue_type_details == GST_VALIDATE_SHOW_ALL ||
|
||||
gst_validate_report_check_abort (report) ||
|
||||
report->level == GST_VALIDATE_REPORT_LEVEL_CRITICAL) &&
|
||||
(!(issue->flags & GST_VALIDATE_ISSUE_FLAGS_NO_BACKTRACE)))
|
||||
report->trace = gst_debug_get_stack_trace (GST_STACK_TRACE_SHOW_FULL);
|
||||
|
||||
return report;
|
||||
|
@ -1159,13 +1200,12 @@ gst_validate_report_printf (GstValidateReport * report)
|
|||
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 (tmp->data);
|
||||
}
|
||||
gst_validate_report_print_dotfile (report);
|
||||
gst_validate_report_print_trace (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");
|
||||
}
|
||||
|
|
|
@ -144,6 +144,12 @@ typedef enum {
|
|||
#define G_LOG_WARNING _QUARK("g-log::warning")
|
||||
#define G_LOG_CRITICAL _QUARK("g-log::critical")
|
||||
|
||||
typedef enum {
|
||||
GST_VALIDATE_ISSUE_FLAGS_NONE = 0,
|
||||
GST_VALIDATE_ISSUE_FLAGS_FULL_DETAILS = 1 << 0,
|
||||
GST_VALIDATE_ISSUE_FLAGS_NO_BACKTRACE = 1 << 1,
|
||||
} GstValidateIssueFlags;
|
||||
|
||||
typedef struct {
|
||||
GstValidateIssueId issue_id;
|
||||
|
||||
|
@ -168,6 +174,8 @@ typedef struct {
|
|||
|
||||
gint refcount;
|
||||
|
||||
GstValidateIssueFlags flags;
|
||||
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
|
||||
} GstValidateIssue;
|
||||
|
@ -239,6 +247,10 @@ GstValidateIssue *gst_validate_issue_new (GstValidateIssueId issue_id, const gc
|
|||
const gchar * description,
|
||||
GstValidateReportLevel default_level);
|
||||
GST_VALIDATE_API
|
||||
GstValidateIssue* gst_validate_issue_new_full(GstValidateIssueId issue_id, const gchar* summary,
|
||||
const gchar* description, GstValidateReportLevel default_level,
|
||||
GstValidateIssueFlags flags);
|
||||
GST_VALIDATE_API
|
||||
void gst_validate_issue_set_default_level (GstValidateIssue *issue,
|
||||
GstValidateReportLevel default_level);
|
||||
|
||||
|
|
|
@ -225,10 +225,13 @@ gst_validate_report_valist (GstValidateReporter * reporter,
|
|||
if (runner)
|
||||
runner_level = gst_validate_runner_get_default_reporting_level (runner);
|
||||
|
||||
if (reporter_level == GST_VALIDATE_SHOW_ALL ||
|
||||
(runner_level == GST_VALIDATE_SHOW_ALL &&
|
||||
reporter_level == GST_VALIDATE_SHOW_UNKNOWN))
|
||||
if ((reporter_level == GST_VALIDATE_SHOW_ALL ||
|
||||
(runner_level == GST_VALIDATE_SHOW_ALL &&
|
||||
reporter_level == GST_VALIDATE_SHOW_UNKNOWN)) ||
|
||||
(issue->flags & GST_VALIDATE_ISSUE_FLAGS_FULL_DETAILS)) {
|
||||
|
||||
gst_validate_report_add_repeated_report (prev_report, report);
|
||||
}
|
||||
|
||||
gst_validate_report_unref (report);
|
||||
goto done;
|
||||
|
|
|
@ -27,6 +27,7 @@ EXPORTS
|
|||
gst_validate_issue_get_id
|
||||
gst_validate_issue_get_type
|
||||
gst_validate_issue_new
|
||||
gst_validate_issue_new_full
|
||||
gst_validate_issue_register
|
||||
gst_validate_issue_set_default_level
|
||||
gst_validate_list_scenarios
|
||||
|
|
Loading…
Reference in a new issue