[Libva] [PATCH intel-driver 4/4] test: use common I965ConfigTest fixture for jpeg enc/dec

U. Artie Eoff ullysses.a.eoff at intel.com
Wed Oct 5 17:54:27 UTC 2016


Instantiate the JPEG encode/decode Entrypoint tests from
the common I965ConfigTest fixture with additional test
inputs.  Also, separate them into their own files.  This
changes their test case names, too.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff at intel.com>
---
 test/Makefile.am                |  2 ++
 test/i965_jpeg_decode_test.cpp  | 22 ----------------
 test/i965_jpeg_encode_test.cpp  | 18 -------------
 test/i965_jpegd_config_test.cpp | 50 ++++++++++++++++++++++++++++++++++++
 test/i965_jpege_config_test.cpp | 57 +++++++++++++++++++++++++++++++++++++++++
 5 files changed, 109 insertions(+), 40 deletions(-)
 create mode 100644 test/i965_jpegd_config_test.cpp
 create mode 100644 test/i965_jpege_config_test.cpp

diff --git a/test/Makefile.am b/test/Makefile.am
index 07189e56e6cb..08df3395a383 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -62,6 +62,8 @@ test_i965_drv_video_SOURCES =						\
 	i965_jpeg_test_data.cpp						\
 	i965_jpeg_decode_test.cpp					\
 	i965_jpeg_encode_test.cpp					\
+	i965_jpegd_config_test.cpp					\
+	i965_jpege_config_test.cpp					\
 	i965_surface_test.cpp						\
 	i965_test_environment.cpp					\
 	i965_test_fixture.cpp						\
diff --git a/test/i965_jpeg_decode_test.cpp b/test/i965_jpeg_decode_test.cpp
index 6b8462564cfd..265793d21b2e 100644
--- a/test/i965_jpeg_decode_test.cpp
+++ b/test/i965_jpeg_decode_test.cpp
@@ -38,28 +38,6 @@ namespace Decode {
 
 class JPEGDecodeTest : public I965TestFixture { };
 
-TEST_F(JPEGDecodeTest, Entrypoint)
-{
-    VAConfigID config = VA_INVALID_ID;
-    ConfigAttribs attributes;
-    struct i965_driver_data *i965(*this);
-
-    ASSERT_PTR(i965);
-
-    if (HAS_JPEG_DECODING(i965)) {
-        config = createConfig(profile, entrypoint, attributes);
-    } else {
-        VAStatus status = i965_CreateConfig(
-            *this, profile, entrypoint, attributes.data(), attributes.size(),
-            &config);
-        EXPECT_STATUS_EQ(VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT, status);
-        EXPECT_INVALID_ID(config);
-    }
-
-    if (config != VA_INVALID_ID)
-        destroyConfig(config);
-}
-
 class FourCCTest
     : public JPEGDecodeTest
     , public ::testing::WithParamInterface<
diff --git a/test/i965_jpeg_encode_test.cpp b/test/i965_jpeg_encode_test.cpp
index 86473a984ec0..29c14dc9a8b5 100644
--- a/test/i965_jpeg_encode_test.cpp
+++ b/test/i965_jpeg_encode_test.cpp
@@ -64,24 +64,6 @@ protected:
     VAContextID context;
 };
 
-TEST_F(JPEGEncodeTest, Entrypoint)
-{
-    ConfigAttribs attributes;
-    struct i965_driver_data *i965(*this);
-
-    ASSERT_PTR(i965);
-
-    if (HAS_JPEG_ENCODING(i965)) {
-        config = createConfig(profile, entrypoint, attributes);
-    } else {
-        VAStatus status = i965_CreateConfig(
-            *this, profile, entrypoint, attributes.data(), attributes.size(),
-            &config);
-        EXPECT_STATUS_EQ(VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT, status);
-        EXPECT_INVALID_ID(config);
-    }
-}
-
 class JPEGEncodeInputTest
     : public JPEGEncodeTest
     , public ::testing::WithParamInterface<
diff --git a/test/i965_jpegd_config_test.cpp b/test/i965_jpegd_config_test.cpp
new file mode 100644
index 000000000000..4e2216ce8840
--- /dev/null
+++ b/test/i965_jpegd_config_test.cpp
@@ -0,0 +1,50 @@
+/*
+ * 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 "i965_config_test.h"
+
+namespace JPEG {
+namespace Decode {
+
+VAStatus HasDecodeSupport()
+{
+    I965TestEnvironment *env(I965TestEnvironment::instance());
+    EXPECT_PTR(env);
+
+    struct i965_driver_data *i965(*env);
+    EXPECT_PTR(i965);
+
+    return HAS_JPEG_DECODING(i965) ? VA_STATUS_SUCCESS :
+        VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+}
+
+static const std::vector<ConfigTestInput> inputs = {
+    {VAProfileJPEGBaseline, VAEntrypointVLD, &HasDecodeSupport},
+};
+
+INSTANTIATE_TEST_CASE_P(
+    JPEGDecode, I965ConfigTest, ::testing::ValuesIn(inputs));
+
+} // namespace Decode
+} // namespace JPEG
diff --git a/test/i965_jpege_config_test.cpp b/test/i965_jpege_config_test.cpp
new file mode 100644
index 000000000000..924eccb44cf3
--- /dev/null
+++ b/test/i965_jpege_config_test.cpp
@@ -0,0 +1,57 @@
+/*
+ * 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 "i965_config_test.h"
+
+namespace JPEG {
+namespace Encode {
+
+VAStatus EntrypointNotSupported()
+{
+    return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
+}
+
+VAStatus HasEncodeSupport()
+{
+    I965TestEnvironment *env(I965TestEnvironment::instance());
+    EXPECT_PTR(env);
+
+    struct i965_driver_data *i965(*env);
+    EXPECT_PTR(i965);
+
+    return HAS_JPEG_ENCODING(i965) ? VA_STATUS_SUCCESS :
+        EntrypointNotSupported();
+}
+
+static const std::vector<ConfigTestInput> inputs = {
+    {VAProfileJPEGBaseline, VAEntrypointEncPicture, &HasEncodeSupport},
+    {VAProfileJPEGBaseline, VAEntrypointEncSlice, &EntrypointNotSupported},
+    {VAProfileJPEGBaseline, VAEntrypointEncSliceLP, &EntrypointNotSupported},
+};
+
+INSTANTIATE_TEST_CASE_P(
+    JPEGEncode, I965ConfigTest, ::testing::ValuesIn(inputs));
+
+} // namespace Encode
+} // namespace JPEG
-- 
2.1.0



More information about the Libva mailing list