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