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