1e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
2e5c31af7Sopenharmony_ci * drawElements Quality Program Tester Core
3e5c31af7Sopenharmony_ci * ----------------------------------------
4e5c31af7Sopenharmony_ci *
5e5c31af7Sopenharmony_ci * Copyright 2014 The Android Open Source Project
6e5c31af7Sopenharmony_ci *
7e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
8e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License.
9e5c31af7Sopenharmony_ci * You may obtain a copy of the License at
10e5c31af7Sopenharmony_ci *
11e5c31af7Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
12e5c31af7Sopenharmony_ci *
13e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
14e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
15e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and
17e5c31af7Sopenharmony_ci * limitations under the License.
18e5c31af7Sopenharmony_ci *
19e5c31af7Sopenharmony_ci *//*!
20e5c31af7Sopenharmony_ci * \file
21e5c31af7Sopenharmony_ci * \brief Context shared between test cases.
22e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ci#include "tcuTestContext.hpp"
25e5c31af7Sopenharmony_ci#include "tcuCommandLine.hpp"
26e5c31af7Sopenharmony_ci#include "tcuTestLog.hpp"
27e5c31af7Sopenharmony_ci
28e5c31af7Sopenharmony_cinamespace tcu
29e5c31af7Sopenharmony_ci{
30e5c31af7Sopenharmony_ci
31e5c31af7Sopenharmony_ciTestContext::TestContext (
32e5c31af7Sopenharmony_ci	Platform&			platform,
33e5c31af7Sopenharmony_ci	Archive&			rootArchive,
34e5c31af7Sopenharmony_ci	TestLog&			log,
35e5c31af7Sopenharmony_ci	const CommandLine&	cmdLine,
36e5c31af7Sopenharmony_ci	qpWatchDog*			watchDog)
37e5c31af7Sopenharmony_ci	: m_platform		(platform)
38e5c31af7Sopenharmony_ci	, m_rootArchive		(rootArchive)
39e5c31af7Sopenharmony_ci	, m_log				(log)
40e5c31af7Sopenharmony_ci	, m_cmdLine			(cmdLine)
41e5c31af7Sopenharmony_ci	, m_watchDog		(watchDog)
42e5c31af7Sopenharmony_ci	, m_curArchive		(DE_NULL)
43e5c31af7Sopenharmony_ci	, m_testResult		(QP_TEST_RESULT_LAST)
44e5c31af7Sopenharmony_ci	, m_terminateAfter	(false)
45e5c31af7Sopenharmony_ci{
46e5c31af7Sopenharmony_ci	setCurrentArchive(m_rootArchive);
47e5c31af7Sopenharmony_ci}
48e5c31af7Sopenharmony_ci
49e5c31af7Sopenharmony_civoid TestContext::writeSessionInfo(void)
50e5c31af7Sopenharmony_ci{
51e5c31af7Sopenharmony_ci	const std::string sessionInfo = "#sessionInfo commandLineParameters \"";
52e5c31af7Sopenharmony_ci	m_log.writeSessionInfo(sessionInfo + m_cmdLine.getInitialCmdLine() + "\"\n");
53e5c31af7Sopenharmony_ci}
54e5c31af7Sopenharmony_ci
55e5c31af7Sopenharmony_civoid TestContext::touchWatchdog (void)
56e5c31af7Sopenharmony_ci{
57e5c31af7Sopenharmony_ci	if (m_watchDog)
58e5c31af7Sopenharmony_ci		qpWatchDog_touch(m_watchDog);
59e5c31af7Sopenharmony_ci}
60e5c31af7Sopenharmony_ci
61e5c31af7Sopenharmony_civoid TestContext::touchWatchdogAndDisableIntervalTimeLimit (void)
62e5c31af7Sopenharmony_ci{
63e5c31af7Sopenharmony_ci	if (m_watchDog)
64e5c31af7Sopenharmony_ci		qpWatchDog_touchAndDisableIntervalTimeLimit(m_watchDog);
65e5c31af7Sopenharmony_ci}
66e5c31af7Sopenharmony_ci
67e5c31af7Sopenharmony_civoid TestContext::touchWatchdogAndEnableIntervalTimeLimit (void)
68e5c31af7Sopenharmony_ci{
69e5c31af7Sopenharmony_ci	if (m_watchDog)
70e5c31af7Sopenharmony_ci		qpWatchDog_touchAndEnableIntervalTimeLimit(m_watchDog);
71e5c31af7Sopenharmony_ci}
72e5c31af7Sopenharmony_ci
73e5c31af7Sopenharmony_civoid TestContext::setTestResult (qpTestResult testResult, const char* description)
74e5c31af7Sopenharmony_ci{
75e5c31af7Sopenharmony_ci	m_testResult		= testResult;
76e5c31af7Sopenharmony_ci	m_testResultDesc	= description;
77e5c31af7Sopenharmony_ci}
78e5c31af7Sopenharmony_ci
79e5c31af7Sopenharmony_ci} // tcu
80