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
ff175b6074
commit
13c4e92c04
6 changed files with 444 additions and 2 deletions
|
@ -1,9 +1,11 @@
|
|||
SUBDIRS =
|
||||
|
||||
testprogs = object element
|
||||
testprogs = object element pad element_pad
|
||||
|
||||
object_SOURCES = object.c mem.c
|
||||
element_SOURCES = element.c mem.c
|
||||
pad_SOURCES = pad.c mem.c
|
||||
element_pad_SOURCES = element_pad.c mem.c
|
||||
|
||||
TESTS = $(testprogs)
|
||||
|
||||
|
|
70
tests/old/testsuite/refcounting/element_pad.c
Normal file
70
tests/old/testsuite/refcounting/element_pad.c
Normal file
|
@ -0,0 +1,70 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
#define ITERS 100000
|
||||
#include "mem.h"
|
||||
|
||||
static void
|
||||
print_pad_props (GstPad *pad)
|
||||
{
|
||||
g_print ("name %s\n", gst_pad_get_name (pad));
|
||||
g_print ("flags 0x%08x\n", GST_FLAGS (pad));
|
||||
}
|
||||
|
||||
static GstElement*
|
||||
create_element (gchar *padname, GstPadDirection dir)
|
||||
{
|
||||
GstElement *element;
|
||||
GstPad *pad;
|
||||
|
||||
element = gst_element_new ();
|
||||
pad = gst_pad_new (padname, dir);
|
||||
gst_element_add_pad (element, pad);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, gchar *argv[])
|
||||
{
|
||||
GstElement *element;
|
||||
GstElement *element2;
|
||||
GstPad *pad;
|
||||
long usage1;
|
||||
gint i;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
||||
g_print ("creating new element\n");
|
||||
element = gst_element_new ();
|
||||
usage1 = vmsize();
|
||||
|
||||
pad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
print_pad_props (pad);
|
||||
gst_element_add_pad (element, pad);
|
||||
print_pad_props (pad);
|
||||
|
||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
|
||||
for (i=0; i<ITERS; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("destroy/unref 100000 element %ld\n", 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_unref (GST_OBJECT (element));
|
||||
g_assert (!GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
gst_object_unref (GST_OBJECT (element2));
|
||||
}
|
||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
||||
|
||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||
|
||||
return 0;
|
||||
}
|
149
tests/old/testsuite/refcounting/pad.c
Normal file
149
tests/old/testsuite/refcounting/pad.c
Normal file
|
@ -0,0 +1,149 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
#define ITERS 100000
|
||||
#include "mem.h"
|
||||
|
||||
static void
|
||||
print_pad_props (GstPad *pad)
|
||||
{
|
||||
g_print ("name %s\n", gst_pad_get_name (pad));
|
||||
g_print ("flags 0x%08x\n", GST_FLAGS (pad));
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, gchar *argv[])
|
||||
{
|
||||
GstPad *pad;
|
||||
GstPad *pad2;
|
||||
GstPadTemplate *padtempl;
|
||||
long usage1;
|
||||
gint i;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
||||
g_print ("creating new pad\n");
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
usage1 = vmsize();
|
||||
print_pad_props (pad);
|
||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
|
||||
g_print ("creating new pad\n");
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
g_assert (GST_OBJECT_FLOATING (pad));
|
||||
print_pad_props (pad);
|
||||
g_print ("sink new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
gst_object_sink (GST_OBJECT (pad));
|
||||
g_assert (!GST_OBJECT_FLOATING (pad));
|
||||
print_pad_props (pad);
|
||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
|
||||
for (i=0; i<ITERS;i++) {
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
}
|
||||
g_print ("unref 100000 pad %ld\n", vmsize()-usage1);
|
||||
|
||||
g_print ("creating new pad\n");
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||
print_pad_props (pad);
|
||||
g_print ("destroy new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
g_assert (GST_OBJECT_DESTROYED (pad));
|
||||
print_pad_props (pad);
|
||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
|
||||
for (i=0; i<ITERS;i++) {
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
}
|
||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
||||
|
||||
g_print ("creating new pad\n");
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
print_pad_props (pad);
|
||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
|
||||
for (i=0; i<ITERS;i++) {
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
}
|
||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
||||
|
||||
g_print ("creating new pad\n");
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
print_pad_props (pad);
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
|
||||
for (i=0; i<ITERS;i++) {
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
}
|
||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<ITERS;i++) {
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
gst_pad_set_name (pad, "testing123");
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
gst_pad_set_name (pad, "testing123");
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
}
|
||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
||||
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
for (i=0; i<ITERS;i++) {
|
||||
gst_pad_set_name (pad, "testing");
|
||||
}
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
||||
|
||||
g_print ("connecting pad %ld\n", vmsize()-usage1);
|
||||
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||
|
||||
gst_pad_connect (pad, pad2);
|
||||
gst_pad_disconnect (pad, pad2);
|
||||
gst_pad_connect (pad2, pad);
|
||||
gst_pad_disconnect (pad2, pad);
|
||||
|
||||
g_print ("padtemplates create/destroy %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<ITERS;i++) {
|
||||
padtempl = gst_padtemplate_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
||||
gst_object_unref (GST_OBJECT (padtempl));
|
||||
}
|
||||
|
||||
g_print ("padtemplates create/destroy on pad %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<ITERS;i++) {
|
||||
padtempl = gst_padtemplate_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
||||
pad = gst_pad_new_from_template (padtempl, "sink1");
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
}
|
||||
|
||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,9 +1,11 @@
|
|||
SUBDIRS =
|
||||
|
||||
testprogs = object element
|
||||
testprogs = object element pad element_pad
|
||||
|
||||
object_SOURCES = object.c mem.c
|
||||
element_SOURCES = element.c mem.c
|
||||
pad_SOURCES = pad.c mem.c
|
||||
element_pad_SOURCES = element_pad.c mem.c
|
||||
|
||||
TESTS = $(testprogs)
|
||||
|
||||
|
|
70
testsuite/refcounting/element_pad.c
Normal file
70
testsuite/refcounting/element_pad.c
Normal file
|
@ -0,0 +1,70 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
#define ITERS 100000
|
||||
#include "mem.h"
|
||||
|
||||
static void
|
||||
print_pad_props (GstPad *pad)
|
||||
{
|
||||
g_print ("name %s\n", gst_pad_get_name (pad));
|
||||
g_print ("flags 0x%08x\n", GST_FLAGS (pad));
|
||||
}
|
||||
|
||||
static GstElement*
|
||||
create_element (gchar *padname, GstPadDirection dir)
|
||||
{
|
||||
GstElement *element;
|
||||
GstPad *pad;
|
||||
|
||||
element = gst_element_new ();
|
||||
pad = gst_pad_new (padname, dir);
|
||||
gst_element_add_pad (element, pad);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, gchar *argv[])
|
||||
{
|
||||
GstElement *element;
|
||||
GstElement *element2;
|
||||
GstPad *pad;
|
||||
long usage1;
|
||||
gint i;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
||||
g_print ("creating new element\n");
|
||||
element = gst_element_new ();
|
||||
usage1 = vmsize();
|
||||
|
||||
pad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
print_pad_props (pad);
|
||||
gst_element_add_pad (element, pad);
|
||||
print_pad_props (pad);
|
||||
|
||||
g_print ("unref new element %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
|
||||
for (i=0; i<ITERS; i++) {
|
||||
element = create_element ("sink", GST_PAD_SINK);
|
||||
gst_object_unref (GST_OBJECT (element));
|
||||
}
|
||||
g_print ("destroy/unref 100000 element %ld\n", 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_unref (GST_OBJECT (element));
|
||||
g_assert (!GST_PAD_CONNECTED (gst_element_get_pad (element2, "src")));
|
||||
gst_object_unref (GST_OBJECT (element2));
|
||||
}
|
||||
g_print ("destroy/unref 100000 element %ld\n", vmsize()-usage1);
|
||||
|
||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||
|
||||
return 0;
|
||||
}
|
149
testsuite/refcounting/pad.c
Normal file
149
testsuite/refcounting/pad.c
Normal file
|
@ -0,0 +1,149 @@
|
|||
#include <gst/gst.h>
|
||||
|
||||
#define ITERS 100000
|
||||
#include "mem.h"
|
||||
|
||||
static void
|
||||
print_pad_props (GstPad *pad)
|
||||
{
|
||||
g_print ("name %s\n", gst_pad_get_name (pad));
|
||||
g_print ("flags 0x%08x\n", GST_FLAGS (pad));
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, gchar *argv[])
|
||||
{
|
||||
GstPad *pad;
|
||||
GstPad *pad2;
|
||||
GstPadTemplate *padtempl;
|
||||
long usage1;
|
||||
gint i;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
||||
g_print ("creating new pad\n");
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
usage1 = vmsize();
|
||||
print_pad_props (pad);
|
||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
|
||||
g_print ("creating new pad\n");
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
g_assert (GST_OBJECT_FLOATING (pad));
|
||||
print_pad_props (pad);
|
||||
g_print ("sink new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
gst_object_sink (GST_OBJECT (pad));
|
||||
g_assert (!GST_OBJECT_FLOATING (pad));
|
||||
print_pad_props (pad);
|
||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
|
||||
for (i=0; i<ITERS;i++) {
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
}
|
||||
g_print ("unref 100000 pad %ld\n", vmsize()-usage1);
|
||||
|
||||
g_print ("creating new pad\n");
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
g_assert (!GST_OBJECT_DESTROYED (pad));
|
||||
print_pad_props (pad);
|
||||
g_print ("destroy new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
g_assert (GST_OBJECT_DESTROYED (pad));
|
||||
print_pad_props (pad);
|
||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
|
||||
for (i=0; i<ITERS;i++) {
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
}
|
||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
||||
|
||||
g_print ("creating new pad\n");
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
print_pad_props (pad);
|
||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
|
||||
for (i=0; i<ITERS;i++) {
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
}
|
||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
||||
|
||||
g_print ("creating new pad\n");
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
print_pad_props (pad);
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
g_print ("unref new pad %ld\n", vmsize()-usage1);
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
|
||||
for (i=0; i<ITERS;i++) {
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
}
|
||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<ITERS;i++) {
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
gst_object_ref (GST_OBJECT (pad));
|
||||
gst_pad_set_name (pad, "testing123");
|
||||
gst_object_destroy (GST_OBJECT (pad));
|
||||
gst_pad_set_name (pad, "testing123");
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
}
|
||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
||||
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
for (i=0; i<ITERS;i++) {
|
||||
gst_pad_set_name (pad, "testing");
|
||||
}
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
g_print ("destroy/unref 100000 pad %ld\n", vmsize()-usage1);
|
||||
|
||||
g_print ("connecting pad %ld\n", vmsize()-usage1);
|
||||
|
||||
pad = gst_pad_new ("padname", GST_PAD_SINK);
|
||||
pad2 = gst_pad_new ("padname2", GST_PAD_SRC);
|
||||
|
||||
gst_pad_connect (pad, pad2);
|
||||
gst_pad_disconnect (pad, pad2);
|
||||
gst_pad_connect (pad2, pad);
|
||||
gst_pad_disconnect (pad2, pad);
|
||||
|
||||
g_print ("padtemplates create/destroy %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<ITERS;i++) {
|
||||
padtempl = gst_padtemplate_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
||||
gst_object_unref (GST_OBJECT (padtempl));
|
||||
}
|
||||
|
||||
g_print ("padtemplates create/destroy on pad %ld\n", vmsize()-usage1);
|
||||
|
||||
for (i=0; i<ITERS;i++) {
|
||||
padtempl = gst_padtemplate_new ("sink%d", GST_PAD_SINK, GST_PAD_SOMETIMES, NULL);
|
||||
pad = gst_pad_new_from_template (padtempl, "sink1");
|
||||
gst_object_unref (GST_OBJECT (pad));
|
||||
}
|
||||
|
||||
g_print ("leaked: %ld\n", vmsize()-usage1);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue