1 #ifndef _TCUCOMMANDLINE_HPP
2 #define _TCUCOMMANDLINE_HPP
3 /*-------------------------------------------------------------------------
4 * drawElements Quality Program Tester Core
5 * ----------------------------------------
7 * Copyright 2014 The Android Open Source Project
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 * \brief Command line parsing.
24 *//*--------------------------------------------------------------------*/
26 #include "tcuDefs.hpp"
27 #include "deCommandLine.hpp"
28 #include "deUniquePtr.hpp"
37 /*--------------------------------------------------------------------*//*!
38 * \brief Run mode tells whether the test program should run the tests or
39 * dump out metadata about the tests.
40 *//*--------------------------------------------------------------------*/
43 RUNMODE_EXECUTE = 0, //! Test program executes the tests.
44 RUNMODE_DUMP_XML_CASELIST, //! Test program dumps the list of contained test cases in XML format.
45 RUNMODE_DUMP_TEXT_CASELIST, //! Test program dumps the list of contained test cases in plain-text format.
46 RUNMODE_DUMP_STDOUT_CASELIST, //! Test program dumps the list of contained test cases in plain-text format into stdout.
51 /*--------------------------------------------------------------------*//*!
52 * \brief Should graphical tests show rendering results on screen.
53 *//*--------------------------------------------------------------------*/
56 WINDOWVISIBILITY_WINDOWED = 0,
57 WINDOWVISIBILITY_FULLSCREEN,
58 WINDOWVISIBILITY_HIDDEN,
63 /*--------------------------------------------------------------------*//*!
64 * \brief The type of rendering surface the tests should be executed on.
65 *//*--------------------------------------------------------------------*/
68 SURFACETYPE_WINDOW = 0, //!< Native window.
69 SURFACETYPE_OFFSCREEN_NATIVE, //!< Native offscreen surface, such as pixmap.
70 SURFACETYPE_OFFSCREEN_GENERIC, //!< Generic offscreen surface, such as pbuffer.
71 SURFACETYPE_FBO, //!< Framebuffer object.
76 /*--------------------------------------------------------------------*//*!
77 * \brief Screen rotation, always to clockwise direction.
78 *//*--------------------------------------------------------------------*/
81 SCREENROTATION_UNSPECIFIED, //!< Use default / current orientation.
82 SCREENROTATION_0, //!< Set rotation to 0 degrees from baseline.
97 CaseListFilter (const de::cmdline::CommandLine& cmdLine, const tcu::Archive& archive);
98 CaseListFilter (void);
99 ~CaseListFilter (void);
101 //! Check if test group is in supplied test case list.
102 bool checkTestGroupName (const char* groupName) const;
104 //! Check if test case is in supplied test case list.
105 bool checkTestCaseName (const char* caseName) const;
108 CaseListFilter (const CaseListFilter&); // not allowed!
109 CaseListFilter& operator= (const CaseListFilter&); // not allowed!
111 CaseTreeNode* m_caseTree;
112 de::MovePtr<const CasePaths> m_casePaths;
115 /*--------------------------------------------------------------------*//*!
116 * \brief Test command line
118 * CommandLine handles argument parsing and provides convinience functions
119 * for querying test parameters.
120 *//*--------------------------------------------------------------------*/
125 CommandLine (int argc, const char* const* argv);
126 explicit CommandLine (const std::string& cmdLine);
129 bool parse (int argc, const char* const* argv);
130 bool parse (const std::string& cmdLine);
132 //! Get log file name (--deqp-log-filename)
133 const char* getLogFileName (void) const;
135 //! Get logging flags
136 deUint32 getLogFlags (void) const;
138 //! Get run mode (--deqp-runmode)
139 RunMode getRunMode (void) const;
141 //! Get caselist dump target file pattern (--deqp-caselist-export-file)
142 const char* getCaseListExportFile (void) const;
144 //! Get default window visibility (--deqp-visibility)
145 WindowVisibility getVisibility (void) const;
147 //! Get watchdog enable status (--deqp-watchdog)
148 bool isWatchDogEnabled (void) const;
150 //! Get crash handling enable status (--deqp-crashhandler)
151 bool isCrashHandlingEnabled (void) const;
153 //! Get base seed for randomization (--deqp-base-seed)
154 int getBaseSeed (void) const;
156 //! Get test iteration count (--deqp-test-iteration-count)
157 int getTestIterationCount (void) const;
159 //! Get rendering target width (--deqp-surface-width)
160 int getSurfaceWidth (void) const;
162 //! Get rendering target height (--deqp-surface-height)
163 int getSurfaceHeight (void) const;
165 //! Get rendering taget type (--deqp-surface-type)
166 SurfaceType getSurfaceType (void) const;
168 //! Get screen rotation (--deqp-screen-rotation)
169 ScreenRotation getScreenRotation (void) const;
171 //! Get GL context factory name (--deqp-gl-context-type)
172 const char* getGLContextType (void) const;
174 //! Get GL config ID (--deqp-gl-config-id)
175 int getGLConfigId (void) const;
177 //! Get GL config name (--deqp-gl-config-name)
178 const char* getGLConfigName (void) const;
180 //! Get GL context flags (--deqp-gl-context-flags)
181 const char* getGLContextFlags (void) const;
183 //! Get OpenCL platform ID (--deqp-cl-platform-id)
184 int getCLPlatformId (void) const;
186 //! Get OpenCL device IDs (--deqp-cl-device-ids)
187 void getCLDeviceIds (std::vector<int>& deviceIds) const { deviceIds = getCLDeviceIds(); }
188 const std::vector<int>& getCLDeviceIds (void) const;
190 //! Get extra OpenCL program build options (--deqp-cl-build-options)
191 const char* getCLBuildOptions (void) const;
193 //! Get EGL native display factory (--deqp-egl-display-type)
194 const char* getEGLDisplayType (void) const;
196 //! Get EGL native window factory (--deqp-egl-window-type)
197 const char* getEGLWindowType (void) const;
199 //! Get EGL native pixmap factory (--deqp-egl-pixmap-type)
200 const char* getEGLPixmapType (void) const;
202 //! Get Vulkan device ID (--deqp-vk-device-id)
203 int getVKDeviceId (void) const;
205 //! Enable development-time test case validation checks
206 bool isValidationEnabled (void) const;
208 //! Should we run tests that exhaust memory (--deqp-test-oom)
209 bool isOutOfMemoryTestEnabled (void) const;
211 /*--------------------------------------------------------------------*//*!
212 * \brief Creates case list filter
213 * \param archive Resources
215 * Creates case list filter based on one of the following parameters:
219 * --deqp-caselist-file
220 * --deqp-caselist-resource
221 * --deqp-stdin-caselist
223 * Throws std::invalid_argument if parsing fails.
224 *//*--------------------------------------------------------------------*/
225 de::MovePtr<CaseListFilter> createCaseListFilter (const tcu::Archive& archive) const;
228 const de::cmdline::CommandLine& getCommandLine (void) const;
231 CommandLine (const CommandLine&); // not allowed!
232 CommandLine& operator= (const CommandLine&); // not allowed!
236 virtual void registerExtendedOptions (de::cmdline::Parser& parser);
238 de::cmdline::CommandLine m_cmdLine;
244 #endif // _TCUCOMMANDLINE_HPP