tests: add virgl_test_transfer_1d

Add a working case
macos/master
Marc-André Lureau 10 years ago committed by Dave Airlie
parent 0d033a1380
commit 9ae41c26fe
  1. 42
      tests/test_virgl_transfer.c

@ -277,6 +277,46 @@ START_TEST(virgl_test_transfer_read_3d_bad_box)
}
END_TEST
START_TEST(virgl_test_transfer_1d)
{
struct virgl_resource res;
unsigned char data[50*4];
struct iovec iov = { .iov_base = data, .iov_len = sizeof(data) };
int niovs = 1;
int ret, i;
struct virgl_box box;
/* init and create simple 2D resource */
ret = testvirgl_create_backed_simple_1d_res(&res, 1);
ck_assert_int_eq(ret, 0);
/* attach resource to context */
virgl_renderer_ctx_attach_resource(1, res.handle);
box.x = box.y = box.z = 0;
box.w = 50;
box.h = 1;
box.d = 1;
for (i = 0; i < sizeof(data); i++)
data[i] = i;
ret = virgl_renderer_transfer_write_iov(res.handle, 1, 0, 0, 0, &box, 0, &iov, niovs);
ck_assert_int_eq(ret, 0);
ret = virgl_renderer_transfer_read_iov(res.handle, 1, 0, 0, 0, &box, 0, NULL, 0);
ck_assert_int_eq(ret, 0);
/* check the returned values */
unsigned char *ptr = res.iovs[0].iov_base;
for (i = 0; i < sizeof(data); i++) {
ck_assert_int_eq(ptr[i], i);
}
virgl_renderer_ctx_detach_resource(1, res.handle);
testvirgl_destroy_backed_res(&res);
}
END_TEST
Suite *virgl_init_suite(void)
{
Suite *s;
@ -298,6 +338,8 @@ Suite *virgl_init_suite(void)
tcase_add_test(tc_core, virgl_test_transfer_write_1d_bad_box);
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);
suite_add_tcase(s, tc_core);
return s;

Loading…
Cancel
Save