teglTestPackage.cpp revision 193f59811b2c0fe57808a06923b82ed00c41bd0f
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{
133}
134
135TestCaseWrapper::~TestCaseWrapper (void)
136{
137}
138
139bool TestCaseWrapper::initTestCase (tcu::TestCase* testCase)
140{
141	return tcu::TestCaseWrapper::initTestCase(testCase);
142}
143
144bool TestCaseWrapper::deinitTestCase (tcu::TestCase* testCase)
145{
146	return tcu::TestCaseWrapper::deinitTestCase(testCase);
147}
148
149tcu::TestNode::IterateResult TestCaseWrapper::iterateTestCase (tcu::TestCase* testCase)
150{
151	return tcu::TestCaseWrapper::iterateTestCase(testCase);
152}
153
154static const eglu::NativeDisplayFactory& getDefaultDisplayFactory (tcu::TestContext& testCtx)
155{
156	const eglu::NativeDisplayFactory* factory = eglu::selectNativeDisplayFactory(testCtx.getPlatform().getEGLPlatform().getNativeDisplayFactoryRegistry(), testCtx.getCommandLine());
157
158	if (!factory)
159		TCU_THROW(InternalError, "No native display factories available");
160
161	return *factory;
162}
163
164PackageContext::PackageContext (tcu::TestContext& testCtx)
165	: m_eglTestCtx	(testCtx, getDefaultDisplayFactory(testCtx))
166	, m_caseWrapper	(m_eglTestCtx)
167{
168}
169
170PackageContext::~PackageContext (void)
171{
172}
173
174TestPackage::TestPackage (tcu::TestContext& testCtx)
175	: tcu::TestPackage	(testCtx, "dEQP-EGL", "dEQP EGL Tests")
176	, m_packageCtx		(DE_NULL)
177	, m_archive			(testCtx.getRootArchive(), "egl/")
178{
179}
180
181TestPackage::~TestPackage (void)
182{
183	// Destroy children first since destructors may access context.
184	TestNode::deinit();
185	delete m_packageCtx;
186}
187
188void TestPackage::init (void)
189{
190	DE_ASSERT(!m_packageCtx);
191	m_packageCtx = new PackageContext(m_testCtx);
192
193	try
194	{
195		addChild(new InfoTests			(m_packageCtx->getEglTestContext()));
196		addChild(new FunctionalTests	(m_packageCtx->getEglTestContext()));
197		addChild(new PerformanceTests	(m_packageCtx->getEglTestContext()));
198		addChild(new StressTests		(m_packageCtx->getEglTestContext()));
199	}
200	catch (...)
201	{
202		delete m_packageCtx;
203		m_packageCtx = DE_NULL;
204
205		throw;
206	}
207}
208
209void TestPackage::deinit (void)
210{
211	tcu::TestNode::deinit();
212	delete m_packageCtx;
213	m_packageCtx = DE_NULL;
214}
215
216} // egl
217} // deqp
218