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 //! Test run summary. 38 class TestRunStatus 39 { 40 public: TestRunStatus(void)41 TestRunStatus (void) { clear(); } 42 clear(void)43 void clear (void) 44 { 45 numExecuted = 0; 46 numPassed = 0; 47 numFailed = 0; 48 numNotSupported = 0; 49 numWarnings = 0; 50 isComplete = false; 51 } 52 53 int numExecuted; //!< Total number of cases executed. 54 int numPassed; //!< Number of cases passed. 55 int numFailed; //!< Number of cases failed. 56 int numNotSupported; //!< Number of cases not supported. 57 int numWarnings; //!< Number of QualityWarning / CompatibilityWarning results. 58 bool isComplete; //!< Is run complete. 59 }; 60 61 class TestSessionExecutor 62 { 63 public: 64 TestSessionExecutor (TestPackageRoot& root, TestContext& testCtx); 65 ~TestSessionExecutor(void); 66 67 bool iterate (void); 68 isInTestCase(void) const69 bool isInTestCase (void) const { return m_isInTestCase; } getStatus(void) const70 const TestRunStatus& getStatus (void) const { return m_status; } 71 72 private: 73 void enterTestPackage (TestPackage* testPackage); 74 void leaveTestPackage (TestPackage* testPackage); 75 76 void enterTestGroup (const std::string& casePath); 77 void leaveTestGroup (const std::string& casePath); 78 79 bool enterTestCase (TestCase* testCase, const std::string& casePath); 80 TestCase::IterateResult iterateTestCase (TestCase* testCase); 81 void leaveTestCase (TestCase* testCase); 82 83 enum State 84 { 85 STATE_TRAVERSE_HIERARCHY = 0, 86 STATE_EXECUTE_TEST_CASE, 87 88 STATE_LAST 89 }; 90 91 TestContext& m_testCtx; 92 93 DefaultHierarchyInflater m_inflater; 94 de::MovePtr<CaseListFilter> m_caseListFilter; 95 TestHierarchyIterator m_iterator; 96 97 de::MovePtr<TestCaseExecutor> m_caseExecutor; 98 TestRunStatus m_status; 99 State m_state; 100 bool m_abortSession; 101 bool m_isInTestCase; 102 deUint64 m_testStartTime; 103 deUint64 m_packageStartTime; 104 std::map<std::string, deUint64> m_groupsDurationTime; 105 }; 106 107 } // tcu 108 109 #endif // _TCUTESTSESSIONEXECUTOR_HPP 110