xref: /aosp_15_r20/external/deqp/executor/xeBatchExecutor.hpp (revision 35238bce31c2a825756842865a792f8cf7f89930)
1*35238bceSAndroid Build Coastguard Worker #ifndef _XEBATCHEXECUTOR_HPP
2*35238bceSAndroid Build Coastguard Worker #define _XEBATCHEXECUTOR_HPP
3*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
4*35238bceSAndroid Build Coastguard Worker  * drawElements Quality Program Test Executor
5*35238bceSAndroid Build Coastguard Worker  * ------------------------------------------
6*35238bceSAndroid Build Coastguard Worker  *
7*35238bceSAndroid Build Coastguard Worker  * Copyright 2014 The Android Open Source Project
8*35238bceSAndroid Build Coastguard Worker  *
9*35238bceSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
10*35238bceSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
11*35238bceSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
12*35238bceSAndroid Build Coastguard Worker  *
13*35238bceSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
14*35238bceSAndroid Build Coastguard Worker  *
15*35238bceSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
16*35238bceSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
17*35238bceSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18*35238bceSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
19*35238bceSAndroid Build Coastguard Worker  * limitations under the License.
20*35238bceSAndroid Build Coastguard Worker  *
21*35238bceSAndroid Build Coastguard Worker  *//*!
22*35238bceSAndroid Build Coastguard Worker  * \file
23*35238bceSAndroid Build Coastguard Worker  * \brief Test batch executor.
24*35238bceSAndroid Build Coastguard Worker  *//*--------------------------------------------------------------------*/
25*35238bceSAndroid Build Coastguard Worker 
26*35238bceSAndroid Build Coastguard Worker #include "xeDefs.hpp"
27*35238bceSAndroid Build Coastguard Worker #include "xeBatchResult.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "xeCommLink.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "xeTestLogParser.hpp"
30*35238bceSAndroid Build Coastguard Worker #include "xeCallQueue.hpp"
31*35238bceSAndroid Build Coastguard Worker 
32*35238bceSAndroid Build Coastguard Worker #include <string>
33*35238bceSAndroid Build Coastguard Worker #include <vector>
34*35238bceSAndroid Build Coastguard Worker 
35*35238bceSAndroid Build Coastguard Worker namespace xe
36*35238bceSAndroid Build Coastguard Worker {
37*35238bceSAndroid Build Coastguard Worker 
38*35238bceSAndroid Build Coastguard Worker struct TargetConfiguration
39*35238bceSAndroid Build Coastguard Worker {
TargetConfigurationxe::TargetConfiguration40*35238bceSAndroid Build Coastguard Worker     TargetConfiguration(void) : maxCasesPerSession(1000)
41*35238bceSAndroid Build Coastguard Worker     {
42*35238bceSAndroid Build Coastguard Worker     }
43*35238bceSAndroid Build Coastguard Worker 
44*35238bceSAndroid Build Coastguard Worker     std::string binaryName;
45*35238bceSAndroid Build Coastguard Worker     std::string workingDir;
46*35238bceSAndroid Build Coastguard Worker     std::string cmdLineArgs;
47*35238bceSAndroid Build Coastguard Worker     int maxCasesPerSession;
48*35238bceSAndroid Build Coastguard Worker };
49*35238bceSAndroid Build Coastguard Worker 
50*35238bceSAndroid Build Coastguard Worker class BatchExecutorLogHandler : public TestLogHandler
51*35238bceSAndroid Build Coastguard Worker {
52*35238bceSAndroid Build Coastguard Worker public:
53*35238bceSAndroid Build Coastguard Worker     BatchExecutorLogHandler(BatchResult *batchResult);
54*35238bceSAndroid Build Coastguard Worker     ~BatchExecutorLogHandler(void);
55*35238bceSAndroid Build Coastguard Worker 
56*35238bceSAndroid Build Coastguard Worker     void setSessionInfo(const SessionInfo &sessionInfo);
57*35238bceSAndroid Build Coastguard Worker 
58*35238bceSAndroid Build Coastguard Worker     TestCaseResultPtr startTestCaseResult(const char *casePath);
59*35238bceSAndroid Build Coastguard Worker     void testCaseResultUpdated(const TestCaseResultPtr &resultData);
60*35238bceSAndroid Build Coastguard Worker     void testCaseResultComplete(const TestCaseResultPtr &resultData);
61*35238bceSAndroid Build Coastguard Worker 
62*35238bceSAndroid Build Coastguard Worker private:
63*35238bceSAndroid Build Coastguard Worker     BatchResult *m_batchResult;
64*35238bceSAndroid Build Coastguard Worker };
65*35238bceSAndroid Build Coastguard Worker 
66*35238bceSAndroid Build Coastguard Worker class BatchExecutor
67*35238bceSAndroid Build Coastguard Worker {
68*35238bceSAndroid Build Coastguard Worker public:
69*35238bceSAndroid Build Coastguard Worker     BatchExecutor(const TargetConfiguration &config, CommLink *commLink, const TestNode *root, const TestSet &testSet,
70*35238bceSAndroid Build Coastguard Worker                   BatchResult *batchResult, InfoLog *infoLog);
71*35238bceSAndroid Build Coastguard Worker     ~BatchExecutor(void);
72*35238bceSAndroid Build Coastguard Worker 
73*35238bceSAndroid Build Coastguard Worker     void run(void);
74*35238bceSAndroid Build Coastguard Worker     void cancel(void); //!< Cancel current run(), can be called from any thread.
75*35238bceSAndroid Build Coastguard Worker 
76*35238bceSAndroid Build Coastguard Worker private:
77*35238bceSAndroid Build Coastguard Worker     BatchExecutor(const BatchExecutor &other);
78*35238bceSAndroid Build Coastguard Worker     BatchExecutor &operator=(const BatchExecutor &other);
79*35238bceSAndroid Build Coastguard Worker 
80*35238bceSAndroid Build Coastguard Worker     bool iterate(void);
81*35238bceSAndroid Build Coastguard Worker 
82*35238bceSAndroid Build Coastguard Worker     void onStateChanged(CommLinkState state, const char *message);
83*35238bceSAndroid Build Coastguard Worker     void onTestLogData(const uint8_t *bytes, size_t numBytes);
84*35238bceSAndroid Build Coastguard Worker     void onInfoLogData(const uint8_t *bytes, size_t numBytes);
85*35238bceSAndroid Build Coastguard Worker 
86*35238bceSAndroid Build Coastguard Worker     void launchTestSet(const TestSet &testSet);
87*35238bceSAndroid Build Coastguard Worker 
88*35238bceSAndroid Build Coastguard Worker     // Callbacks for CommLink.
89*35238bceSAndroid Build Coastguard Worker     static void enqueueStateChanged(void *userPtr, CommLinkState state, const char *message);
90*35238bceSAndroid Build Coastguard Worker     static void enqueueTestLogData(void *userPtr, const uint8_t *bytes, size_t numBytes);
91*35238bceSAndroid Build Coastguard Worker     static void enqueueInfoLogData(void *userPtr, const uint8_t *bytes, size_t numBytes);
92*35238bceSAndroid Build Coastguard Worker 
93*35238bceSAndroid Build Coastguard Worker     // Called in CallQueue dispatch.
94*35238bceSAndroid Build Coastguard Worker     static void dispatchStateChanged(CallReader &data);
95*35238bceSAndroid Build Coastguard Worker     static void dispatchTestLogData(CallReader &data);
96*35238bceSAndroid Build Coastguard Worker     static void dispatchInfoLogData(CallReader &data);
97*35238bceSAndroid Build Coastguard Worker 
98*35238bceSAndroid Build Coastguard Worker     enum State
99*35238bceSAndroid Build Coastguard Worker     {
100*35238bceSAndroid Build Coastguard Worker         STATE_NOT_STARTED,
101*35238bceSAndroid Build Coastguard Worker         STATE_STARTED,
102*35238bceSAndroid Build Coastguard Worker         STATE_FINISHED,
103*35238bceSAndroid Build Coastguard Worker 
104*35238bceSAndroid Build Coastguard Worker         STATE_LAST
105*35238bceSAndroid Build Coastguard Worker     };
106*35238bceSAndroid Build Coastguard Worker 
107*35238bceSAndroid Build Coastguard Worker     TargetConfiguration m_config;
108*35238bceSAndroid Build Coastguard Worker     CommLink *m_commLink;
109*35238bceSAndroid Build Coastguard Worker 
110*35238bceSAndroid Build Coastguard Worker     const TestNode *m_root;
111*35238bceSAndroid Build Coastguard Worker     const TestSet &m_testSet;
112*35238bceSAndroid Build Coastguard Worker 
113*35238bceSAndroid Build Coastguard Worker     BatchExecutorLogHandler m_logHandler;
114*35238bceSAndroid Build Coastguard Worker     BatchResult *m_batchResult;
115*35238bceSAndroid Build Coastguard Worker     InfoLog *m_infoLog;
116*35238bceSAndroid Build Coastguard Worker 
117*35238bceSAndroid Build Coastguard Worker     State m_state;
118*35238bceSAndroid Build Coastguard Worker     TestSet m_casesToExecute;
119*35238bceSAndroid Build Coastguard Worker 
120*35238bceSAndroid Build Coastguard Worker     TestLogParser m_testLogParser;
121*35238bceSAndroid Build Coastguard Worker 
122*35238bceSAndroid Build Coastguard Worker     CallQueue m_dispatcher;
123*35238bceSAndroid Build Coastguard Worker };
124*35238bceSAndroid Build Coastguard Worker 
125*35238bceSAndroid Build Coastguard Worker } // namespace xe
126*35238bceSAndroid Build Coastguard Worker 
127*35238bceSAndroid Build Coastguard Worker #endif // _XEBATCHEXECUTOR_HPP
128