summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDave Airlie <airlied@gmail.com>2015-03-05 07:49:16 +1000
committerDave Airlie <airlied@gmail.com>2015-03-05 07:49:16 +1000
commit88b48d0606e81790097926d988cc1e012a30c110 (patch)
tree649379b1481e7ed9f949d1fb8b5c3327f3a5475f /tests
parente7afcd62cf75508a93b6dace51fcf3bcb9603457 (diff)
tests: add transfer test with bad offset
We need to take offset into account when doing transfer size testing.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_virgl_transfer.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_virgl_transfer.c b/tests/test_virgl_transfer.c
index 48c4582..b628f4d 100644
--- a/tests/test_virgl_transfer.c
+++ b/tests/test_virgl_transfer.c
@@ -343,6 +343,33 @@ START_TEST(virgl_test_transfer_1d_bad_iov)
}
END_TEST
+START_TEST(virgl_test_transfer_1d_bad_iov_offset)
+{
+ struct virgl_renderer_resource_create_args res;
+ unsigned char data[50*4];
+ struct iovec iov = { .iov_base = data, .iov_len = sizeof(data) };
+ int niovs = 1;
+ int ret;
+ struct virgl_box box = { .w = 50, .h = 1, .d = 1 };
+
+ testvirgl_init_simple_1d_resource(&res, 1);
+ res.target = PIPE_TEXTURE_1D;
+ res.depth = 1;
+
+ ret = virgl_renderer_resource_create(&res, NULL, 0);
+ ck_assert_int_eq(ret, 0);
+
+ virgl_renderer_ctx_attach_resource(1, res.handle);
+
+ ret = virgl_renderer_transfer_write_iov(res.handle, 1, 0, 0, 0, &box, 20, &iov, niovs);
+ ck_assert_int_eq(ret, EINVAL);
+
+ virgl_renderer_ctx_detach_resource(1, res.handle);
+
+ virgl_renderer_resource_unref(1);
+}
+END_TEST
+
Suite *virgl_init_suite(void)
{
Suite *s;
@@ -366,6 +393,7 @@ Suite *virgl_init_suite(void)
tcase_add_test(tc_core, virgl_test_transfer_read_3d_bad_box);
tcase_add_test(tc_core, virgl_test_transfer_1d);
tcase_add_test(tc_core, virgl_test_transfer_1d_bad_iov);
+ tcase_add_test(tc_core, virgl_test_transfer_1d_bad_iov_offset);
suite_add_tcase(s, tc_core);
return s;