1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program EGL Module
3 * ---------------------------------------
4 *
5 * Copyright 2014 The Android Open Source Project
6 *
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
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
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.
18 *
19 *//*!
20 * \file
21 * \brief EGL Test Package
22 *//*--------------------------------------------------------------------*/
23
24 #include "teglTestPackage.hpp"
25
26 #include "tcuTestLog.hpp"
27 #include "tcuPlatform.hpp"
28 #include "tcuCommandLine.hpp"
29
30 #include "egluPlatform.hpp"
31 #include "egluUtil.hpp"
32
33 #include "teglInfoTests.hpp"
34 #include "teglCreateContextTests.hpp"
35 #include "teglQueryContextTests.hpp"
36 #include "teglCreateSurfaceTests.hpp"
37 #include "teglQuerySurfaceTests.hpp"
38 #include "teglChooseConfigTests.hpp"
39 #include "teglQueryConfigTests.hpp"
40 #include "teglColorClearTests.hpp"
41 #include "teglRenderTests.hpp"
42 #include "teglImageTests.hpp"
43 #include "teglGLES2SharingTests.hpp"
44 #include "teglNegativeApiTests.hpp"
45 #include "teglSyncTests.hpp"
46 #include "teglMultiThreadTests.hpp"
47 #include "teglGetProcAddressTests.hpp"
48 #include "teglMemoryStressTests.hpp"
49 #include "teglMakeCurrentPerfTests.hpp"
50 #include "teglGLES2SharedRenderingPerfTests.hpp"
51 #include "teglPreservingSwapTests.hpp"
52 #include "teglClientExtensionTests.hpp"
53 #include "teglCreateContextExtTests.hpp"
54 #include "teglSurfacelessContextTests.hpp"
55 #include "teglSwapBuffersTests.hpp"
56 #include "teglNativeColorMappingTests.hpp"
57 #include "teglNativeCoordMappingTests.hpp"
58 #include "teglResizeTests.hpp"
59
60 namespace deqp
61 {
62 namespace egl
63 {
64
65 class StressTests : public TestCaseGroup
66 {
67 public:
StressTests(EglTestContext & eglTestCtx)68 StressTests (EglTestContext& eglTestCtx)
69 : TestCaseGroup(eglTestCtx, "stress", "EGL stress tests")
70 {
71 }
72
init(void)73 void init (void)
74 {
75 addChild(new MemoryStressTests(m_eglTestCtx));
76 }
77 };
78
79 class PerformanceTests : public TestCaseGroup
80 {
81 public:
PerformanceTests(EglTestContext & eglTestCtx)82 PerformanceTests (EglTestContext& eglTestCtx)
83 : TestCaseGroup(eglTestCtx, "performance", "EGL performance tests")
84 {
85 }
86
init(void)87 void init (void)
88 {
89 addChild(new MakeCurrentPerfTests (m_eglTestCtx));
90 addChild(new GLES2SharedRenderingPerfTests (m_eglTestCtx));
91 }
92 };
93
94 class FunctionalTests : public TestCaseGroup
95 {
96 public:
FunctionalTests(EglTestContext & eglTestCtx)97 FunctionalTests (EglTestContext& eglTestCtx)
98 : TestCaseGroup(eglTestCtx, "functional", "EGL functional tests")
99 {
100 }
101
init(void)102 void init (void)
103 {
104 addChild(new CreateContextTests (m_eglTestCtx));
105 addChild(new QueryContextTests (m_eglTestCtx));
106 addChild(new CreateSurfaceTests (m_eglTestCtx));
107 addChild(new QuerySurfaceTests (m_eglTestCtx));
108 addChild(new QueryConfigTests (m_eglTestCtx));
109 addChild(new ChooseConfigTests (m_eglTestCtx));
110 addChild(new ColorClearTests (m_eglTestCtx));
111 addChild(new RenderTests (m_eglTestCtx));
112 addChild(new ImageTests (m_eglTestCtx));
113 addChild(new SharingTests (m_eglTestCtx));
114 addChild(new NegativeApiTests (m_eglTestCtx));
115 addChild(new FenceSyncTests (m_eglTestCtx));
116 addChild(new MultiThreadedTests (m_eglTestCtx));
117 addChild(new GetProcAddressTests (m_eglTestCtx));
118 addChild(new PreservingSwapTests (m_eglTestCtx));
119 addChild(new ClientExtensionTests (m_eglTestCtx));
120 addChild(new CreateContextExtTests (m_eglTestCtx));
121 addChild(new SurfacelessContextTests (m_eglTestCtx));
122 addChild(new SwapBuffersTests (m_eglTestCtx));
123 addChild(new NativeColorMappingTests (m_eglTestCtx));
124 addChild(new NativeCoordMappingTests (m_eglTestCtx));
125 addChild(new ReusableSyncTests (m_eglTestCtx));
126 addChild(new ResizeTests (m_eglTestCtx));
127 }
128 };
129
130 class TestCaseWrapper : public tcu::TestCaseExecutor
131 {
132 public:
TestCaseWrapper(void)133 TestCaseWrapper (void)
134 {
135 }
136
~TestCaseWrapper(void)137 ~TestCaseWrapper (void)
138 {
139 }
140
init(tcu::TestCase * testCase,const std::string &)141 void init (tcu::TestCase* testCase, const std::string&)
142 {
143 testCase->init();
144 }
145
deinit(tcu::TestCase * testCase)146 void deinit (tcu::TestCase* testCase)
147 {
148 testCase->deinit();
149 }
150
iterate(tcu::TestCase * testCase)151 tcu::TestNode::IterateResult iterate (tcu::TestCase* testCase)
152 {
153 return testCase->iterate();
154 }
155 };
156
getDefaultDisplayFactory(tcu::TestContext & testCtx)157 static const eglu::NativeDisplayFactory& getDefaultDisplayFactory (tcu::TestContext& testCtx)
158 {
159 const eglu::NativeDisplayFactory& factory = eglu::selectNativeDisplayFactory(testCtx.getPlatform().getEGLPlatform().getNativeDisplayFactoryRegistry(), testCtx.getCommandLine());
160
161 return factory;
162 }
163
TestPackage(tcu::TestContext & testCtx)164 TestPackage::TestPackage (tcu::TestContext& testCtx)
165 : tcu::TestPackage (testCtx, "dEQP-EGL", "dEQP EGL Tests")
166 , m_eglTestCtx (DE_NULL)
167 {
168 }
169
~TestPackage(void)170 TestPackage::~TestPackage (void)
171 {
172 // Destroy children first since destructors may access context.
173 TestNode::deinit();
174 delete m_eglTestCtx;
175 }
176
init(void)177 void TestPackage::init (void)
178 {
179 DE_ASSERT(!m_eglTestCtx);
180 m_eglTestCtx = new EglTestContext(m_testCtx, getDefaultDisplayFactory(m_testCtx));
181
182 try
183 {
184 addChild(new InfoTests (*m_eglTestCtx));
185 addChild(new FunctionalTests (*m_eglTestCtx));
186 addChild(new PerformanceTests (*m_eglTestCtx));
187 addChild(new StressTests (*m_eglTestCtx));
188 }
189 catch (...)
190 {
191 delete m_eglTestCtx;
192 m_eglTestCtx = DE_NULL;
193
194 throw;
195 }
196 }
197
deinit(void)198 void TestPackage::deinit (void)
199 {
200 tcu::TestNode::deinit();
201 delete m_eglTestCtx;
202 m_eglTestCtx = DE_NULL;
203 }
204
createExecutor(void) const205 tcu::TestCaseExecutor* TestPackage::createExecutor (void) const
206 {
207 return new TestCaseWrapper();
208 }
209
210 } // egl
211 } // deqp
212