Merge "Fix extension support checks in negative api tests" into nougat-cts-dev am...
[platform/upstream/VK-GL-CTS.git] / framework / common / tcuTestSessionExecutor.hpp
1 #ifndef _TCUTESTSESSIONEXECUTOR_HPP
2 #define _TCUTESTSESSIONEXECUTOR_HPP
3 /*-------------------------------------------------------------------------
4  * drawElements Quality Program Tester Core
5  * ----------------------------------------
6  *
7  * Copyright 2014 The Android Open Source Project
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  *//*!
22  * \file
23  * \brief Test executor.
24  *//*--------------------------------------------------------------------*/
25
26 #include "tcuDefs.hpp"
27 #include "tcuTestContext.hpp"
28 #include "tcuTestCase.hpp"
29 #include "tcuTestPackage.hpp"
30 #include "tcuTestHierarchyIterator.hpp"
31 #include "deUniquePtr.hpp"
32
33 namespace tcu
34 {
35
36 //! Test run summary.
37 class TestRunStatus
38 {
39 public:
40         TestRunStatus (void) { clear(); }
41
42         void clear (void)
43         {
44                 numExecuted             = 0;
45                 numPassed               = 0;
46                 numFailed               = 0;
47                 numNotSupported = 0;
48                 numWarnings             = 0;
49                 isComplete              = false;
50         }
51
52         int             numExecuted;            //!< Total number of cases executed.
53         int             numPassed;                      //!< Number of cases passed.
54         int             numFailed;                      //!< Number of cases failed.
55         int             numNotSupported;        //!< Number of cases not supported.
56         int             numWarnings;            //!< Number of QualityWarning / CompatibilityWarning results.
57         bool    isComplete;                     //!< Is run complete.
58 };
59
60 class TestSessionExecutor
61 {
62 public:
63                                                                         TestSessionExecutor     (TestPackageRoot& root, TestContext& testCtx);
64                                                                         ~TestSessionExecutor(void);
65
66         bool                                                    iterate                         (void);
67
68         bool                                                    isInTestCase            (void) const { return m_isInTestCase;   }
69         const TestRunStatus&                    getStatus                       (void) const { return m_status;                 }
70
71 private:
72         void                                                    enterTestPackage        (TestPackage* testPackage);
73         void                                                    leaveTestPackage        (TestPackage* testPackage);
74
75         bool                                                    enterTestCase           (TestCase* testCase, const std::string& casePath);
76         TestCase::IterateResult                 iterateTestCase         (TestCase* testCase);
77         void                                                    leaveTestCase           (TestCase* testCase);
78
79         enum State
80         {
81                 STATE_TRAVERSE_HIERARCHY = 0,
82                 STATE_EXECUTE_TEST_CASE,
83
84                 STATE_LAST
85         };
86
87         TestContext&                                    m_testCtx;
88
89         DefaultHierarchyInflater                m_inflater;
90         TestHierarchyIterator                   m_iterator;
91
92         de::MovePtr<TestCaseExecutor>   m_caseExecutor;
93         TestRunStatus                                   m_status;
94         State                                                   m_state;
95         bool                                                    m_abortSession;
96         bool                                                    m_isInTestCase;
97         deUint64                                                m_testStartTime;
98 };
99
100 } // tcu
101
102 #endif // _TCUTESTSESSIONEXECUTOR_HPP