tests: create and bind a resource to a context

cleanup properly and make sure no leaks.
macos/master
Dave Airlie 10 years ago
parent 474591db5f
commit 4920fc6d1d
  1. 38
      tests/test_virgl_init.c

@ -60,9 +60,44 @@ START_TEST(virgl_init_egl_create_ctx)
virgl_renderer_context_destroy(1); virgl_renderer_context_destroy(1);
virgl_renderer_cleanup(&mystruct); virgl_renderer_cleanup(&mystruct);
} }
END_TEST END_TEST
START_TEST(virgl_init_egl_create_ctx_create_bind_res)
{
int ret;
struct virgl_renderer_resource_create_args res;
test_cbs.version = 1;
ret = virgl_renderer_init(&mystruct, VIRGL_RENDERER_USE_EGL, &test_cbs);
ck_assert_int_eq(ret, 0);
ret = virgl_renderer_context_create(1, strlen("test1"), "test1");
ck_assert_int_eq(ret, 0);
res.handle = 1;
res.target = 1;
res.format = 2;
res.width = 50;
res.height = 50;
res.depth = 1;
res.array_size = 1;
res.last_level = 0;
res.nr_samples = 0;
res.bind = 0;
res.flags = 0;
ret = virgl_renderer_resource_create(&res, NULL, 0);
ck_assert_int_eq(ret, 0);
virgl_renderer_ctx_attach_resource(1, res.handle);
virgl_renderer_ctx_detach_resource(1, res.handle);
virgl_renderer_resource_unref(1);
virgl_renderer_context_destroy(1);
virgl_renderer_cleanup(&mystruct);
}
END_TEST
Suite *virgl_init_suite(void) Suite *virgl_init_suite(void)
{ {
Suite *s; Suite *s;
@ -76,6 +111,7 @@ Suite *virgl_init_suite(void)
tcase_add_test(tc_core, virgl_init_cbs_wrong_ver); tcase_add_test(tc_core, virgl_init_cbs_wrong_ver);
tcase_add_test(tc_core, virgl_init_egl); tcase_add_test(tc_core, virgl_init_egl);
tcase_add_test(tc_core, virgl_init_egl_create_ctx); tcase_add_test(tc_core, virgl_init_egl_create_ctx);
tcase_add_test(tc_core, virgl_init_egl_create_ctx_create_bind_res);
suite_add_tcase(s, tc_core); suite_add_tcase(s, tc_core);
return s; return s;

Loading…
Cancel
Save