aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2016-12-01 10:45:52 +0100
committerHans Verkuil <hans.verkuil@cisco.com>2016-12-01 10:45:52 +0100
commit003f31e59f353b4aecc82e8fb1c7555964da7efa (patch)
tree9d4c62dad1d476a532d222c786ea300f0f2e4aa9
parentf6ecbc90656815d91dc6ba90aac0ad8193a14b38 (diff)
v4l2-compliance: allow S_SELECTION to return ENOTTY
It is possible that G_SELECTION is implemented, but S_SELECTION isn't. So update the test to allow for ENOTTY return values from S_SELECTION. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/v4l2-compliance/v4l2-test-formats.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/utils/v4l2-compliance/v4l2-test-formats.cpp b/utils/v4l2-compliance/v4l2-test-formats.cpp
index 6b434c31..97e551e4 100644
--- a/utils/v4l2-compliance/v4l2-test-formats.cpp
+++ b/utils/v4l2-compliance/v4l2-test-formats.cpp
@@ -1289,6 +1289,8 @@ static int testBasicCrop(struct node *node, unsigned type)
};
struct v4l2_selection sel_def;
struct v4l2_selection sel_bounds;
+ int s_sel_ret = EINVAL;
+ int ret;
fail_on_test(doioctl(node, VIDIOC_G_SELECTION, &sel_crop));
fail_on_test(!sel_crop.r.width || !sel_crop.r.height);
@@ -1316,19 +1318,22 @@ static int testBasicCrop(struct node *node, unsigned type)
sel_crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
else
sel_crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
- fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_crop) != EINVAL);
+ ret = doioctl(node, VIDIOC_S_SELECTION, &sel_crop);
+ if (ret == ENOTTY)
+ s_sel_ret = ret;
+ fail_on_test(ret != s_sel_ret);
// Check handling of invalid type.
sel_crop.type = 0xff;
- fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_crop) != EINVAL);
+ fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_crop) != s_sel_ret);
// Check handling of invalid target.
sel_crop.type = type;
sel_crop.target = 0xffff;
- fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_crop) != EINVAL);
+ fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_crop) != s_sel_ret);
// Check handling of read-only targets.
sel_crop.target = V4L2_SEL_TGT_CROP_DEFAULT;
- fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_crop) != EINVAL);
+ fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_crop) != s_sel_ret);
sel_crop.target = V4L2_SEL_TGT_CROP_BOUNDS;
- fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_crop) != EINVAL);
+ fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_crop) != s_sel_ret);
return 0;
}
@@ -1418,6 +1423,7 @@ static int testBasicCompose(struct node *node, unsigned type)
struct v4l2_selection sel_def;
struct v4l2_selection sel_bounds;
struct v4l2_selection sel_padded;
+ int s_sel_ret = EINVAL;
int ret;
fail_on_test(doioctl(node, VIDIOC_G_SELECTION, &sel_compose));
@@ -1454,21 +1460,24 @@ static int testBasicCompose(struct node *node, unsigned type)
sel_compose.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
else
sel_compose.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
- fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_compose) != EINVAL);
+ ret = doioctl(node, VIDIOC_S_SELECTION, &sel_compose);
+ if (ret == ENOTTY)
+ s_sel_ret = ret;
+ fail_on_test(ret != s_sel_ret);
// Check handling of invalid type.
sel_compose.type = 0xff;
- fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_compose) != EINVAL);
+ fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_compose) != s_sel_ret);
// Check handling of invalid target.
sel_compose.type = type;
sel_compose.target = 0xffff;
- fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_compose) != EINVAL);
+ fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_compose) != s_sel_ret);
// Check handling of read-only targets.
sel_compose.target = V4L2_SEL_TGT_COMPOSE_DEFAULT;
- fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_compose) != EINVAL);
+ fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_compose) != s_sel_ret);
sel_compose.target = V4L2_SEL_TGT_COMPOSE_BOUNDS;
- fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_compose) != EINVAL);
+ fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_compose) != s_sel_ret);
sel_compose.target = V4L2_SEL_TGT_COMPOSE_PADDED;
- fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_compose) != EINVAL);
+ fail_on_test(doioctl(node, VIDIOC_S_SELECTION, &sel_compose) != s_sel_ret);
return 0;
}

Privacy Policy