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