xref: /aosp_15_r20/external/deqp/framework/common/tcuTestSessionExecutor.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
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 #include <map>
33 
34 namespace tcu
35 {
36 
37 class TestSessionExecutor
38 {
39 public:
40     TestSessionExecutor(TestPackageRoot &root, TestContext &testCtx);
41     ~TestSessionExecutor(void);
42 
43     bool iterate(void);
44 
isInTestCase(void) const45     bool isInTestCase(void) const
46     {
47         return m_isInTestCase;
48     }
getStatus(void) const49     const TestRunStatus &getStatus(void) const
50     {
51         return m_status;
52     }
53 
54 private:
55     void enterTestPackage(TestPackage *testPackage);
56     void leaveTestPackage(TestPackage *testPackage);
57 
58     void enterTestGroup(const std::string &casePath);
59     void leaveTestGroup(const std::string &casePath);
60 
61     bool enterTestCase(TestCase *testCase, const std::string &casePath);
62     TestCase::IterateResult iterateTestCase(TestCase *testCase);
63     void leaveTestCase(TestCase *testCase);
64 
65     enum State
66     {
67         STATE_TRAVERSE_HIERARCHY = 0,
68         STATE_EXECUTE_TEST_CASE,
69 
70         STATE_LAST
71     };
72 
73     TestContext &m_testCtx;
74 
75     DefaultHierarchyInflater m_inflater;
76     de::MovePtr<CaseListFilter> m_caseListFilter;
77     TestHierarchyIterator m_iterator;
78 
79     de::MovePtr<TestCaseExecutor> m_caseExecutor;
80     TestRunStatus m_status;
81     State m_state;
82     bool m_abortSession;
83     bool m_isInTestCase;
84     uint64_t m_testStartTime;
85     uint64_t m_packageStartTime;
86     std::map<std::string, uint64_t> m_groupsDurationTime;
87 };
88 
89 } // namespace tcu
90 
91 #endif // _TCUTESTSESSIONEXECUTOR_HPP
92