[Libva] [PATCH RFC intel-driver 03/11] test: add initial test_i965_drv_video target

U. Artie Eoff ullysses.a.eoff at intel.com
Thu Sep 1 19:59:37 UTC 2016


Add test_i965_drv_video as noinst program with an initial
test main() definition.

Also provide a test.h header with common test includes and
definitions that can be included by all test compilation
units.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff at intel.com>
---
 test/Makefile.am   | 43 +++++++++++++++++++++++++++++++++++++++++++
 test/test.h        | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 test/test_main.cpp | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 124 insertions(+)
 create mode 100644 test/test.h
 create mode 100644 test/test_main.cpp

diff --git a/test/Makefile.am b/test/Makefile.am
index aa797032829d..19ad34746541 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -9,6 +9,8 @@ AM_CPPFLAGS =								\
 	-DGTEST_USE_OWN_TR1_TUPLE=0					\
 	-DGTEST_LANG_CXX11=1						\
 	-DGTEST_HAS_TR1_TUPLE=1						\
+	-DPTHREADS							\
+	-DVA_DRIVERS_PATH="\"$(LIBVA_DRIVERS_PATH)\""			\
 	-std=c++11							\
 	$(NULL)
 
@@ -16,6 +18,7 @@ AM_LDFLAGS =								\
 	-pthread							\
 	$(NULL)
 
+# libgtest
 noinst_LTLIBRARIES = libgtest.la
 
 libgtest_la_SOURCES =							\
@@ -36,3 +39,43 @@ EXTRA_DIST =								\
 	gtest/README.md							\
 	gtest/LICENSE							\
 	$(NULL)
+
+# test_i965_drv_video
+noinst_PROGRAMS = test_i965_drv_video
+noinst_HEADERS =							\
+	test.h								\
+	$(NULL)
+
+test_i965_drv_video_SOURCES =						\
+	test_main.cpp							\
+	$(NULL)
+
+test_i965_drv_video_LDFLAGS =						\
+	$(DRM_LDFLAGS)							\
+	$(LIBVA_DEPS_LDFLAGS)						\
+	$(LIBVA_DRM_DEPS_LDFLAGS)					\
+	$(AM_LDFLAGS)							\
+	$(NULL)
+
+test_i965_drv_video_LDADD =						\
+	libgtest.la							\
+	$(DRM_LIBS)							\
+	$(LIBVA_DEPS_LIBS)						\
+	$(LIBVA_DRM_DEPS_LIBS)						\
+	-ldrm_intel -lm -ldl						\
+	$(NULL)
+
+test_i965_drv_video_CPPFLAGS =						\
+	$(DRM_CFLAGS)							\
+	$(LIBVA_DEPS_CFLAGS)						\
+	$(LIBVA_DRM_DEPS_CFLAGS)					\
+	$(AM_CPPFLAGS)							\
+	$(NULL)
+
+test_i965_drv_video_CXXFLAGS =						\
+	-Wall -Werror							\
+	$(AM_CXXFLAGS)							\
+	$(NULL)
+
+check-local: test_i965_drv_video
+	$(builddir)/test_i965_drv_video
diff --git a/test/test.h b/test/test.h
new file mode 100644
index 000000000000..24c2933c9bac
--- /dev/null
+++ b/test/test.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2016 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef TEST_H
+#define TEST_H
+
+#include <gtest/gtest.h>
+#include <va/va.h>
+
+#define EXPECT_STATUS(status) \
+    EXPECT_EQ(VA_STATUS_SUCCESS, (status))
+
+#define ASSERT_STATUS(status) \
+    ASSERT_EQ(VA_STATUS_SUCCESS, (status))
+
+#define EXPECT_ID(id) \
+    EXPECT_NE(VA_INVALID_ID, (id))
+
+#define ASSERT_ID(id) \
+    ASSERT_NE(VA_INVALID_ID, (id))
+
+#define EXPECT_PTR(ptr) \
+    EXPECT_FALSE(NULL == (ptr))
+
+#define ASSERT_PTR(ptr) \
+    ASSERT_FALSE(NULL == (ptr))
+
+#endif // TEST_H
diff --git a/test/test_main.cpp b/test/test_main.cpp
new file mode 100644
index 000000000000..55a5b091f031
--- /dev/null
+++ b/test/test_main.cpp
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2016 Intel Corporation. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "test.h"
+
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+
+    return RUN_ALL_TESTS();
+}
-- 
2.4.11



More information about the Libva mailing list