tests: Basic initialization test using gtest framework
diff --git a/tests/common.h b/tests/common.h
index af8b7cd..0107903 100644
--- a/tests/common.h
+++ b/tests/common.h
@@ -33,6 +33,8 @@
#include <xgl.h>
+#define ASSERT_XGL_SUCCESS(err) ASSERT_EQ(XGL_SUCCESS, err) << xgl_result_string(err)
+
#ifdef __cplusplus
extern "C"
{
diff --git a/tests/init.cpp b/tests/init.cpp
index 149f6e1..d9ffa4f 100644
--- a/tests/init.cpp
+++ b/tests/init.cpp
@@ -61,7 +61,7 @@
err = xglInitAndEnumerateGpus(&app_info, NULL,
MAX_GPUS, &gpu_count, objs);
- ASSERT_EQ(XGL_SUCCESS, err) << xgl_result_string(err);
+ ASSERT_XGL_SUCCESS(err);
gpu = &gpus[0];
memset(gpu, 0, sizeof(*gpu));
@@ -72,4 +72,41 @@
err = xglGetGpuInfo(gpu->obj,
XGL_INFO_TYPE_PHYSICAL_GPU_PROPERTIES,
&size, &gpu->props);
+ ASSERT_XGL_SUCCESS(err);
+ ASSERT_EQ(size, sizeof(gpu->props));
+
+ err = xglGetGpuInfo(gpu->obj,
+ XGL_INFO_TYPE_PHYSICAL_GPU_PERFORMANCE,
+ &size, &gpu->perf);
+ ASSERT_XGL_SUCCESS(err);
+ ASSERT_EQ(size, sizeof(gpu->perf));
+
+ /* get queue count */
+ err = xglGetGpuInfo(gpu->obj,
+ XGL_INFO_TYPE_PHYSICAL_GPU_QUEUE_PROPERTIES,
+ &size, NULL);
+ ASSERT_XGL_SUCCESS(err);
+ gpu->queue_count = size / sizeof(gpu->queue_props[0]);
+ ASSERT_EQ(gpu->queue_count*sizeof(gpu->queue_props[0]), size) << "invalid GPU_QUEUE_PROPERTIES size";
+
+ gpu->queue_props = (XGL_PHYSICAL_GPU_QUEUE_PROPERTIES *)
+ malloc(sizeof(gpu->queue_props[0]) * gpu->queue_count);
+ ASSERT_TRUE(NULL != gpu->queue_props) << "Out of memory";
+
+ err = xglGetGpuInfo(gpu->obj,
+ XGL_INFO_TYPE_PHYSICAL_GPU_QUEUE_PROPERTIES,
+ &size, gpu->queue_props);
+ ASSERT_EQ(gpu->queue_count*sizeof(gpu->queue_props[0]), size) << "invalid GPU_QUEUE_PROPERTIES size";
+
+ err = xglGetGpuInfo(gpu->obj,
+ XGL_INFO_TYPE_PHYSICAL_GPU_MEMORY_PROPERTIES,
+ &size, &gpu->memory_props);
+ ASSERT_XGL_SUCCESS(err);
+ ASSERT_EQ(size, sizeof(gpu->memory_props));
+
+}
+
+int main(int argc, char **argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
}