mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
validate: Allow using the new nested structure syntax
And port the deeply nested tests we have Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-devtools/-/merge_requests/233>
This commit is contained in:
parent
b4c9025db2
commit
f47e5b163f
4 changed files with 122 additions and 51 deletions
|
@ -4129,7 +4129,8 @@ handle_bus_message (MessageData * d)
|
||||||
GST_DEBUG_OBJECT (scenario, "Got EOS; generate 'stop' action");
|
GST_DEBUG_OBJECT (scenario, "Got EOS; generate 'stop' action");
|
||||||
|
|
||||||
stop_action_type = _find_action_type ("stop");
|
stop_action_type = _find_action_type ("stop");
|
||||||
s = gst_structure_from_string ("stop, generated-after-eos=true;", NULL);
|
s = gst_structure_new ("stop", "generated-after-eos", G_TYPE_BOOLEAN,
|
||||||
|
!is_error, "generated-after-error", G_TYPE_BOOLEAN, is_error, NULL);
|
||||||
stop_action = gst_validate_action_new (scenario, stop_action_type,
|
stop_action = gst_validate_action_new (scenario, stop_action_type,
|
||||||
s, FALSE);
|
s, FALSE);
|
||||||
gst_structure_free (s);
|
gst_structure_free (s);
|
||||||
|
|
|
@ -216,6 +216,41 @@ create_config (const gchar * config)
|
||||||
g_list_free (structures);
|
g_list_free (structures);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GList *
|
||||||
|
get_structures_from_array (GstStructure * structure, const gchar * fieldname)
|
||||||
|
{
|
||||||
|
const GValue *value;
|
||||||
|
GList *res = NULL;
|
||||||
|
guint i, size;
|
||||||
|
|
||||||
|
value = gst_structure_get_value (structure, fieldname);
|
||||||
|
if (!value)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (GST_VALUE_HOLDS_STRUCTURE (value)) {
|
||||||
|
return g_list_append (res,
|
||||||
|
gst_structure_copy (gst_value_get_structure (value)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GST_VALUE_HOLDS_LIST (value)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
size = gst_value_list_get_size (value);
|
||||||
|
for (i = 0; i < size; i++) {
|
||||||
|
const GValue *v1 = gst_value_list_get_value (value, i);
|
||||||
|
|
||||||
|
if (!GST_VALUE_HOLDS_STRUCTURE (v1))
|
||||||
|
break;
|
||||||
|
|
||||||
|
res =
|
||||||
|
g_list_append (res, gst_structure_copy (gst_value_get_structure (v1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static GList *
|
static GList *
|
||||||
get_structures_from_array_in_meta (const gchar * fieldname)
|
get_structures_from_array_in_meta (const gchar * fieldname)
|
||||||
{
|
{
|
||||||
|
@ -227,6 +262,10 @@ get_structures_from_array_in_meta (const gchar * fieldname)
|
||||||
if (!meta)
|
if (!meta)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
res = get_structures_from_array (meta, fieldname);
|
||||||
|
if (res)
|
||||||
|
return res;
|
||||||
|
|
||||||
gst_structure_get (meta,
|
gst_structure_get (meta,
|
||||||
"__lineno__", G_TYPE_INT, ¤t_lineno,
|
"__lineno__", G_TYPE_INT, ¤t_lineno,
|
||||||
"__debug__", G_TYPE_STRING, &debug,
|
"__debug__", G_TYPE_STRING, &debug,
|
||||||
|
|
|
@ -4,42 +4,44 @@ meta,
|
||||||
"videotestsrc pattern=ball animation-mode=frames num-buffers=30 ! video/x-raw,framerate=10/1 ! $(videosink) name=sink sync=true",
|
"videotestsrc pattern=ball animation-mode=frames num-buffers=30 ! video/x-raw,framerate=10/1 ! $(videosink) name=sink sync=true",
|
||||||
},
|
},
|
||||||
expected-issues = {
|
expected-issues = {
|
||||||
"expected-issue,
|
[
|
||||||
level=critical,
|
expected-issue,
|
||||||
issue-id=scenario::execution-error,
|
level=critical,
|
||||||
details=\"Pipeline position doesn.t match expectations got 0:00:00.100000000 instead of.*\"",
|
issue-id=scenario::execution-error,
|
||||||
"expected-issue,
|
details="Pipeline position doesn.t match expectations got 0:00:00.100000000 instead of.*",
|
||||||
level=critical,
|
],
|
||||||
issue-id=scenario::execution-error,
|
[
|
||||||
details=\"Pipeline position doesn.t match expectations got 0:00:00.200000000 instead of.*\"",
|
expected-issue,
|
||||||
|
level=critical,
|
||||||
|
issue-id=scenario::execution-error,
|
||||||
|
details="Pipeline position doesn.t match expectations got 0:00:00.200000000 instead of.*",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
pause;
|
pause;
|
||||||
|
|
||||||
foreach, n=[0, 2],
|
foreach, n=[0, 2],
|
||||||
actions = {
|
actions = {
|
||||||
"seek, start=\"$(position)+0.1\", flags=\"accurate+flush\"",
|
[seek, start="$(position)+0.1", flags="accurate+flush"],
|
||||||
"check-position, expected-position=\"expr($(n)*0.01)\"", # expected to fail
|
[check-position, expected-position="expr($(n)*0.01)"], # expected to fail
|
||||||
}
|
}
|
||||||
|
|
||||||
priv_check-action-type-calls, type=seek, n=2
|
priv_check-action-type-calls, type=seek, n=2
|
||||||
priv_check-action-type-calls, type=check-position, n=2
|
priv_check-action-type-calls, type=check-position, n=2
|
||||||
|
|
||||||
foreach, n=[0, 6],
|
foreach, n=[0, 6], actions = {
|
||||||
actions = {
|
[seek, start="$(position)+0.1", flags="accurate+flush"],
|
||||||
"seek, start=\"$(position)+0.1\", flags=\"accurate+flush\"",
|
[check-position, expected-position="expr((3 + $(n)) * 0.1)"],
|
||||||
"check-position, expected-position=\"expr((3 + $(n)) * 0.1)\"",
|
}
|
||||||
}
|
|
||||||
|
|
||||||
priv_check-action-type-calls, type=seek, n=8
|
priv_check-action-type-calls, type=seek, n=8
|
||||||
priv_check-action-type-calls, type=check-position, n=8
|
priv_check-action-type-calls, type=check-position, n=8
|
||||||
check-position, expected-position=0.8
|
check-position, expected-position=0.8
|
||||||
|
|
||||||
foreach, n=[9, 11],
|
foreach, n=[9, 11], actions = {
|
||||||
actions = {
|
[seek, start="$(position)+0.1", flags="accurate+flush"],
|
||||||
"seek, start=\"$(position)+0.1\", flags=\"accurate+flush\"",
|
[check-position, expected-position="expr($(n)*0.1)"],
|
||||||
"check-position, expected-position=\"expr($(n)*0.1)\"",
|
}
|
||||||
}
|
|
||||||
priv_check-action-type-calls, type=seek, n=10
|
priv_check-action-type-calls, type=seek, n=10
|
||||||
# We called it once manually
|
# We called it once manually
|
||||||
priv_check-action-type-calls, type=check-position, n=11
|
priv_check-action-type-calls, type=check-position, n=11
|
||||||
|
|
|
@ -4,48 +4,77 @@ meta,
|
||||||
"videotestsrc pattern=ball animation-mode=frames num-buffers=30 ! video/x-raw,framerate=10/1 ! $(videosink) name=sink sync=true",
|
"videotestsrc pattern=ball animation-mode=frames num-buffers=30 ! video/x-raw,framerate=10/1 ! $(videosink) name=sink sync=true",
|
||||||
},
|
},
|
||||||
expected-issues = {
|
expected-issues = {
|
||||||
"expected-issue, level=critical, issue-id=scenario::execution-error,
|
[
|
||||||
details=\"Pipeline position doesn.t match expectations got 0:00:00.100000000 instead of.*\"",
|
expected-issue,
|
||||||
"expected-issue, level=critical, issue-id=scenario::execution-error,
|
level=critical,
|
||||||
details=\"Pipeline position doesn.t match expectations got 0:00:00.200000000 instead of.*\"",
|
issue-id=scenario::execution-error,
|
||||||
"expected-issue, level=critical, issue-id=scenario::execution-error,
|
details="Pipeline position doesn.t match expectations got 0:00:00.100000000 instead of.*",
|
||||||
details=\"Expected subaction level 4, got 3\"",
|
],
|
||||||
"expected-issue, level=critical, issue-id=scenario::execution-error,
|
[
|
||||||
details=\"Expected subaction level 4, got 3\"",
|
expected-issue,
|
||||||
"expected-issue, level=critical, issue-id=scenario::execution-error,
|
level=critical,
|
||||||
details=\"Expected subaction level 5, got 4\"",
|
issue-id=scenario::execution-error,
|
||||||
"expected-issue, level=critical, issue-id=scenario::execution-error,
|
details="Pipeline position doesn.t match expectations got 0:00:00.200000000 instead of.*",
|
||||||
details=\"Expected subaction level 5, got 4\"",
|
],
|
||||||
|
[
|
||||||
|
expected-issue,
|
||||||
|
level=critical,
|
||||||
|
issue-id=scenario::execution-error,
|
||||||
|
details="Expected subaction level 4, got 3",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
expected-issue,
|
||||||
|
level=critical,
|
||||||
|
issue-id=scenario::execution-error,
|
||||||
|
details="Expected subaction level 4, got 3",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
expected-issue,
|
||||||
|
level=critical,
|
||||||
|
issue-id=scenario::execution-error,
|
||||||
|
details="Expected subaction level 5, got 4",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
expected-issue,
|
||||||
|
level=critical,
|
||||||
|
issue-id=scenario::execution-error,
|
||||||
|
details="Expected subaction level 5, got 4",
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
pause;
|
pause;
|
||||||
|
|
||||||
|
|
||||||
foreach, n=[0, 2],
|
foreach, n=[0, 2],
|
||||||
actions = {
|
actions={
|
||||||
"seek, start=\"$(position)+0.1\", flags=\"accurate+flush\"",
|
[seek, start="$(position)+0.1", flags="accurate+flush"],
|
||||||
"check-position, expected-position=\"expr($(n)*0.01)\"", # Expected failling subaction!
|
[check-position, expected-position="expr($(n)*0.01)"], # Expected failling subaction!
|
||||||
}
|
}
|
||||||
|
|
||||||
priv_check-action-type-calls, type=seek, n=2
|
priv_check-action-type-calls, type=seek, n=2
|
||||||
priv_check-action-type-calls, type=check-position, n=2
|
priv_check-action-type-calls, type=check-position, n=2
|
||||||
|
|
||||||
foreach, n=[0, 2],
|
foreach, i=[0, 2],
|
||||||
actions = {
|
actions={
|
||||||
"seek, start=\"$(position)+0.1\", flags=\"accurate+flush\"",
|
[seek, start="$(position)+0.1", flags="accurate+flush"],
|
||||||
"priv_check-subaction-level, level=1",
|
[priv_check-subaction-level, level=1],
|
||||||
"foreach, n=[0, 1],
|
[foreach, j=[0, 1],
|
||||||
actions={
|
actions={
|
||||||
\"priv_check-subaction-level, level=2\",
|
[priv_check-subaction-level, level=2],
|
||||||
\"foreach, j=[0, 1], actions={
|
[foreach, k=[0, 1],
|
||||||
\\\"priv_check-subaction-level, level=4\\\", # Failling... twice
|
actions={
|
||||||
\\\"priv_check-subaction-level, level=3\\\",
|
[priv_check-subaction-level, level=4], # Failling... twice
|
||||||
\\\"foreach, j=[0, 1], actions={
|
[priv_check-subaction-level, level=3],
|
||||||
\\\\\\\"priv_check-subaction-level, level=4\\\\\\\",
|
[foreach, l=[0, 1],
|
||||||
\\\\\\\"priv_check-subaction-level, level=5\\\\\\\", # Failling... twice
|
actions={
|
||||||
}\\\",
|
[priv_check-subaction-level, level=4],
|
||||||
}\",
|
[priv_check-subaction-level, level=5], # Failling... twice
|
||||||
}",
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
priv_check-action-type-calls, type=seek, n=4
|
priv_check-action-type-calls, type=seek, n=4
|
||||||
stop
|
stop
|
||||||
|
|
Loading…
Reference in a new issue