1 #ifndef _TCUCOMMANDLINE_HPP 2 #define _TCUCOMMANDLINE_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 Command line parsing. 24 *//*--------------------------------------------------------------------*/ 25 26 #include "tcuDefs.hpp" 27 #include "deCommandLine.hpp" 28 #include "deUniquePtr.hpp" 29 30 #include <string> 31 #include <vector> 32 33 namespace tcu 34 { 35 36 /*--------------------------------------------------------------------*//*! 37 * \brief Run mode tells whether the test program should run the tests or 38 * dump out metadata about the tests. 39 *//*--------------------------------------------------------------------*/ 40 enum RunMode 41 { 42 RUNMODE_EXECUTE = 0, //! Test program executes the tests. 43 RUNMODE_DUMP_XML_CASELIST, //! Test program dumps the list of contained test cases in XML format. 44 RUNMODE_DUMP_TEXT_CASELIST, //! Test program dumps the list of contained test cases in plain-text format. 45 46 RUNMODE_LAST 47 }; 48 49 /*--------------------------------------------------------------------*//*! 50 * \brief Should graphical tests show rendering results on screen. 51 *//*--------------------------------------------------------------------*/ 52 enum WindowVisibility 53 { 54 WINDOWVISIBILITY_WINDOWED = 0, 55 WINDOWVISIBILITY_FULLSCREEN, 56 WINDOWVISIBILITY_HIDDEN, 57 58 WINDOWVISIBILITY_LAST 59 }; 60 61 /*--------------------------------------------------------------------*//*! 62 * \brief The type of rendering surface the tests should be executed on. 63 *//*--------------------------------------------------------------------*/ 64 enum SurfaceType 65 { 66 SURFACETYPE_WINDOW = 0, //!< Native window. 67 SURFACETYPE_OFFSCREEN_NATIVE, //!< Native offscreen surface, such as pixmap. 68 SURFACETYPE_OFFSCREEN_GENERIC, //!< Generic offscreen surface, such as pbuffer. 69 SURFACETYPE_FBO, //!< Framebuffer object. 70 71 SURFACETYPE_LAST 72 }; 73 74 /*--------------------------------------------------------------------*//*! 75 * \brief Screen rotation, always to clockwise direction. 76 *//*--------------------------------------------------------------------*/ 77 enum ScreenRotation 78 { 79 SCREENROTATION_0, 80 SCREENROTATION_90, 81 SCREENROTATION_180, 82 SCREENROTATION_270, 83 84 SCREENROTATION_LAST 85 }; 86 87 class CaseTreeNode; 88 class CasePaths; 89 90 /*--------------------------------------------------------------------*//*! 91 * \brief Test command line 92 * 93 * CommandLine handles argument parsing and provides convinience functions 94 * for querying test parameters. 95 *//*--------------------------------------------------------------------*/ 96 class CommandLine 97 { 98 public: 99 CommandLine (void); 100 CommandLine (int argc, const char* const* argv); 101 explicit CommandLine (const std::string& cmdLine); 102 ~CommandLine (void); 103 104 bool parse (int argc, const char* const* argv); 105 bool parse (const std::string& cmdLine); 106 107 //! Get log file name (--deqp-log-filename) 108 const char* getLogFileName (void) const; 109 110 //! Get logging flags 111 deUint32 getLogFlags (void) const; 112 113 //! Get run mode (--deqp-runmode) 114 RunMode getRunMode (void) const; 115 116 //! Get default window visibility (--deqp-visibility) 117 WindowVisibility getVisibility (void) const; 118 119 //! Get watchdog enable status (--deqp-watchdog) 120 bool isWatchDogEnabled (void) const; 121 122 //! Get crash handling enable status (--deqp-crashhandler) 123 bool isCrashHandlingEnabled (void) const; 124 125 //! Get base seed for randomization (--deqp-base-seed) 126 int getBaseSeed (void) const; 127 128 //! Get test iteration count (--deqp-test-iteration-count) 129 int getTestIterationCount (void) const; 130 131 //! Get rendering target width (--deqp-surface-width) 132 int getSurfaceWidth (void) const; 133 134 //! Get rendering target height (--deqp-surface-height) 135 int getSurfaceHeight (void) const; 136 137 //! Get rendering taget type (--deqp-surface-type) 138 SurfaceType getSurfaceType (void) const; 139 140 //! Get screen rotation (--deqp-screen-rotation) 141 ScreenRotation getScreenRotation (void) const; 142 143 //! Get GL context factory name (--deqp-gl-context-type) 144 const char* getGLContextType (void) const; 145 146 //! Get GL config ID (--deqp-gl-config-id) 147 int getGLConfigId (void) const; 148 149 //! Get GL config name (--deqp-gl-config-name) 150 const char* getGLConfigName (void) const; 151 152 //! Get GL context flags (--deqp-gl-context-flags) 153 const char* getGLContextFlags (void) const; 154 155 //! Get OpenCL platform ID (--deqp-cl-platform-id) 156 int getCLPlatformId (void) const; 157 158 //! Get OpenCL device IDs (--deqp-cl-device-ids) getCLDeviceIds(std::vector<int> & deviceIds) const159 void getCLDeviceIds (std::vector<int>& deviceIds) const { deviceIds = getCLDeviceIds(); } 160 const std::vector<int>& getCLDeviceIds (void) const; 161 162 //! Get extra OpenCL program build options (--deqp-cl-build-options) 163 const char* getCLBuildOptions (void) const; 164 165 //! Get EGL native display factory (--deqp-egl-display-type) 166 const char* getEGLDisplayType (void) const; 167 168 //! Get EGL native window factory (--deqp-egl-window-type) 169 const char* getEGLWindowType (void) const; 170 171 //! Get EGL native pixmap factory (--deqp-egl-pixmap-type) 172 const char* getEGLPixmapType (void) const; 173 174 //! Should we run tests that exhaust memory (--deqp-test-oom) 175 bool isOutOfMemoryTestEnabled(void) const; 176 177 //! Check if test group is in supplied test case list. 178 bool checkTestGroupName (const char* groupName) const; 179 180 //! Check if test case is in supplied test case list. 181 bool checkTestCaseName (const char* caseName) const; 182 183 private: 184 CommandLine (const CommandLine&); // not allowed! 185 CommandLine& operator= (const CommandLine&); // not allowed! 186 187 void clear (void); 188 189 de::cmdline::CommandLine m_cmdLine; 190 deUint32 m_logFlags; 191 CaseTreeNode* m_caseTree; 192 de::MovePtr<const CasePaths> m_casePaths; 193 }; 194 195 } // tcu 196 197 #endif // _TCUCOMMANDLINE_HPP 198