1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program OpenGL ES 3.1 Module
3 * -------------------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief OpenGL ES 3.1 Test Package
22 *//*--------------------------------------------------------------------*/
24 #include "tes31TestPackage.hpp"
25 #include "tes31InfoTests.hpp"
26 #include "es31fFunctionalTests.hpp"
27 #include "es31sStressTests.hpp"
28 #include "gluStateReset.hpp"
29 #include "gluRenderContext.hpp"
30 #include "tcuTestLog.hpp"
37 class TestCaseWrapper : public tcu::TestCaseExecutor
40 TestCaseWrapper (TestPackage& package);
41 ~TestCaseWrapper (void);
43 void init (tcu::TestCase* testCase, const std::string& path);
44 void deinit (tcu::TestCase* testCase);
45 tcu::TestNode::IterateResult iterate (tcu::TestCase* testCase);
48 TestPackage& m_testPackage;
51 TestCaseWrapper::TestCaseWrapper (TestPackage& package)
52 : m_testPackage(package)
56 TestCaseWrapper::~TestCaseWrapper (void)
60 void TestCaseWrapper::init (tcu::TestCase* testCase, const std::string&)
65 void TestCaseWrapper::deinit (tcu::TestCase* testCase)
69 DE_ASSERT(m_testPackage.getContext());
70 glu::resetState(m_testPackage.getContext()->getRenderContext(), m_testPackage.getContext()->getContextInfo());
73 tcu::TestNode::IterateResult TestCaseWrapper::iterate (tcu::TestCase* testCase)
75 tcu::TestContext& testCtx = m_testPackage.getContext()->getTestContext();
76 const tcu::TestCase::IterateResult result = testCase->iterate();
78 // Call implementation specific post-iterate routine (usually handles native events and swaps buffers)
81 m_testPackage.getContext()->getRenderContext().postIterate();
84 catch (const tcu::ResourceError& e)
86 testCtx.getLog() << e;
87 testCtx.setTestResult(QP_TEST_RESULT_RESOURCE_ERROR, "Resource error in context post-iteration routine");
88 testCtx.setTerminateAfter(true);
89 return tcu::TestNode::STOP;
91 catch (const std::exception& e)
93 testCtx.getLog() << e;
94 testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Error in context post-iteration routine");
95 return tcu::TestNode::STOP;
99 TestPackage::TestPackage (tcu::TestContext& testCtx)
100 : tcu::TestPackage (testCtx, "dEQP-GLES31", "dEQP OpenGL ES 3.1 Tests")
101 , m_archive (testCtx.getRootArchive(), "gles31/")
102 , m_context (DE_NULL)
106 TestPackage::~TestPackage (void)
108 // Destroy children first since destructors may access context.
113 void TestPackage::init (void)
118 m_context = new Context(m_testCtx);
120 // Add main test groups
121 addChild(new InfoTests (*m_context));
122 addChild(new Functional::FunctionalTests (*m_context));
123 addChild(new Stress::StressTests (*m_context));
134 void TestPackage::deinit (void)
141 tcu::TestCaseExecutor* TestPackage::createExecutor (void) const
143 return new TestCaseWrapper(const_cast<TestPackage&>(*this));