From 0e19ae80146fbe752e9977ef88802c6f82fd58eb Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 4 Feb 2015 14:14:17 +1000 Subject: [PATCH] tests: test trying to detach a resource we never attached. Just makes sure we don't corrupt memory of do anything dumb --- tests/test_virgl_init.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/test_virgl_init.c b/tests/test_virgl_init.c index b5118f2..0949105 100644 --- a/tests/test_virgl_init.c +++ b/tests/test_virgl_init.c @@ -135,6 +135,30 @@ START_TEST(virgl_init_egl_create_ctx_create_bind_res) } END_TEST +START_TEST(virgl_init_egl_create_ctx_create_unbind_no_bind) +{ + 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); + + testvirgl_init_simple_1d_resource(&res, 1); + + ret = virgl_renderer_resource_create(&res, NULL, 0); + ck_assert_int_eq(ret, 0); + + virgl_renderer_ctx_detach_resource(1, res.handle); + + virgl_renderer_resource_unref(1); + virgl_renderer_context_destroy(1); + virgl_renderer_cleanup(&mystruct); +} +END_TEST + START_TEST(virgl_init_egl_create_ctx_create_bind_res_leak) { int ret; @@ -316,6 +340,7 @@ Suite *virgl_init_suite(void) tcase_add_test(tc_core, virgl_init_egl_create_ctx); tcase_add_test(tc_core, virgl_init_egl_create_ctx_leak); tcase_add_test(tc_core, virgl_init_egl_create_ctx_create_bind_res); + tcase_add_test(tc_core, virgl_init_egl_create_ctx_create_unbind_no_bind); tcase_add_test(tc_core, virgl_init_egl_create_ctx_create_bind_res_leak); tcase_add_test(tc_core, virgl_init_egl_create_ctx_reset); tcase_add_test(tc_core, virgl_init_get_caps_set0);