From 7078c99118295be14c4bde686e0b26c42bc9699b Mon Sep 17 00:00:00 2001 From: Piotr Byszewski Date: Tue, 4 Jul 2017 10:29:08 +0200 Subject: [PATCH] Add exposed extensions test GL implementations should not expose any OES extensions except GL_OES_EGL_image. GLES implementations should not expose any ARB extensions. Components: OpenGL VK-GL-CTS issue: 49 Affects: KHR-GL40.exposed_extensions.* KHR-GLES3.exposed_extensions.* Change-Id: Ic3a11850bb1b5c4414cdd9f04614b51d428d6a4f --- .../gl/khronos_mustpass/4.5.5.x/gl40-master.txt | 1 + .../gl/khronos_mustpass/4.5.5.x/gl41-master.txt | 1 + .../gl/khronos_mustpass/4.5.5.x/gl42-master.txt | 1 + .../gl/khronos_mustpass/4.5.5.x/gl43-master.txt | 1 + .../gl/khronos_mustpass/4.5.5.x/gl44-master.txt | 1 + .../gl/khronos_mustpass/4.5.5.x/gl45-master.txt | 1 + .../khronos_mustpass/3.2.4.x/gles3-khr-master.txt | 1 + .../khronos_mustpass/master/gles3-khr-master.txt | 1 + external/openglcts/modules/common/CMakeLists.txt | 2 + .../modules/common/glcExposedExtensionsTests.cpp | 166 +++++++++++++++++++++ .../modules/common/glcExposedExtensionsTests.hpp | 54 +++++++ external/openglcts/modules/gl/gl4cTestPackages.cpp | 2 + .../openglcts/modules/gles3/es3cTestPackage.cpp | 2 + 13 files changed, 234 insertions(+) create mode 100644 external/openglcts/modules/common/glcExposedExtensionsTests.cpp create mode 100644 external/openglcts/modules/common/glcExposedExtensionsTests.hpp diff --git a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl40-master.txt b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl40-master.txt index 28859fc..179e671 100644 --- a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl40-master.txt +++ b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl40-master.txt @@ -2815,3 +2815,4 @@ KHR-GL40.texture_barrier_ARB.disjoint-texels KHR-GL40.texture_barrier_ARB.overlapping-texels KHR-GL40.texture_barrier_ARB.same-texel-rw KHR-GL40.texture_barrier_ARB.same-texel-rw-multipass +KHR-GL40.exposed_extensions.validate_extensions diff --git a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl41-master.txt b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl41-master.txt index 597b53b..51408a9 100644 --- a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl41-master.txt +++ b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl41-master.txt @@ -2815,6 +2815,7 @@ KHR-GL41.texture_barrier_ARB.disjoint-texels KHR-GL41.texture_barrier_ARB.overlapping-texels KHR-GL41.texture_barrier_ARB.same-texel-rw KHR-GL41.texture_barrier_ARB.same-texel-rw-multipass +KHR-GL41.exposed_extensions.validate_extensions KHR-GL41.vertex_attrib_64bit.api_errors KHR-GL41.vertex_attrib_64bit.get_vertex_attrib KHR-GL41.vertex_attrib_64bit.limits_test diff --git a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl42-master.txt b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl42-master.txt index 905a25c..bd0dc05 100644 --- a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl42-master.txt +++ b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl42-master.txt @@ -2815,6 +2815,7 @@ KHR-GL42.texture_barrier_ARB.disjoint-texels KHR-GL42.texture_barrier_ARB.overlapping-texels KHR-GL42.texture_barrier_ARB.same-texel-rw KHR-GL42.texture_barrier_ARB.same-texel-rw-multipass +KHR-GL42.exposed_extensions.validate_extensions KHR-GL42.vertex_attrib_64bit.api_errors KHR-GL42.vertex_attrib_64bit.get_vertex_attrib KHR-GL42.vertex_attrib_64bit.limits_test diff --git a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl43-master.txt b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl43-master.txt index 38179cf..5b18233 100644 --- a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl43-master.txt +++ b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl43-master.txt @@ -2815,6 +2815,7 @@ KHR-GL43.texture_barrier_ARB.disjoint-texels KHR-GL43.texture_barrier_ARB.overlapping-texels KHR-GL43.texture_barrier_ARB.same-texel-rw KHR-GL43.texture_barrier_ARB.same-texel-rw-multipass +KHR-GL43.exposed_extensions.validate_extensions KHR-GL43.vertex_attrib_64bit.api_errors KHR-GL43.vertex_attrib_64bit.get_vertex_attrib KHR-GL43.vertex_attrib_64bit.limits_test diff --git a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl44-master.txt b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl44-master.txt index 9aaa364..c24a189 100644 --- a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl44-master.txt +++ b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl44-master.txt @@ -2815,6 +2815,7 @@ KHR-GL44.texture_barrier_ARB.disjoint-texels KHR-GL44.texture_barrier_ARB.overlapping-texels KHR-GL44.texture_barrier_ARB.same-texel-rw KHR-GL44.texture_barrier_ARB.same-texel-rw-multipass +KHR-GL44.exposed_extensions.validate_extensions KHR-GL44.vertex_attrib_64bit.api_errors KHR-GL44.vertex_attrib_64bit.get_vertex_attrib KHR-GL44.vertex_attrib_64bit.limits_test diff --git a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl45-master.txt b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl45-master.txt index 4d2802a..08a1043 100644 --- a/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl45-master.txt +++ b/external/openglcts/data/mustpass/gl/khronos_mustpass/4.5.5.x/gl45-master.txt @@ -2815,6 +2815,7 @@ KHR-GL45.texture_barrier_ARB.disjoint-texels KHR-GL45.texture_barrier_ARB.overlapping-texels KHR-GL45.texture_barrier_ARB.same-texel-rw KHR-GL45.texture_barrier_ARB.same-texel-rw-multipass +KHR-GL45.exposed_extensions.validate_extensions KHR-GL45.vertex_attrib_64bit.api_errors KHR-GL45.vertex_attrib_64bit.get_vertex_attrib KHR-GL45.vertex_attrib_64bit.limits_test diff --git a/external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.4.x/gles3-khr-master.txt b/external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.4.x/gles3-khr-master.txt index d8ad627..fc4d308 100644 --- a/external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.4.x/gles3-khr-master.txt +++ b/external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.4.x/gles3-khr-master.txt @@ -2560,3 +2560,4 @@ KHR-GLES3.shaders.negative.initialize KHR-GLES3.shaders.negative.constant_sequence KHR-GLES3.texture_filter_anisotropic.queries KHR-GLES3.texture_filter_anisotropic.drawing +KHR-GLES3.exposed_extensions.validate_extensions diff --git a/external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles3-khr-master.txt b/external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles3-khr-master.txt index d8ad627..fc4d308 100644 --- a/external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles3-khr-master.txt +++ b/external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles3-khr-master.txt @@ -2560,3 +2560,4 @@ KHR-GLES3.shaders.negative.initialize KHR-GLES3.shaders.negative.constant_sequence KHR-GLES3.texture_filter_anisotropic.queries KHR-GLES3.texture_filter_anisotropic.drawing +KHR-GLES3.exposed_extensions.validate_extensions diff --git a/external/openglcts/modules/common/CMakeLists.txt b/external/openglcts/modules/common/CMakeLists.txt index dac7960..a5d55cf 100644 --- a/external/openglcts/modules/common/CMakeLists.txt +++ b/external/openglcts/modules/common/CMakeLists.txt @@ -20,6 +20,8 @@ set(GLCTS_COMMON_SRCS glcConfigPackage.hpp glcContext.cpp glcContext.hpp + glcExposedExtensionsTests.cpp + glcExposedExtensionsTests.hpp glcFragDepthTests.cpp glcFragDepthTests.hpp glcInfoTests.cpp diff --git a/external/openglcts/modules/common/glcExposedExtensionsTests.cpp b/external/openglcts/modules/common/glcExposedExtensionsTests.cpp new file mode 100644 index 0000000..8651674 --- /dev/null +++ b/external/openglcts/modules/common/glcExposedExtensionsTests.cpp @@ -0,0 +1,166 @@ +/*------------------------------------------------------------------------- + * OpenGL Conformance Test Suite + * ----------------------------- + * + * Copyright (c) 2017 The Khronos Group Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ /*! + * \file glcExtensionsExposeTests.cpp + * \brief Test that check if specified substring is not in extension name. + */ /*--------------------------------------------------------------------*/ + +#include "glcExposedExtensionsTests.hpp" +#include "gluContextInfo.hpp" +#include "gluDefs.hpp" +#include "glwEnums.hpp" +#include "glwFunctions.hpp" +#include "tcuCommandLine.hpp" +#include "tcuTestLog.hpp" +#include +#include + +using namespace glu; + +namespace glcts +{ + +class ExposedExtensionsTest : public deqp::TestCase +{ +public: + /* Public methods */ + ExposedExtensionsTest(deqp::Context& context, std::string notAllowedSubstring, + const std::vector* allowedExceptions = NULL); + + virtual ~ExposedExtensionsTest(void); + + void deinit(void); + void init(void); + tcu::TestNode::IterateResult iterate(void); + +private: + /* Private members */ + std::string m_notAllowedSubstring; + std::vector m_allowedExceptions; +}; + +/** Constructor. + * + * @param context Rendering context + * @param name Test name + * @param description Test description + * @param notAllowedSubstring Substring that should not be found in extension name. + * @param allowedExceptions List of exceptions that are allowed even despite + * containing notAllowedFraze. + */ +ExposedExtensionsTest::ExposedExtensionsTest(deqp::Context& context, std::string notAllowedSubstring, + const std::vector* allowedExceptions) + : deqp::TestCase(context, "validate_extensions", "Test verifies if extensions with " + "specified phrase are not exposed.") + , m_notAllowedSubstring(notAllowedSubstring) +{ + if (allowedExceptions) + { + m_allowedExceptions = *allowedExceptions; + } +} + +ExposedExtensionsTest::~ExposedExtensionsTest(void) +{ +} + +/** Tears down any GL objects set up to run the test. */ +void ExposedExtensionsTest::deinit(void) +{ +} + +/** Stub init method */ +void ExposedExtensionsTest::init(void) +{ +} + +/** Executes test iteration. + * + * @return Returns STOP when test has finished executing, CONTINUE if more iterations are needed. + */ +tcu::TestNode::IterateResult ExposedExtensionsTest::iterate(void) +{ + typedef std::vector string_vector; + const string_vector& extensions = m_context.getContextInfo().getExtensions(); + string_vector::const_iterator currExtension = extensions.begin(); + bool allExceptionsAreValid = true; + + while (currExtension != extensions.end()) + { + // If the current extension does not contain not allowed substring then continue + if (currExtension->find(m_notAllowedSubstring) == std::string::npos) + { + ++currExtension; + continue; + } + + // Check if current extension is one of allowed exceptions + bool currExtensionIsNotAnException = true; + string_vector::const_iterator exception = m_allowedExceptions.begin(); + while (exception != m_allowedExceptions.end()) + { + if ((*exception).compare(*currExtension) == 0) + { + currExtensionIsNotAnException = false; + break; + } + ++exception; + } + + // Current exception is not on allowed exceptions list, test will fail + // but other exceptions will be checked to log all not allowed extensions + if (currExtensionIsNotAnException) + { + m_testCtx.getLog() << tcu::TestLog::Message << "Implementations should not expose " << *currExtension + << tcu::TestLog::EndMessage; + allExceptionsAreValid = false; + } + + ++currExtension; + } + + if (allExceptionsAreValid) + { + m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass"); + return STOP; + } + + m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail"); + return STOP; +} + +ExposedExtensionsTests::ExposedExtensionsTests(deqp::Context& context) + : TestCaseGroup(context, "exposed_extensions", "Verifies exposed extensions") +{ +} + +void ExposedExtensionsTests::init(void) +{ + if (isContextTypeES(m_context.getRenderContext().getType())) + { + addChild(new ExposedExtensionsTest(m_context, "ARB")); + } + else + { + std::vector allowedExtensions(1, "GL_OES_EGL_image"); + addChild(new glcts::ExposedExtensionsTest(getContext(), "OES", &allowedExtensions)); + } +} + +} /* glcts namespace */ diff --git a/external/openglcts/modules/common/glcExposedExtensionsTests.hpp b/external/openglcts/modules/common/glcExposedExtensionsTests.hpp new file mode 100644 index 0000000..6e490a3 --- /dev/null +++ b/external/openglcts/modules/common/glcExposedExtensionsTests.hpp @@ -0,0 +1,54 @@ +#ifndef _GLCEXPOSEDEXTENSIONSTESTS_HPP +#define _GLCEXPOSEDEXTENSIONSTESTS_HPP +/*------------------------------------------------------------------------- + * OpenGL Conformance Test Suite + * ----------------------------- + * + * Copyright (c) 2017 The Khronos Group Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ /*! + * \file glcExtensionsExposeTests.cpp + * \brief Test that check if specified substring is not in extension name. + */ /*-------------------------------------------------------------------*/ + +#include "glcTestCase.hpp" +#include "glwDefs.hpp" +#include "tcuDefs.hpp" + +namespace glcts +{ +/** Test verifies if extensions with specified phrase are not exposed. + */ + +class ExposedExtensionsTests : public deqp::TestCaseGroup +{ +public: + /* Public methods */ + ExposedExtensionsTests(deqp::Context& context); + virtual ~ExposedExtensionsTests() + { + } + + virtual void init(void); + +private: + /* Private methods */ + ExposedExtensionsTests(const ExposedExtensionsTests&); + ExposedExtensionsTests& operator=(const ExposedExtensionsTests&); +}; + +} /* glcts namespace */ + +#endif // _GLCEXPOSEDEXTENSIONSTESTS_HPP diff --git a/external/openglcts/modules/gl/gl4cTestPackages.cpp b/external/openglcts/modules/gl/gl4cTestPackages.cpp index de91d14..904b68c 100644 --- a/external/openglcts/modules/gl/gl4cTestPackages.cpp +++ b/external/openglcts/modules/gl/gl4cTestPackages.cpp @@ -69,6 +69,7 @@ #include "gl4cVertexAttrib64BitTest.hpp" #include "gl4cVertexAttribBindingTests.hpp" #include "glcBlendEquationAdvancedTests.hpp" +#include "glcExposedExtensionsTests.hpp" #include "glcInfoTests.hpp" #include "glcRobustBufferAccessBehaviorTests.hpp" #include "glcSampleVariablesTests.hpp" @@ -125,6 +126,7 @@ void GL40TestPackage::init(void) addChild(new gl4cts::ShaderSubroutineTests(getContext())); addChild( new gl4cts::TextureBarrierTests(getContext(), gl4cts::TextureBarrierTests::API_GL_ARB_texture_barrier)); + addChild(new glcts::ExposedExtensionsTests(getContext())); } catch (...) { diff --git a/external/openglcts/modules/gles3/es3cTestPackage.cpp b/external/openglcts/modules/gles3/es3cTestPackage.cpp index 348d7bd..ddb4036 100644 --- a/external/openglcts/modules/gles3/es3cTestPackage.cpp +++ b/external/openglcts/modules/gles3/es3cTestPackage.cpp @@ -23,6 +23,7 @@ */ /*-------------------------------------------------------------------*/ #include "es3cTestPackage.hpp" +#include "glcExposedExtensionsTests.hpp" #include "glcFragDepthTests.hpp" #include "glcInfoTests.hpp" #include "glcShaderIndexingTests.hpp" @@ -153,6 +154,7 @@ void ES30TestPackage::init(void) { addChild(new ShaderTests(getContext())); addChild(new glcts::TextureFilterAnisotropicTests(getContext())); + addChild(new glcts::ExposedExtensionsTests(getContext())); } catch (...) { -- 2.7.4