Import dEQP.
[platform/upstream/VK-GL-CTS.git] / modules / gles31 / tes31TestPackage.cpp
1 /*-------------------------------------------------------------------------
2  * drawElements Quality Program OpenGL ES 3.1 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 OpenGL ES 3.1 Test Package
22  *//*--------------------------------------------------------------------*/
23
24 #include "tes31TestPackage.hpp"
25 #include "tes31InfoTests.hpp"
26 #include "es31fFunctionalTests.hpp"
27 #include "es31sStressTests.hpp"
28
29 namespace deqp
30 {
31 namespace gles31
32 {
33
34 PackageContext::PackageContext (tcu::TestContext& testCtx)
35         : m_context             (DE_NULL)
36         , m_caseWrapper (DE_NULL)
37 {
38         try
39         {
40                 m_context               = new Context(testCtx);
41                 m_caseWrapper   = new TestCaseWrapper(testCtx, m_context->getRenderContext());
42         }
43         catch (...)
44         {
45                 delete m_caseWrapper;
46                 delete m_context;
47
48                 throw;
49         }
50 }
51
52 PackageContext::~PackageContext (void)
53 {
54         delete m_caseWrapper;
55         delete m_context;
56 }
57
58 TestPackage::TestPackage (tcu::TestContext& testCtx)
59         : tcu::TestPackage      (testCtx, "dEQP-GLES31", "dEQP OpenGL ES 3.1 Tests")
60         , m_packageCtx          (DE_NULL)
61         , m_archive                     (testCtx.getRootArchive(), "gles31/")
62 {
63 }
64
65 TestPackage::~TestPackage (void)
66 {
67         // Destroy children first since destructors may access context.
68         TestNode::deinit();
69         delete m_packageCtx;
70 }
71
72 void TestPackage::init (void)
73 {
74         try
75         {
76                 // Create context
77                 m_packageCtx = new PackageContext(m_testCtx);
78
79                 // Add main test groups
80                 addChild(new InfoTests                                          (m_packageCtx->getContext()));
81                 addChild(new Functional::FunctionalTests        (m_packageCtx->getContext()));
82                 addChild(new Stress::StressTests                        (m_packageCtx->getContext()));
83         }
84         catch (...)
85         {
86                 delete m_packageCtx;
87                 m_packageCtx = DE_NULL;
88
89                 throw;
90         }
91 }
92
93 void TestPackage::deinit (void)
94 {
95         TestNode::deinit();
96         delete m_packageCtx;
97         m_packageCtx = DE_NULL;
98 }
99
100 } // gles31
101 } // deqp