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 #include "teglBufferAgeTests.hpp"
60 #include "teglPartialUpdateTests.hpp"
61 #include "teglNegativePartialUpdateTests.hpp"
62 #include "teglSwapBuffersWithDamageTests.hpp"
63 #include "teglMultiContextTests.hpp"
64 #include "teglThreadCleanUpTests.hpp"
65 #include "teglMutableRenderBufferTests.hpp"
66 #include "teglGetFrameTimestampsTests.hpp"
67 #include "teglRobustnessTests.hpp"
68 #include "teglWideColorTests.hpp"
69 
70 namespace deqp
71 {
72 namespace egl
73 {
74 
75 class StressTests : public TestCaseGroup
76 {
77 public:
StressTests(EglTestContext & eglTestCtx)78 	StressTests (EglTestContext& eglTestCtx)
79 		: TestCaseGroup(eglTestCtx, "stress", "EGL stress tests")
80 	{
81 	}
82 
init(void)83 	void init (void)
84 	{
85 		addChild(new MemoryStressTests(m_eglTestCtx));
86 	}
87 };
88 
89 class PerformanceTests : public TestCaseGroup
90 {
91 public:
PerformanceTests(EglTestContext & eglTestCtx)92 	PerformanceTests (EglTestContext& eglTestCtx)
93 		: TestCaseGroup(eglTestCtx, "performance", "EGL performance tests")
94 	{
95 	}
96 
init(void)97 	void init (void)
98 	{
99 		addChild(new MakeCurrentPerfTests			(m_eglTestCtx));
100 		addChild(new GLES2SharedRenderingPerfTests	(m_eglTestCtx));
101 	}
102 };
103 
104 class FunctionalTests : public TestCaseGroup
105 {
106 public:
FunctionalTests(EglTestContext & eglTestCtx)107 	FunctionalTests (EglTestContext& eglTestCtx)
108 		: TestCaseGroup(eglTestCtx, "functional", "EGL functional tests")
109 	{
110 	}
111 
init(void)112 	void init (void)
113 	{
114 		addChild(new CreateContextTests			(m_eglTestCtx));
115 		addChild(new QueryContextTests			(m_eglTestCtx));
116 		addChild(new CreateSurfaceTests			(m_eglTestCtx));
117 		addChild(new QuerySurfaceTests			(m_eglTestCtx));
118 		addChild(new QueryConfigTests			(m_eglTestCtx));
119 		addChild(new ChooseConfigTests			(m_eglTestCtx));
120 		addChild(new ColorClearTests			(m_eglTestCtx));
121 		addChild(new RenderTests				(m_eglTestCtx));
122 		addChild(new ImageTests					(m_eglTestCtx));
123 		addChild(new SharingTests				(m_eglTestCtx));
124 		addChild(new NegativeApiTests			(m_eglTestCtx));
125 		addChild(new FenceSyncTests				(m_eglTestCtx));
126 		addChild(new MultiThreadedTests			(m_eglTestCtx));
127 		addChild(new GetProcAddressTests		(m_eglTestCtx));
128 		addChild(new PreservingSwapTests		(m_eglTestCtx));
129 		addChild(new ClientExtensionTests		(m_eglTestCtx));
130 		addChild(new CreateContextExtTests		(m_eglTestCtx));
131 		addChild(new SurfacelessContextTests	(m_eglTestCtx));
132 		addChild(new SwapBuffersTests			(m_eglTestCtx));
133 		addChild(new NativeColorMappingTests	(m_eglTestCtx));
134 		addChild(new NativeCoordMappingTests	(m_eglTestCtx));
135 		addChild(new ReusableSyncTests			(m_eglTestCtx));
136 		addChild(new ResizeTests				(m_eglTestCtx));
137 		addChild(new BufferAgeTests				(m_eglTestCtx));
138 		addChild(new PartialUpdateTests			(m_eglTestCtx));
139 		addChild(new NegativePartialUpdateTests	(m_eglTestCtx));
140 		addChild(new SwapBuffersWithDamageTests	(m_eglTestCtx));
141 		addChild(createMultiContextTests		(m_eglTestCtx));
142 		addChild(createThreadCleanUpTest		(m_eglTestCtx));
143 		addChild(new MutableRenderBufferTests	(m_eglTestCtx));
144 		addChild(createGetFrameTimestampsTests	(m_eglTestCtx));
145 		addChild(createRobustnessTests			(m_eglTestCtx));
146 		addChild(createWideColorTests			(m_eglTestCtx));
147 		addChild(createHdrColorTests			(m_eglTestCtx));
148 	}
149 };
150 
151 class TestCaseWrapper : public tcu::TestCaseExecutor
152 {
153 public:
TestCaseWrapper(void)154 	TestCaseWrapper (void)
155 	{
156 	}
157 
~TestCaseWrapper(void)158 	~TestCaseWrapper (void)
159 	{
160 	}
161 
init(tcu::TestCase * testCase,const std::string &)162 	void init (tcu::TestCase* testCase, const std::string&)
163 	{
164 		testCase->init();
165 	}
166 
deinit(tcu::TestCase * testCase)167 	void deinit (tcu::TestCase* testCase)
168 	{
169 		testCase->deinit();
170 	}
171 
iterate(tcu::TestCase * testCase)172 	tcu::TestNode::IterateResult iterate (tcu::TestCase* testCase)
173 	{
174 		return testCase->iterate();
175 	}
176 };
177 
getDefaultDisplayFactory(tcu::TestContext & testCtx)178 static const eglu::NativeDisplayFactory& getDefaultDisplayFactory (tcu::TestContext& testCtx)
179 {
180 	const eglu::NativeDisplayFactory& factory = eglu::selectNativeDisplayFactory(testCtx.getPlatform().getEGLPlatform().getNativeDisplayFactoryRegistry(), testCtx.getCommandLine());
181 
182 	return factory;
183 }
184 
TestPackage(tcu::TestContext & testCtx)185 TestPackage::TestPackage (tcu::TestContext& testCtx)
186 	: tcu::TestPackage	(testCtx, "dEQP-EGL", "dEQP EGL Tests")
187 	, m_eglTestCtx		(DE_NULL)
188 {
189 }
190 
~TestPackage(void)191 TestPackage::~TestPackage (void)
192 {
193 	// Destroy children first since destructors may access context.
194 	TestNode::deinit();
195 	delete m_eglTestCtx;
196 }
197 
init(void)198 void TestPackage::init (void)
199 {
200 	DE_ASSERT(!m_eglTestCtx);
201 	m_eglTestCtx = new EglTestContext(m_testCtx, getDefaultDisplayFactory(m_testCtx));
202 
203 	try
204 	{
205 		addChild(new InfoTests			(*m_eglTestCtx));
206 		addChild(new FunctionalTests	(*m_eglTestCtx));
207 		addChild(new PerformanceTests	(*m_eglTestCtx));
208 		addChild(new StressTests		(*m_eglTestCtx));
209 	}
210 	catch (...)
211 	{
212 		delete m_eglTestCtx;
213 		m_eglTestCtx = DE_NULL;
214 
215 		throw;
216 	}
217 }
218 
deinit(void)219 void TestPackage::deinit (void)
220 {
221 	tcu::TestNode::deinit();
222 	delete m_eglTestCtx;
223 	m_eglTestCtx = DE_NULL;
224 }
225 
createExecutor(void) const226 tcu::TestCaseExecutor* TestPackage::createExecutor (void) const
227 {
228 	return new TestCaseWrapper();
229 }
230 
231 } // egl
232 } // deqp
233