mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
tests: leaks: Allow null tracer string if there's no available stack trace
In case that no available stack tracer, leak tracer will set null string value for `trace` field. I would likely happen on Windows. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/625>
This commit is contained in:
parent
f120ad0012
commit
7d12aa07d4
1 changed files with 11 additions and 2 deletions
|
@ -224,6 +224,13 @@ GST_START_TEST (test_get_live_objects_filtered_detailed)
|
||||||
GstPad *srcpad;
|
GstPad *srcpad;
|
||||||
GstMessage *m;
|
GstMessage *m;
|
||||||
struct RetBufferCtx *ctx = g_new0 (struct RetBufferCtx, 1);
|
struct RetBufferCtx *ctx = g_new0 (struct RetBufferCtx, 1);
|
||||||
|
gboolean check_trace = FALSE;
|
||||||
|
|
||||||
|
#if defined (HAVE_BACKTRACE) || defined (HAVE_UNWIND) || defined (HAVE_DBGHELP)
|
||||||
|
/* Otherwise, trace string (returned from gst_debug_get_stack_trace())
|
||||||
|
* will be null */
|
||||||
|
check_trace = TRUE;
|
||||||
|
#endif
|
||||||
|
|
||||||
pipe = gst_pipeline_new ("pipeline");
|
pipe = gst_pipeline_new ("pipeline");
|
||||||
fail_unless (pipe);
|
fail_unless (pipe);
|
||||||
|
@ -286,7 +293,8 @@ GST_START_TEST (test_get_live_objects_filtered_detailed)
|
||||||
fail_unless_equals_int (ref_count, 1);
|
fail_unless_equals_int (ref_count, 1);
|
||||||
|
|
||||||
fail_unless (gst_structure_has_field_typed (s, "trace", G_TYPE_STRING));
|
fail_unless (gst_structure_has_field_typed (s, "trace", G_TYPE_STRING));
|
||||||
fail_unless (gst_structure_get_string (s, "trace"));
|
if (check_trace)
|
||||||
|
fail_unless (gst_structure_get_string (s, "trace"));
|
||||||
|
|
||||||
fail_unless (gst_structure_has_field_typed (s, "ref-infos",
|
fail_unless (gst_structure_has_field_typed (s, "ref-infos",
|
||||||
GST_TYPE_LIST));
|
GST_TYPE_LIST));
|
||||||
|
@ -312,7 +320,8 @@ GST_START_TEST (test_get_live_objects_filtered_detailed)
|
||||||
fail_unless (ref_count > 0);
|
fail_unless (ref_count > 0);
|
||||||
|
|
||||||
fail_unless (gst_structure_has_field_typed (r, "trace", G_TYPE_STRING));
|
fail_unless (gst_structure_has_field_typed (r, "trace", G_TYPE_STRING));
|
||||||
fail_unless (gst_structure_get_string (r, "trace"));
|
if (check_trace)
|
||||||
|
fail_unless (gst_structure_get_string (r, "trace"));
|
||||||
|
|
||||||
fail_unless_equals_int (gst_structure_n_fields (r), 4);
|
fail_unless_equals_int (gst_structure_n_fields (r), 4);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue