tests: add capability retrival tests

macos/master
Dave Airlie 10 years ago
parent 96e1b0b693
commit 259fd7ea04
  1. 43
      tests/test_virgl_init.c

@ -32,6 +32,7 @@
#include <virglrenderer.h>
#include "testvirgl.h"
#include "virgl_hw.h"
struct myinfo_struct {
uint32_t test;
};
@ -178,6 +179,46 @@ START_TEST(virgl_init_egl_create_ctx_reset)
}
END_TEST
START_TEST(virgl_init_get_caps_set0)
{
int ret;
uint32_t max_ver, max_size;
test_cbs.version = 1;
ret = virgl_renderer_init(&mystruct, VIRGL_RENDERER_USE_EGL, &test_cbs);
ck_assert_int_eq(ret, 0);
virgl_renderer_get_cap_set(0, &max_ver, &max_size);
ck_assert_int_eq(max_ver, 0);
ck_assert_int_eq(max_size, 0);
virgl_renderer_cleanup(&mystruct);
}
END_TEST
START_TEST(virgl_init_get_caps_set1)
{
int ret;
uint32_t max_ver, max_size;
void *caps;
test_cbs.version = 1;
ret = virgl_renderer_init(&mystruct, VIRGL_RENDERER_USE_EGL, &test_cbs);
ck_assert_int_eq(ret, 0);
virgl_renderer_get_cap_set(1, &max_ver, &max_size);
ck_assert_int_eq(max_ver, 1);
ck_assert_int_ne(max_size, 0);
ck_assert_int_eq(max_size, sizeof(struct virgl_caps_v1));
caps = malloc(max_size);
virgl_renderer_fill_caps(0, 0, caps);
free(caps);
virgl_renderer_cleanup(&mystruct);
}
END_TEST
Suite *virgl_init_suite(void)
{
Suite *s;
@ -195,6 +236,8 @@ Suite *virgl_init_suite(void)
tcase_add_test(tc_core, virgl_init_egl_create_ctx_create_bind_res);
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);
tcase_add_test(tc_core, virgl_init_get_caps_set1);
suite_add_tcase(s, tc_core);
return s;

Loading…
Cancel
Save