1 #ifndef _GLCTESTRUNNER_HPP 2 #define _GLCTESTRUNNER_HPP 3 /*------------------------------------------------------------------------- 4 * OpenGL Conformance Test Suite 5 * ----------------------------- 6 * 7 * Copyright (c) 2016 Google Inc. 8 * Copyright (c) 2016 The Khronos Group Inc. 9 * 10 * Licensed under the Apache License, Version 2.0 (the "License"); 11 * you may not use this file except in compliance with the License. 12 * You may obtain a copy of the License at 13 * 14 * http://www.apache.org/licenses/LICENSE-2.0 15 * 16 * Unless required by applicable law or agreed to in writing, software 17 * distributed under the License is distributed on an "AS IS" BASIS, 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 * See the License for the specific language governing permissions and 20 * limitations under the License. 21 * 22 */ /*! 23 * \file 24 * \brief CTS runner. 25 */ /*-------------------------------------------------------------------*/ 26 27 #include "gluPlatform.hpp" 28 #include "tcuDefs.hpp" 29 30 #include <string> 31 #include <vector> 32 33 namespace tcu 34 { 35 36 class Archive; 37 38 } // tcu 39 40 namespace glcts 41 { 42 43 struct Config; 44 45 struct RunParams 46 { 47 glu::ApiType apiType; 48 const char* configName; 49 const char* glConfigName; 50 const char* screenRotation; 51 int baseSeed; 52 const char* fboConfig; 53 int surfaceWidth; 54 int surfaceHeight; 55 }; 56 57 struct TestRunParams 58 { 59 std::vector<std::string> args; 60 std::string logFilename; 61 }; 62 63 // Conformance test run summary - written to cts-run-summary.xml 64 struct TestRunSummary 65 { 66 glu::ApiType runType; 67 bool isConformant; 68 std::string configLogFilename; 69 std::vector<TestRunParams> runParams; 70 TestRunSummaryglcts::TestRunSummary71 TestRunSummary(void) : isConformant(false) 72 { 73 } 74 clearglcts::TestRunSummary75 void clear(void) 76 { 77 runType = glu::ApiType(); 78 isConformant = false; 79 configLogFilename.clear(); 80 runParams.clear(); 81 } 82 }; 83 84 class RunSession; 85 86 class TestRunner 87 { 88 public: 89 enum Flags 90 { 91 VERBOSE_COMMANDS = (1 << 0), 92 VERBOSE_IMAGES = (1 << 1), 93 VERBOSE_SHADERS = (1 << 2), 94 95 VERBOSE_ALL = VERBOSE_COMMANDS | VERBOSE_IMAGES, 96 97 PRINT_SUMMARY = (1 << 3) 98 }; 99 100 TestRunner(tcu::Platform& platform, tcu::Archive& archive, const char* waiverPath, const char* logDirPath, 101 glu::ApiType type, deUint32 flags); 102 ~TestRunner(void); 103 104 bool iterate(void); isConformant() const105 bool isConformant() const { return m_summary.isConformant; } 106 107 private: 108 TestRunner(const TestRunner& other); 109 TestRunner operator=(const TestRunner& other); 110 111 void init(void); 112 void deinit(void); 113 114 void initSession(const TestRunParams& runParams); 115 void deinitSession(void); 116 bool iterateSession(void); 117 118 enum IterateState 119 { 120 ITERATE_INIT = 0, //!< Call init() on this iteration. 121 ITERATE_DEINIT, //!< Call deinit() on this iteration. 122 123 ITERATE_INIT_SESSION, //!< Init current session. 124 ITERATE_DEINIT_SESSION, //!< Deinit session and move to next. 125 ITERATE_ITERATE_SESSION, //!< Iterate current session. 126 127 ITERATESTATE_LAST 128 }; 129 130 tcu::Platform& m_platform; 131 tcu::Archive& m_archive; 132 std::string m_waiverPath; 133 std::string m_logDirPath; 134 glu::ApiType m_type; 135 deUint32 m_flags; 136 137 // Iteration state. 138 IterateState m_iterState; 139 std::vector<TestRunParams> m_runSessions; 140 std::vector<TestRunParams>::const_iterator m_sessionIter; 141 RunSession* m_curSession; 142 143 // Totals / stats. 144 int m_sessionsExecuted; 145 int m_sessionsPassed; 146 int m_sessionsFailed; 147 TestRunSummary m_summary; 148 }; 149 150 } // glcts 151 152 #endif // _GLCTESTRUNNER_HPP 153