teglTestPackage.cpp revision 3c67e4f0ec73f9c30c6b2ed2adfbfe7faaf576a4
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
60namespace deqp
61{
62namespace egl
63{
64
65class StressTests : public TestCaseGroup
66{
67public:
68	StressTests (EglTestContext& eglTestCtx)
69		: TestCaseGroup(eglTestCtx, "stress", "EGL stress tests")
70	{
71	}
72
73	void init (void)
74	{
75		addChild(new MemoryStressTests(m_eglTestCtx));
76	}
77};
78
79class PerformanceTests : public TestCaseGroup
80{
81public:
82	PerformanceTests (EglTestContext& eglTestCtx)
83		: TestCaseGroup(eglTestCtx, "performance", "EGL performance tests")
84	{
85	}
86
87	void init (void)
88	{
89		addChild(new MakeCurrentPerfTests			(m_eglTestCtx));
90		addChild(new GLES2SharedRenderingPerfTests	(m_eglTestCtx));
91	}
92};
93
94class FunctionalTests : public TestCaseGroup
95{
96public:
97	FunctionalTests (EglTestContext& eglTestCtx)
98		: TestCaseGroup(eglTestCtx, "functional", "EGL functional tests")
99	{
100	}
101
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
130TestCaseWrapper::TestCaseWrapper (EglTestContext& eglTestCtx)
131	: tcu::TestCaseWrapper	(eglTestCtx.getTestContext())
132	, m_eglTestCtx			(eglTestCtx)
133{
134}
135
136TestCaseWrapper::~TestCaseWrapper (void)
137{
138}
139
140bool TestCaseWrapper::initTestCase (tcu::TestCase* testCase)
141{
142	return tcu::TestCaseWrapper::initTestCase(testCase);
143}
144
145bool TestCaseWrapper::deinitTestCase (tcu::TestCase* testCase)
146{
147	return tcu::TestCaseWrapper::deinitTestCase(testCase);
148}
149
150tcu::TestNode::IterateResult TestCaseWrapper::iterateTestCase (tcu::TestCase* testCase)
151{
152	return tcu::TestCaseWrapper::iterateTestCase(testCase);
153}
154
155static const eglu::NativeDisplayFactory& getDefaultDisplayFactory (tcu::TestContext& testCtx)
156{
157	const eglu::NativeDisplayFactory* factory = eglu::selectNativeDisplayFactory(testCtx.getPlatform().getEGLPlatform().getNativeDisplayFactoryRegistry(), testCtx.getCommandLine());
158
159	if (!factory)
160		TCU_THROW(InternalError, "No native display factories available");
161
162	return *factory;
163}
164
165PackageContext::PackageContext (tcu::TestContext& testCtx)
166	: m_eglTestCtx	(testCtx, getDefaultDisplayFactory(testCtx))
167	, m_caseWrapper	(m_eglTestCtx)
168{
169}
170
171PackageContext::~PackageContext (void)
172{
173}
174
175TestPackage::TestPackage (tcu::TestContext& testCtx)
176	: tcu::TestPackage	(testCtx, "dEQP-EGL", "dEQP EGL Tests")
177	, m_packageCtx		(DE_NULL)
178	, m_archive			(testCtx.getRootArchive(), "egl/")
179{
180}
181
182TestPackage::~TestPackage (void)
183{
184	// Destroy children first since destructors may access context.
185	TestNode::deinit();
186	delete m_packageCtx;
187}
188
189void TestPackage::init (void)
190{
191	DE_ASSERT(!m_packageCtx);
192	m_packageCtx = new PackageContext(m_testCtx);
193
194	try
195	{
196		addChild(new InfoTests			(m_packageCtx->getEglTestContext()));
197		addChild(new FunctionalTests	(m_packageCtx->getEglTestContext()));
198		addChild(new PerformanceTests	(m_packageCtx->getEglTestContext()));
199		addChild(new StressTests		(m_packageCtx->getEglTestContext()));
200	}
201	catch (...)
202	{
203		delete m_packageCtx;
204		m_packageCtx = DE_NULL;
205
206		throw;
207	}
208}
209
210void TestPackage::deinit (void)
211{
212	tcu::TestNode::deinit();
213	delete m_packageCtx;
214	m_packageCtx = DE_NULL;
215}
216
217} // egl
218} // deqp
219