GstValidate doesn't use fatal-criticals by default
GST_VALIDATE.
This environment variable can be set to a list of debug options, which cause GstValidate to print out different types of test result information and consider differently the level of the reported issues.
fatal-criticals
: Causes GstValidate to consider only critical issues as import enough to consider the test failed (default behaviour)- [...]
print-issues
: Causes GstValidate to print issue, warning and critical issues in the final reports (default behaviour)
Experimentation shows however that GstValidate is not applying fatal-criticals
by default.
Further, looking into the code, these flags are stored in _gst_validate_flags
. When encountering the GST_VALIDATE
environment variable, it is set here, which is the only writing usage in the code:
var = g_getenv ("GST_VALIDATE");
if (var && strlen (var) > 0) {
_gst_validate_flags =
g_parse_debug_string (var, keys, G_N_ELEMENTS (keys));
}
If that code is not run (for instance, if GST_VALIDATE
is not set), _gst_validate_flag
retains the value it was initialized with:
static GstValidateDebugFlags _gst_validate_flags = 0;
These are the flag values:
typedef enum {
GST_VALIDATE_FATAL_DEFAULT = 0,
GST_VALIDATE_FATAL_ISSUES = 1 << 0,
GST_VALIDATE_FATAL_WARNINGS = 1 << 1,
GST_VALIDATE_FATAL_CRITICALS = 1 << 2,
GST_VALIDATE_PRINT_ISSUES = 1 << 3,
GST_VALIDATE_PRINT_WARNINGS = 1 << 4,
GST_VALIDATE_PRINT_CRITICALS = 1 << 5
} GstValidateDebugFlags;
This seems to contradict the documentation. In the case of print-issues
, which is considered default behavior, this is handled as an special case, see:
gboolean
gst_validate_report_should_print (GstValidateReport * report)
{
if ((!(_gst_validate_flags & GST_VALIDATE_PRINT_ISSUES) &&
!(_gst_validate_flags & GST_VALIDATE_PRINT_WARNINGS) &&
!(_gst_validate_flags & GST_VALIDATE_PRINT_CRITICALS))) {
return TRUE;
}
if ((report->level <= GST_VALIDATE_REPORT_LEVEL_ISSUE &&
_gst_validate_flags & GST_VALIDATE_PRINT_ISSUES) ||
(report->level <= GST_VALIDATE_REPORT_LEVEL_WARNING &&
_gst_validate_flags & GST_VALIDATE_PRINT_WARNINGS) ||
(report->level <= GST_VALIDATE_REPORT_LEVEL_CRITICAL &&
_gst_validate_flags & GST_VALIDATE_PRINT_CRITICALS)) {
return TRUE;
}
return FALSE;
}
When no print-*
flags are set, gst_validate_report_should_print()
returns TRUE, which would indeed print issues.
On the other hand, there is no matching special code for fatal-criticals
. See:
gboolean
gst_validate_report_check_abort (GstValidateReport * report)
{
if ((report->level <= GST_VALIDATE_REPORT_LEVEL_ISSUE &&
_gst_validate_flags & GST_VALIDATE_FATAL_ISSUES) ||
(report->level <= GST_VALIDATE_REPORT_LEVEL_WARNING &&
_gst_validate_flags & GST_VALIDATE_FATAL_WARNINGS) ||
(report->level <= GST_VALIDATE_REPORT_LEVEL_CRITICAL &&
_gst_validate_flags & GST_VALIDATE_FATAL_CRITICALS)) {
return TRUE;
}
return FALSE;
}
If _gst_validate_flags == 0
, the above function will provably return FALSE in every case, therefore never aborting on criticals.
I heavily suspect this is an oversight, as tests not failing on criticals would lead to more awkward failures down the line. Furthermore, this often turns tests with critical issues into timeouts.