13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#ifndef _TCUCOMMANDLINE_HPP
23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#define _TCUCOMMANDLINE_HPP
33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*-------------------------------------------------------------------------
43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program Tester Core
53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ----------------------------------------
63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project
83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License");
103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License.
113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at
123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *      http://www.apache.org/licenses/LICENSE-2.0
143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software
163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS,
173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and
193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License.
203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*!
223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file
233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Command line parsing.
243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "tcuDefs.hpp"
273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deCommandLine.hpp"
283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deUniquePtr.hpp"
293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <string>
313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include <vector>
323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
333c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace tcu
343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*!
373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Run mode tells whether the test program should run the tests or
383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *		  dump out metadata about the tests.
393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
403c827367444ee418f129b2c238299f49d3264554Jarkko Poyryenum RunMode
413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	RUNMODE_EXECUTE = 0,			//! Test program executes the tests.
433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	RUNMODE_DUMP_XML_CASELIST,		//! Test program dumps the list of contained test cases in XML format.
443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	RUNMODE_DUMP_TEXT_CASELIST,		//! Test program dumps the list of contained test cases in plain-text format.
45bb274a4ddafcac39d829208a049e1461d2aa151eKalle Raita	RUNMODE_DUMP_STDOUT_CASELIST,	//! Test program dumps the list of contained test cases in plain-text format into stdout.
463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	RUNMODE_LAST
483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*!
513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Should graphical tests show rendering results on screen.
523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
533c827367444ee418f129b2c238299f49d3264554Jarkko Poyryenum WindowVisibility
543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	WINDOWVISIBILITY_WINDOWED = 0,
563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	WINDOWVISIBILITY_FULLSCREEN,
573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	WINDOWVISIBILITY_HIDDEN,
583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	WINDOWVISIBILITY_LAST
603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*!
633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief The type of rendering surface the tests should be executed on.
643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
653c827367444ee418f129b2c238299f49d3264554Jarkko Poyryenum SurfaceType
663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SURFACETYPE_WINDOW = 0,			//!< Native window.
683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SURFACETYPE_OFFSCREEN_NATIVE,	//!< Native offscreen surface, such as pixmap.
693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SURFACETYPE_OFFSCREEN_GENERIC,	//!< Generic offscreen surface, such as pbuffer.
703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SURFACETYPE_FBO,				//!< Framebuffer object.
713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SURFACETYPE_LAST
733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*!
763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Screen rotation, always to clockwise direction.
773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
783c827367444ee418f129b2c238299f49d3264554Jarkko Poyryenum ScreenRotation
793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
802dac2cccd65e5f837c3433c73c54790e6d0903d3Pyry Haulos	SCREENROTATION_UNSPECIFIED,		//!< Use default / current orientation.
812dac2cccd65e5f837c3433c73c54790e6d0903d3Pyry Haulos	SCREENROTATION_0,				//!< Set rotation to 0 degrees from baseline.
823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SCREENROTATION_90,
833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SCREENROTATION_180,
843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SCREENROTATION_270,
853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SCREENROTATION_LAST
873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
893c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass CaseTreeNode;
903c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass CasePaths;
913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*--------------------------------------------------------------------*//*!
933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Test command line
943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *
953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * CommandLine handles argument parsing and provides convinience functions
963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * for querying test parameters.
973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/
983c827367444ee418f129b2c238299f49d3264554Jarkko Poyryclass CommandLine
993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{
1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyrypublic:
1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									CommandLine					(void);
1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									CommandLine					(int argc, const char* const* argv);
1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	explicit						CommandLine					(const std::string& cmdLine);
1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									~CommandLine				(void);
1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool							parse						(int argc, const char* const* argv);
1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool							parse						(const std::string& cmdLine);
1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get log file name (--deqp-log-filename)
1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*						getLogFileName				(void) const;
1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get logging flags
1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32						getLogFlags					(void) const;
1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get run mode (--deqp-runmode)
1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	RunMode							getRunMode					(void) const;
1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
118bb274a4ddafcac39d829208a049e1461d2aa151eKalle Raita	//! Get caselist dump target file pattern (--deqp-caselist-export-file)
119bb274a4ddafcac39d829208a049e1461d2aa151eKalle Raita	const char*						getCaseListExportFile		(void) const;
120bb274a4ddafcac39d829208a049e1461d2aa151eKalle Raita
1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get default window visibility (--deqp-visibility)
1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	WindowVisibility				getVisibility				(void) const;
1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get watchdog enable status (--deqp-watchdog)
1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool							isWatchDogEnabled			(void) const;
1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get crash handling enable status (--deqp-crashhandler)
1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool							isCrashHandlingEnabled		(void) const;
1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get base seed for randomization (--deqp-base-seed)
1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int								getBaseSeed					(void) const;
1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get test iteration count (--deqp-test-iteration-count)
1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int								getTestIterationCount		(void) const;
1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get rendering target width (--deqp-surface-width)
1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int								getSurfaceWidth				(void) const;
1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get rendering target height (--deqp-surface-height)
1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int								getSurfaceHeight			(void) const;
1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get rendering taget type (--deqp-surface-type)
1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	SurfaceType						getSurfaceType				(void) const;
1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get screen rotation (--deqp-screen-rotation)
1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	ScreenRotation					getScreenRotation			(void) const;
1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get GL context factory name (--deqp-gl-context-type)
1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*						getGLContextType			(void) const;
1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get GL config ID (--deqp-gl-config-id)
1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int								getGLConfigId				(void) const;
1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get GL config name (--deqp-gl-config-name)
1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*						getGLConfigName				(void) const;
1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get GL context flags (--deqp-gl-context-flags)
1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*						getGLContextFlags			(void) const;
1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get OpenCL platform ID (--deqp-cl-platform-id)
1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	int								getCLPlatformId				(void) const;
1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get OpenCL device IDs (--deqp-cl-device-ids)
1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void							getCLDeviceIds				(std::vector<int>& deviceIds) const	{ deviceIds = getCLDeviceIds(); }
1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const std::vector<int>&			getCLDeviceIds				(void) const;
1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get extra OpenCL program build options (--deqp-cl-build-options)
1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*						getCLBuildOptions			(void) const;
1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get EGL native display factory (--deqp-egl-display-type)
1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*						getEGLDisplayType			(void) const;
1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get EGL native window factory (--deqp-egl-window-type)
1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*						getEGLWindowType			(void) const;
1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Get EGL native pixmap factory (--deqp-egl-pixmap-type)
1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	const char*						getEGLPixmapType			(void) const;
1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
17932675035be2a05886457025598f90c131d83c670Pyry Haulos	//! Get Vulkan device ID (--deqp-vk-device-id)
18032675035be2a05886457025598f90c131d83c670Pyry Haulos	int								getVKDeviceId				(void) const;
18132675035be2a05886457025598f90c131d83c670Pyry Haulos
182501ac7ba5259b7e9f6d107fe1bed304886ef7e12Pyry Haulos	//! Enable development-time test case validation checks
183501ac7ba5259b7e9f6d107fe1bed304886ef7e12Pyry Haulos	bool							isValidationEnabled			(void) const;
184501ac7ba5259b7e9f6d107fe1bed304886ef7e12Pyry Haulos
1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Should we run tests that exhaust memory (--deqp-test-oom)
1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool							isOutOfMemoryTestEnabled(void) const;
1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Check if test group is in supplied test case list.
1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool							checkTestGroupName			(const char* groupName) const;
1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	//! Check if test case is in supplied test case list.
1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	bool							checkTestCaseName			(const char* caseName) const;
1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
194bf44c5c30440b0c7a8c7c87f2b7c3ff984e77018Jarkko Pöyryprotected:
195bf44c5c30440b0c7a8c7c87f2b7c3ff984e77018Jarkko Pöyry	const de::cmdline::CommandLine&	getCommandLine				(void) const;
196bf44c5c30440b0c7a8c7c87f2b7c3ff984e77018Jarkko Pöyry
1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyryprivate:
1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry									CommandLine					(const CommandLine&);	// not allowed!
1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	CommandLine&					operator=					(const CommandLine&);	// not allowed!
2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	void							clear						(void);
2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
203bf44c5c30440b0c7a8c7c87f2b7c3ff984e77018Jarkko Pöyry	virtual void					registerExtendedOptions		(de::cmdline::Parser& parser);
204bf44c5c30440b0c7a8c7c87f2b7c3ff984e77018Jarkko Pöyry
2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	de::cmdline::CommandLine		m_cmdLine;
2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	deUint32						m_logFlags;
2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	CaseTreeNode*					m_caseTree;
2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry	de::MovePtr<const CasePaths>	m_casePaths;
2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry};
2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // tcu
2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry
2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#endif // _TCUCOMMANDLINE_HPP
214