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