From b7e7148a4c164ed575da0088ef8e9cc1ac847e6d Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Tue, 12 Jul 2005 09:41:00 +0000 Subject: [PATCH] check/Makefile.am: instate more valgrindable tests Original commit message from CVS: 2005-07-12 Thomas Vander Stichele * check/Makefile.am: instate more valgrindable tests * check/elements/gstfakesrc.c: (chain_func), (event_func), (GST_START_TEST), (fakesrc_suite): * check/gst/gstpad.c: (GST_START_TEST): * check/gst/gststructure.c: (GST_START_TEST): fix test leaks * docs/gst/tmpl/gstminiobject.sgml: * gst/gstpad.c: (gst_pad_finalize): fix the static mutex leak --- ChangeLog | 13 +++++++++++++ check/Makefile.am | 3 --- check/elements/gstfakesrc.c | 9 +++++++++ check/gst/gstpad.c | 11 +++++++++++ check/gst/gststructure.c | 3 +++ docs/gst/tmpl/gstminiobject.sgml | 2 -- gst/gstpad.c | 1 + tests/check/Makefile.am | 3 --- tests/check/elements/gstfakesrc.c | 9 +++++++++ tests/check/gst/gstpad.c | 11 +++++++++++ tests/check/gst/gststructure.c | 3 +++ 11 files changed, 60 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e95c24685..61f04abf9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-07-12 Thomas Vander Stichele + + * check/Makefile.am: + instate more valgrindable tests + * check/elements/gstfakesrc.c: (chain_func), (event_func), + (GST_START_TEST), (fakesrc_suite): + * check/gst/gstpad.c: (GST_START_TEST): + * check/gst/gststructure.c: (GST_START_TEST): + fix test leaks + * docs/gst/tmpl/gstminiobject.sgml: + * gst/gstpad.c: (gst_pad_finalize): + fix the static mutex leak + 2005-07-11 Thomas Vander Stichele * check/Makefile.am: diff --git a/check/Makefile.am b/check/Makefile.am index c870af4153..4271ee1890 100644 --- a/check/Makefile.am +++ b/check/Makefile.am @@ -70,11 +70,8 @@ gst_libs_gdp_CFLAGS = $(AM_CFLAGS) -DGST_ENABLE_NEW TESTS_TO_FIX = \ gst/gstghostpad \ gst/gstiterator \ - gst/gstpad \ gst/gstsystemclock \ - gst/gststructure \ gst/gsttag \ - elements/gstfakesrc \ pipelines/cleanup \ pipelines/simple_launch_lines \ gst-libs/gdp diff --git a/check/elements/gstfakesrc.c b/check/elements/gstfakesrc.c index bcd9d1def9..85be97f142 100644 --- a/check/elements/gstfakesrc.c +++ b/check/elements/gstfakesrc.c @@ -49,9 +49,11 @@ event_func (GstPad * pad, GstEvent * event) GST_STREAM_LOCK (pad); have_eos = TRUE; GST_STREAM_UNLOCK (pad); + gst_event_unref (event); return TRUE; } + gst_event_unref (event); return FALSE; } @@ -93,6 +95,13 @@ GST_START_TEST (test_num_buffers) fail_unless (g_list_length (buffers) == 3); g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); g_list_free (buffers); + + /* cleanup */ + fail_unless (gst_element_set_state (src, GST_STATE_NULL) == GST_STATE_SUCCESS, + "could not set to null"); + + gst_object_unref (src); + gst_object_unref (sinkpad); } GST_END_TEST; diff --git a/check/gst/gstpad.c b/check/gst/gstpad.c index 7ae7a2b9c2..5283c20805 100644 --- a/check/gst/gstpad.c +++ b/check/gst/gstpad.c @@ -31,21 +31,32 @@ GST_START_TEST (test_link) src = gst_pad_new ("source", GST_PAD_SRC); fail_if (src == NULL); + ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); name = gst_pad_get_name (src); fail_unless (strcmp (name, "source") == 0); + ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); + g_free (name); sink = gst_pad_new ("sink", GST_PAD_SINK); fail_if (sink == NULL); /* linking without templates or caps should fail */ ret = gst_pad_link (src, sink); + ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); + ASSERT_OBJECT_REFCOUNT (sink, "sink pad", 1); fail_unless (ret == GST_PAD_LINK_NOFORMAT); ASSERT_CRITICAL (gst_pad_get_pad_template (NULL)); srct = gst_pad_get_pad_template (src); fail_unless (srct == NULL); + ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); + + /* clean up */ + ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); + gst_object_unref (src); + gst_object_unref (sink); } GST_END_TEST; diff --git a/check/gst/gststructure.c b/check/gst/gststructure.c index 93c8cc03aa..06a1102ae7 100644 --- a/check/gst/gststructure.c +++ b/check/gst/gststructure.c @@ -60,6 +60,9 @@ GST_START_TEST (test_from_string_int) fail_unless (value == results[i], "Value %d is not the expected result %d for string %s", value, results[i], s); + + /* cleanup */ + gst_structure_free (structure); } } diff --git a/docs/gst/tmpl/gstminiobject.sgml b/docs/gst/tmpl/gstminiobject.sgml index 96f37adb5b..5481e39aaa 100644 --- a/docs/gst/tmpl/gstminiobject.sgml +++ b/docs/gst/tmpl/gstminiobject.sgml @@ -9,13 +9,11 @@ GstMiniObject - - diff --git a/gst/gstpad.c b/gst/gstpad.c index 1abc6d93e1..811e906f19 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -270,6 +270,7 @@ gst_pad_finalize (GObject * object) if (pad->stream_rec_lock) { g_static_rec_mutex_free (pad->stream_rec_lock); + g_free (pad->stream_rec_lock); pad->stream_rec_lock = NULL; } if (pad->preroll_lock) { diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index c870af4153..4271ee1890 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -70,11 +70,8 @@ gst_libs_gdp_CFLAGS = $(AM_CFLAGS) -DGST_ENABLE_NEW TESTS_TO_FIX = \ gst/gstghostpad \ gst/gstiterator \ - gst/gstpad \ gst/gstsystemclock \ - gst/gststructure \ gst/gsttag \ - elements/gstfakesrc \ pipelines/cleanup \ pipelines/simple_launch_lines \ gst-libs/gdp diff --git a/tests/check/elements/gstfakesrc.c b/tests/check/elements/gstfakesrc.c index bcd9d1def9..85be97f142 100644 --- a/tests/check/elements/gstfakesrc.c +++ b/tests/check/elements/gstfakesrc.c @@ -49,9 +49,11 @@ event_func (GstPad * pad, GstEvent * event) GST_STREAM_LOCK (pad); have_eos = TRUE; GST_STREAM_UNLOCK (pad); + gst_event_unref (event); return TRUE; } + gst_event_unref (event); return FALSE; } @@ -93,6 +95,13 @@ GST_START_TEST (test_num_buffers) fail_unless (g_list_length (buffers) == 3); g_list_foreach (buffers, (GFunc) gst_mini_object_unref, NULL); g_list_free (buffers); + + /* cleanup */ + fail_unless (gst_element_set_state (src, GST_STATE_NULL) == GST_STATE_SUCCESS, + "could not set to null"); + + gst_object_unref (src); + gst_object_unref (sinkpad); } GST_END_TEST; diff --git a/tests/check/gst/gstpad.c b/tests/check/gst/gstpad.c index 7ae7a2b9c2..5283c20805 100644 --- a/tests/check/gst/gstpad.c +++ b/tests/check/gst/gstpad.c @@ -31,21 +31,32 @@ GST_START_TEST (test_link) src = gst_pad_new ("source", GST_PAD_SRC); fail_if (src == NULL); + ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); name = gst_pad_get_name (src); fail_unless (strcmp (name, "source") == 0); + ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); + g_free (name); sink = gst_pad_new ("sink", GST_PAD_SINK); fail_if (sink == NULL); /* linking without templates or caps should fail */ ret = gst_pad_link (src, sink); + ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); + ASSERT_OBJECT_REFCOUNT (sink, "sink pad", 1); fail_unless (ret == GST_PAD_LINK_NOFORMAT); ASSERT_CRITICAL (gst_pad_get_pad_template (NULL)); srct = gst_pad_get_pad_template (src); fail_unless (srct == NULL); + ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); + + /* clean up */ + ASSERT_OBJECT_REFCOUNT (src, "source pad", 1); + gst_object_unref (src); + gst_object_unref (sink); } GST_END_TEST; diff --git a/tests/check/gst/gststructure.c b/tests/check/gst/gststructure.c index 93c8cc03aa..06a1102ae7 100644 --- a/tests/check/gst/gststructure.c +++ b/tests/check/gst/gststructure.c @@ -60,6 +60,9 @@ GST_START_TEST (test_from_string_int) fail_unless (value == results[i], "Value %d is not the expected result %d for string %s", value, results[i], s); + + /* cleanup */ + gst_structure_free (structure); } }