mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 17:05:52 +00:00
Fix some of the leaks exposed by extending the parse-launch testsuite, and move the 3 I can't figure out into a separ...
Original commit message from CVS: * gst/parse/grammar.y: * gst/parse/parse.l: * tests/check/pipelines/parse-launch.c: (expected_fail_pipe), (GST_START_TEST), (parse_suite): Fix some of the leaks exposed by extending the parse-launch testsuite, and move the 3 I can't figure out into a separate test that won't run the pipelines unless the appropriate line is uncommented.
This commit is contained in:
parent
6cd3b9de71
commit
5b271bcd88
4 changed files with 55 additions and 15 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2006-07-27 Jan Schmidt,,, <set EMAIL_ADDRESS environment variable>
|
||||
|
||||
* gst/parse/grammar.y:
|
||||
* gst/parse/parse.l:
|
||||
* tests/check/pipelines/parse-launch.c: (expected_fail_pipe),
|
||||
(GST_START_TEST), (parse_suite):
|
||||
Fix some of the leaks exposed by extending the parse-launch testsuite,
|
||||
and move the 3 I can't figure out into a separate test that won't run
|
||||
the pipelines unless the appropriate line is uncommented.
|
||||
|
||||
2006-07-27 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* plugins/elements/gstfilesrc.c: (gst_file_src_create_read):
|
||||
|
|
|
@ -571,11 +571,12 @@ static int yyerror (const char *s);
|
|||
%%
|
||||
|
||||
element: IDENTIFIER { $$ = gst_element_factory_make ($1, NULL);
|
||||
if (!$$)
|
||||
if ($$ == NULL) {
|
||||
SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, _("no element \"%s\""), $1);
|
||||
gst_parse_strfree ($1);
|
||||
if (!$$)
|
||||
gst_parse_strfree ($1);
|
||||
YYERROR;
|
||||
}
|
||||
gst_parse_strfree ($1);
|
||||
}
|
||||
| element ASSIGNMENT { gst_parse_element_set ($2, $1, graph);
|
||||
$$ = $1;
|
||||
|
@ -617,7 +618,7 @@ linkpart: reference { $$ = $1; }
|
|||
link: linkpart LINK linkpart { $$ = $1;
|
||||
if ($2) {
|
||||
$$->caps = gst_caps_from_string ($2);
|
||||
if (!$$->caps)
|
||||
if ($$->caps == NULL)
|
||||
SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK, _("could not parse caps \"%s\""), $2);
|
||||
gst_parse_strfree ($2);
|
||||
}
|
||||
|
@ -741,10 +742,15 @@ chain: element { $$ = gst_parse_chain_new ();
|
|||
if (!element) {
|
||||
SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_NO_SUCH_ELEMENT,
|
||||
_("no sink element for URI \"%s\""), $2);
|
||||
gst_parse_link_free ($1);
|
||||
g_free ($2);
|
||||
YYERROR;
|
||||
} else if ($1->sink_name || $1->sink_pads) {
|
||||
gst_object_unref (element);
|
||||
SET_ERROR (((graph_t *) graph)->error, GST_PARSE_ERROR_LINK,
|
||||
_("could not link sink element for URI \"%s\""), $2);
|
||||
gst_parse_link_free ($1);
|
||||
g_free ($2);
|
||||
YYERROR;
|
||||
} else {
|
||||
$$ = gst_parse_chain_new ();
|
||||
|
@ -856,8 +862,10 @@ _gst_parse_launch (const gchar *str, GError **error)
|
|||
bin = GST_BIN (gst_element_factory_make ("pipeline", NULL));
|
||||
g_assert (bin);
|
||||
|
||||
for (walk = g.chain->elements; walk; walk = walk->next)
|
||||
gst_bin_add (bin, GST_ELEMENT (walk->data));
|
||||
for (walk = g.chain->elements; walk; walk = walk->next) {
|
||||
if (walk->data != NULL)
|
||||
gst_bin_add (bin, GST_ELEMENT (walk->data));
|
||||
}
|
||||
|
||||
g_slist_free (g.chain->elements);
|
||||
ret = GST_ELEMENT (bin);
|
||||
|
|
|
@ -138,7 +138,7 @@ _link ("!"[[:space:]]*{_caps}([[:space:]]*(";"[[:space:]]*{_caps})*[[:space:]]*)
|
|||
[[:space:]]+ { PRINT ("SPACE: [%s]", yytext); }
|
||||
|
||||
. {
|
||||
printf ("???: %s\n", yytext);
|
||||
PRINT ("Invalid Lexer element: %s\n", yytext);
|
||||
return *yytext;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <valgrind/valgrind.h>
|
||||
#include <valgrind/memcheck.h>
|
||||
|
||||
#include <gst/check/gstcheck.h>
|
||||
|
||||
static GstElement *
|
||||
|
@ -48,7 +51,7 @@ expected_fail_pipe (const gchar * pipe_descr)
|
|||
GError *error = NULL;
|
||||
|
||||
#ifndef GST_DISABLE_GST_DEBUG
|
||||
gst_debug_set_default_threshold (GST_LEVEL_NONE);
|
||||
// gst_debug_set_default_threshold (GST_LEVEL_NONE);
|
||||
#endif
|
||||
|
||||
pipeline = gst_parse_launch (pipe_descr, &error);
|
||||
|
@ -270,8 +273,6 @@ static const gchar *expected_failures[] = {
|
|||
"fakesrc num-buffers=4 name=\"a=b\" a=b. ! fakesink",
|
||||
/* checks: Error branch for a non-deserialisable property value */
|
||||
"filesrc blocksize=absdff",
|
||||
/* checks: That requesting an element which doesn't exist doesn't work */
|
||||
"error-does-not-exist-src",
|
||||
/* checks: That broken caps which don't parse can't create a pipeline */
|
||||
"fakesrc ! video/raw,format=(antwerp)monkeys ! fakesink",
|
||||
/* checks: Empty pipeline is invalid */
|
||||
|
@ -288,13 +289,8 @@ static const gchar *expected_failures[] = {
|
|||
"fakesrc name=src fakesink name=sink noexiste. ! sink.",
|
||||
/* checks: Referencing non-existent sink element by name can't link */
|
||||
"fakesrc name=src fakesink name=sink src. ! noexiste.",
|
||||
/* checks: Invalid pipeline syntax fails */
|
||||
"fakesrc ! identity ! sgsdfagfd @ gfdgfdsgfsgSF",
|
||||
/* checks: Can't link 2 elements that only have sink pads */
|
||||
"fakesink ! fakesink",
|
||||
/* checks: Attempting to link to a non-existent pad on an element
|
||||
* created via URI handler should fail */
|
||||
"fakesrc ! .foo file:///dev/null",
|
||||
/* checks multi-chain link without src element fails. */
|
||||
"! identity ! identity ! fakesink",
|
||||
/* END: */
|
||||
|
@ -312,6 +308,31 @@ GST_START_TEST (expected_to_fail_pipes)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
static const gchar *leaking_failures[] = {
|
||||
/* checks: Invalid pipeline syntax fails */
|
||||
"fakesrc ! identity ! sgsdfagfd @ gfdgfdsgfsgSF",
|
||||
/* checks: Attempting to link to a non-existent pad on an element
|
||||
* created via URI handler should fail */
|
||||
"fakesrc ! .foo file:///dev/null",
|
||||
/* checks: That requesting an element which doesn't exist doesn't work */
|
||||
"error-does-not-exist-src",
|
||||
NULL
|
||||
};
|
||||
|
||||
GST_START_TEST (leaking_fail_pipes)
|
||||
{
|
||||
const gchar **s;
|
||||
|
||||
for (s = leaking_failures; *s != NULL; s++) {
|
||||
g_print ("Trying pipe: %s\n", *s);
|
||||
/* Uncomment if you want to try fixing the leaks */
|
||||
/* expected_fail_pipe (*s); */
|
||||
VALGRIND_DO_LEAK_CHECK;
|
||||
}
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
/* Helper function to test delayed linking support in parse_launch by creating
|
||||
* a test element based on bin, which contains a fakesrc and a sometimes
|
||||
* pad-template, and trying to link to a fakesink. When the bin transitions
|
||||
|
@ -526,6 +547,7 @@ parse_suite (void)
|
|||
tcase_add_test (tc_chain, test_launch_lines);
|
||||
tcase_add_test (tc_chain, test_launch_lines2);
|
||||
tcase_add_test (tc_chain, expected_to_fail_pipes);
|
||||
tcase_add_test (tc_chain, leaking_fail_pipes);
|
||||
tcase_add_test (tc_chain, delayed_link);
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue