mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-12 03:16:33 +00:00
More testsuite updates
Original commit message from CVS: More testsuite updates
This commit is contained in:
parent
3e44dbdb6e
commit
dbbd2077d0
4 changed files with 320 additions and 8 deletions
|
@ -21,6 +21,113 @@ create_bin (void)
|
|||
return bin;
|
||||
}
|
||||
|
||||
static GstElement*
|
||||
create_bin_ghostpads (void)
|
||||
{
|
||||
GstElement *bin;
|
||||
GstElement *element1, *element2;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element1 = gst_element_new ();
|
||||
gst_element_set_name (element1, "test1");
|
||||
gst_element_add_pad (element1, gst_pad_new ("src1", GST_PAD_SRC));
|
||||
gst_bin_add (GST_BIN (bin), element1);
|
||||
element2 = gst_element_new ();
|
||||
gst_element_set_name (element2, "test2");
|
||||
gst_element_add_pad (element2, gst_pad_new ("sink1", GST_PAD_SINK));
|
||||
gst_bin_add (GST_BIN (bin), element2);
|
||||
gst_element_connect (element1, "src1", element2, "sink1");
|
||||
gst_element_add_ghost_pad (bin, gst_element_get_pad (element2, "sink1"), "sink1");
|
||||
|
||||
return bin;
|
||||
}
|
||||
|
||||
static void
|
||||
add_remove_test1 (void)
|
||||
{
|
||||
GstElement *bin;
|
||||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
gst_element_set_name (element, "test1");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
gst_bin_remove (GST_BIN (bin), element);
|
||||
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
}
|
||||
|
||||
static void
|
||||
add_remove_test2 (void)
|
||||
{
|
||||
GstElement *bin;
|
||||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
gst_element_set_name (element, "test1");
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
gst_bin_remove (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_DESTROYED (element));
|
||||
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_DESTROYED (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
}
|
||||
|
||||
static void
|
||||
add_remove_test3 (void)
|
||||
{
|
||||
GstElement *bin;
|
||||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
gst_element_set_name (element, "test1");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
g_assert (gst_bin_get_by_name (GST_BIN (bin), "test1") == NULL);
|
||||
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
}
|
||||
|
||||
static void
|
||||
add_remove_test4 (void)
|
||||
{
|
||||
GstElement *bin, *bin2;
|
||||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
gst_element_set_name (element, "test1");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
|
||||
bin2 = create_bin ();
|
||||
g_assert (GST_OBJECT_FLOATING (bin2));
|
||||
gst_bin_add (GST_BIN (bin), bin2);
|
||||
g_assert (!GST_OBJECT_FLOATING (bin2));
|
||||
|
||||
gst_object_destroy (GST_OBJECT (bin2));
|
||||
g_assert (gst_bin_get_by_name (GST_BIN (bin), "testbin") == NULL);
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
g_assert (gst_bin_get_by_name (GST_BIN (bin), "test1") == NULL);
|
||||
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, gchar *argv[])
|
||||
{
|
||||
|
@ -133,6 +240,32 @@ main (int argc, gchar *argv[])
|
|||
}
|
||||
g_print ("create/unref %d bin with children %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2;i++) {
|
||||
bin = create_bin_ghostpads();
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
}
|
||||
g_print ("create/unref %d bin with children and ghostpads %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
add_remove_test1();
|
||||
}
|
||||
g_print ("add/remove test1 %d in bin %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
add_remove_test2();
|
||||
}
|
||||
g_print ("add/remove test2 %d in bin %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
add_remove_test3();
|
||||
}
|
||||
g_print ("add/destroy/remove test3 %d in bin %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
add_remove_test4();
|
||||
}
|
||||
g_print ("add/destroy/remove test4 %d in bin %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||
|
||||
return (vmsize()-usage1 ? -1 : 0);
|
||||
|
|
|
@ -61,7 +61,21 @@ main (int argc, gchar *argv[])
|
|||
g_assert (!GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
gst_object_unref (GST_OBJECT (element2));
|
||||
}
|
||||
g_print ("create/connect/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||
g_print ("create/connect/unref %d elements %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element2 = create_element ("src", GST_PAD_SRC);
|
||||
gst_element_connect (element, "sink", element2, "src");
|
||||
g_assert (GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
g_assert (GST_PAD_CONNECTED (gst_element_get_pad (element, "sink")));
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_DESTROYED (element));
|
||||
g_assert (!GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
gst_object_unref (GST_OBJECT (element2));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("create/connect/destroy %d elements %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
|
@ -75,7 +89,7 @@ main (int argc, gchar *argv[])
|
|||
gst_element_remove_pad (element, pad);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("pad removal loop %d %ld\n", iters, vmsize()-usage1);
|
||||
g_print ("pad removal loop %d %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
|
@ -86,7 +100,7 @@ main (int argc, gchar *argv[])
|
|||
gst_object_unref (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("pad removal and test loop %d %ld\n", iters, vmsize()-usage1);
|
||||
g_print ("pad removal and test loop %d %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
|
@ -103,7 +117,16 @@ main (int argc, gchar *argv[])
|
|||
gst_object_destroy (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("pad destroy/removal loop %d %ld\n", iters, vmsize()-usage1);
|
||||
g_print ("pad destroy/removal loop %d %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
g_assert (gst_element_get_pad (element, "sink") == NULL);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("pad destroy loop %d %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||
|
||||
|
|
|
@ -21,6 +21,113 @@ create_bin (void)
|
|||
return bin;
|
||||
}
|
||||
|
||||
static GstElement*
|
||||
create_bin_ghostpads (void)
|
||||
{
|
||||
GstElement *bin;
|
||||
GstElement *element1, *element2;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element1 = gst_element_new ();
|
||||
gst_element_set_name (element1, "test1");
|
||||
gst_element_add_pad (element1, gst_pad_new ("src1", GST_PAD_SRC));
|
||||
gst_bin_add (GST_BIN (bin), element1);
|
||||
element2 = gst_element_new ();
|
||||
gst_element_set_name (element2, "test2");
|
||||
gst_element_add_pad (element2, gst_pad_new ("sink1", GST_PAD_SINK));
|
||||
gst_bin_add (GST_BIN (bin), element2);
|
||||
gst_element_connect (element1, "src1", element2, "sink1");
|
||||
gst_element_add_ghost_pad (bin, gst_element_get_pad (element2, "sink1"), "sink1");
|
||||
|
||||
return bin;
|
||||
}
|
||||
|
||||
static void
|
||||
add_remove_test1 (void)
|
||||
{
|
||||
GstElement *bin;
|
||||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
gst_element_set_name (element, "test1");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
gst_bin_remove (GST_BIN (bin), element);
|
||||
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
}
|
||||
|
||||
static void
|
||||
add_remove_test2 (void)
|
||||
{
|
||||
GstElement *bin;
|
||||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
gst_element_set_name (element, "test1");
|
||||
gst_object_ref (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
gst_bin_remove (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
g_assert (!GST_OBJECT_DESTROYED (element));
|
||||
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_DESTROYED (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
}
|
||||
|
||||
static void
|
||||
add_remove_test3 (void)
|
||||
{
|
||||
GstElement *bin;
|
||||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
gst_element_set_name (element, "test1");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
g_assert (gst_bin_get_by_name (GST_BIN (bin), "test1") == NULL);
|
||||
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
}
|
||||
|
||||
static void
|
||||
add_remove_test4 (void)
|
||||
{
|
||||
GstElement *bin, *bin2;
|
||||
GstElement *element;
|
||||
|
||||
bin = gst_bin_new ("testbin");
|
||||
element = gst_element_new ();
|
||||
gst_element_set_name (element, "test1");
|
||||
g_assert (GST_OBJECT_FLOATING (element));
|
||||
gst_bin_add (GST_BIN (bin), element);
|
||||
g_assert (!GST_OBJECT_FLOATING (element));
|
||||
|
||||
bin2 = create_bin ();
|
||||
g_assert (GST_OBJECT_FLOATING (bin2));
|
||||
gst_bin_add (GST_BIN (bin), bin2);
|
||||
g_assert (!GST_OBJECT_FLOATING (bin2));
|
||||
|
||||
gst_object_destroy (GST_OBJECT (bin2));
|
||||
g_assert (gst_bin_get_by_name (GST_BIN (bin), "testbin") == NULL);
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
g_assert (gst_bin_get_by_name (GST_BIN (bin), "test1") == NULL);
|
||||
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, gchar *argv[])
|
||||
{
|
||||
|
@ -133,6 +240,32 @@ main (int argc, gchar *argv[])
|
|||
}
|
||||
g_print ("create/unref %d bin with children %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2;i++) {
|
||||
bin = create_bin_ghostpads();
|
||||
gst_object_unref (GST_OBJECT (bin));
|
||||
}
|
||||
g_print ("create/unref %d bin with children and ghostpads %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
add_remove_test1();
|
||||
}
|
||||
g_print ("add/remove test1 %d in bin %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
add_remove_test2();
|
||||
}
|
||||
g_print ("add/remove test2 %d in bin %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
add_remove_test3();
|
||||
}
|
||||
g_print ("add/destroy/remove test3 %d in bin %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters;i++) {
|
||||
add_remove_test4();
|
||||
}
|
||||
g_print ("add/destroy/remove test4 %d in bin %ld\n", iters, vmsize()-usage1);
|
||||
|
||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||
|
||||
return (vmsize()-usage1 ? -1 : 0);
|
||||
|
|
|
@ -61,7 +61,21 @@ main (int argc, gchar *argv[])
|
|||
g_assert (!GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
gst_object_unref (GST_OBJECT (element2));
|
||||
}
|
||||
g_print ("create/connect/unref %d elements %ld\n", iters, vmsize()-usage1);
|
||||
g_print ("create/connect/unref %d elements %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
element2 = create_element ("src", GST_PAD_SRC);
|
||||
gst_element_connect (element, "sink", element2, "src");
|
||||
g_assert (GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
g_assert (GST_PAD_CONNECTED (gst_element_get_pad (element, "sink")));
|
||||
gst_object_destroy (GST_OBJECT (element));
|
||||
g_assert (GST_OBJECT_DESTROYED (element));
|
||||
g_assert (!GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
gst_object_unref (GST_OBJECT (element2));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("create/connect/destroy %d elements %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
|
@ -75,7 +89,7 @@ main (int argc, gchar *argv[])
|
|||
gst_element_remove_pad (element, pad);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("pad removal loop %d %ld\n", iters, vmsize()-usage1);
|
||||
g_print ("pad removal loop %d %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
|
@ -86,7 +100,7 @@ main (int argc, gchar *argv[])
|
|||
gst_object_unref (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("pad removal and test loop %d %ld\n", iters, vmsize()-usage1);
|
||||
g_print ("pad removal and test loop %d %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
|
@ -103,7 +117,16 @@ main (int argc, gchar *argv[])
|
|||
gst_object_destroy (GST_OBJECT (element));
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("pad destroy/removal loop %d %ld\n", iters, vmsize()-usage1);
|
||||
g_print ("pad destroy/removal loop %d %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
for (i=0; i<iters/2; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
pad = gst_element_get_pad (element, "sink");
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
g_assert (gst_element_get_pad (element, "sink") == NULL);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("pad destroy loop %d %ld\n", iters/2, vmsize()-usage1);
|
||||
|
||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||
|
||||
|
|
Loading…
Reference in a new issue