summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@igalia.com>2021-05-25 21:25:14 -0400
committerThibault Saunier <tsaunier@igalia.com>2021-05-27 12:23:05 -0400
commit32591fece811a96c5259b759210591ef348b3db7 (patch)
tree65f026964395bda73a5516023caccd68591c3511
parent87f656d1f6df4a0246d2959b5dafa577e7e64cc4 (diff)
validate: Error out on invalid 'foreach' iterator types
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-devtools/-/merge_requests/248>
-rw-r--r--validate/gst/validate/gst-validate-scenario.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/validate/gst/validate/gst-validate-scenario.c b/validate/gst/validate/gst-validate-scenario.c
index e4e74f7..4143557 100644
--- a/validate/gst/validate/gst-validate-scenario.c
+++ b/validate/gst/validate/gst-validate-scenario.c
@@ -2431,19 +2431,26 @@ static gboolean
_foreach_find_iterator (GQuark field_id, GValue * value,
GstValidateAction * action)
{
- if (!g_strcmp0 (g_quark_to_string (field_id), "actions"))
+ const gchar *field = g_quark_to_string (field_id);
+
+ if (!g_strcmp0 (field, "actions"))
return TRUE;
- if (!GST_VALUE_HOLDS_INT_RANGE (value) && !GST_VALUE_HOLDS_ARRAY (value))
+ if (!GST_VALUE_HOLDS_INT_RANGE (value) && !GST_VALUE_HOLDS_ARRAY (value)) {
+ gst_validate_error_structure (action,
+ "Unsupported iterator type `%s` for %s"
+ ". Only ranges (`[(int)start, (int)stop, [(int)step]]`) and arrays "
+ " (`<item1, item2>`) are supported", field, G_VALUE_TYPE_NAME (value));
return TRUE;
+ }
if (GST_VALIDATE_ACTION_RANGE_NAME (action)) {
- gst_validate_error_structure (action, "Found several ranges in structure, "
- "it is not supported");
+ gst_validate_error_structure (action, "Wrong iterator syntax, "
+ " only one iterator field is supported.");
return FALSE;
}
- GST_VALIDATE_ACTION_RANGE_NAME (action) = g_quark_to_string (field_id);
+ GST_VALIDATE_ACTION_RANGE_NAME (action) = field;
return TRUE;
}