tests: add check of bad iov write

macos/master
Marc-André Lureau 10 years ago committed by Dave Airlie
parent abff45cff0
commit f66acaff87
  1. 27
      tests/test_virgl_transfer.c

@ -317,6 +317,32 @@ START_TEST(virgl_test_transfer_1d)
}
END_TEST
START_TEST(virgl_test_transfer_1d_bad_iov)
{
struct virgl_renderer_resource_create_args res;
struct iovec iovs[1] = { { NULL, 23 } };
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, 0, iovs, 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;
@ -339,6 +365,7 @@ Suite *virgl_init_suite(void)
tcase_add_test(tc_core, virgl_test_transfer_read_1d_array_bad_box);
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);
suite_add_tcase(s, tc_core);
return s;

Loading…
Cancel
Save