Hash :
62cdd74a
Author :
Date :
2024-05-29T19:27:02
Prepare deqp_support files for the removal of de* types
- The de* types were removed by the change:
https://chromium.googlesource.com/external/github.com/KhronosGroup/VK-GL-CTS.git/+/1a09796462f70cfe2a6117f9bc6af6e3ef74e6ff
- This CL updates ANGLE accordingly. The change is generated by:
https://paste.googleplex.com/4847290045169664
- Reference:
https://github.com/KhronosGroup/VK-GL-CTS/blob/aefd5c09cacdb5a3320da717af6ec646d96c2379/format_all.sh#L17-L41
Notes:
- starting in patchset #10, the CL de-coulples the deqp_support updates
from the VK-GL-CTS DEPS advance.
Test: presubmit, and the problematic files mentioned in
http://b/343202259#comment3 are updated.
Bug: b/343202259
Change-Id: Idc374fa0873e9ddaafe4c9f861995952f2f5e7e1
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5580985
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Solti Ho <solti@google.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
/*-------------------------------------------------------------------------
* drawElements Quality Program Tester Core
* ----------------------------------------
*
* Copyright 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*//*!
* \file
* \brief Executor which can run randomly accessed tests.
*//*--------------------------------------------------------------------*/
#include "tcuRandomOrderExecutor.h"
#include "deClock.h"
#include "deStringUtil.hpp"
#include "tcuCommandLine.hpp"
#include "tcuTestLog.hpp"
#include <algorithm>
#include <cstdio>
#include <fstream>
using std::string;
using std::vector;
namespace tcu
{
RandomOrderExecutor::RandomOrderExecutor(TestPackageRoot &root,
TestContext &testCtx,
bool enableRenderDocCapture)
: m_testCtx(testCtx), m_inflater(testCtx)
{
m_nodeStack.push_back(NodeStackEntry(&root));
root.getChildren(m_nodeStack[0].children);
if (enableRenderDocCapture)
{
mRenderDoc.attach();
}
}
RandomOrderExecutor::~RandomOrderExecutor(void)
{
pruneStack(1);
}
void RandomOrderExecutor::pruneStack(size_t newStackSize)
{
// \note Root is not managed by us
DE_ASSERT(de::inRange(newStackSize, size_t(1), m_nodeStack.size()));
while (m_nodeStack.size() > newStackSize)
{
NodeStackEntry &curEntry = m_nodeStack.back();
const bool isPkg = curEntry.node->getNodeType() == NODETYPE_PACKAGE;
DE_ASSERT((m_nodeStack.size() == 2) == isPkg);
if (curEntry.node) // Just in case we are in
// cleanup path after partial
// prune
{
if (curEntry.node->getNodeType() == NODETYPE_GROUP)
m_inflater.leaveGroupNode(static_cast<TestCaseGroup *>(curEntry.node));
else if (curEntry.node->getNodeType() == NODETYPE_PACKAGE)
m_inflater.leaveTestPackage(static_cast<TestPackage *>(curEntry.node));
else
DE_ASSERT(curEntry.children.empty());
curEntry.node = DE_NULL;
curEntry.children.clear();
}
if (isPkg)
m_caseExecutor.clear();
m_nodeStack.pop_back();
}
}
static TestNode *findNodeByName(vector<TestNode *> &nodes, const std::string &name)
{
for (vector<TestNode *>::const_iterator node = nodes.begin(); node != nodes.end(); ++node)
{
if (name == (*node)->getName())
return *node;
}
return DE_NULL;
}
TestCase *RandomOrderExecutor::seekToCase(const string &path)
{
const vector<string> components = de::splitString(path, '.');
size_t compNdx;
DE_ASSERT(!m_nodeStack.empty() && m_nodeStack.front().node->getNodeType() == NODETYPE_ROOT);
for (compNdx = 0; compNdx < components.size(); compNdx++)
{
const size_t stackPos = compNdx + 1;
if (stackPos >= m_nodeStack.size())
break; // Stack end
else if (components[compNdx] != m_nodeStack[stackPos].node->getName())
{
// Current stack doesn't match any more, prune.
pruneStack(stackPos);
break;
}
}
DE_ASSERT(m_nodeStack.size() == compNdx + 1);
for (; compNdx < components.size(); compNdx++)
{
const size_t parentStackPos = compNdx;
TestNode *const curNode =
findNodeByName(m_nodeStack[parentStackPos].children, components[compNdx]);
if (!curNode)
throw Exception(string("Test hierarchy node not found: ") + path);
m_nodeStack.push_back(NodeStackEntry(curNode));
if (curNode->getNodeType() == NODETYPE_PACKAGE)
{
TestPackage *const testPackage = static_cast<TestPackage *>(curNode);
m_inflater.enterTestPackage(testPackage, m_nodeStack.back().children);
DE_ASSERT(!m_caseExecutor);
m_caseExecutor = de::MovePtr<TestCaseExecutor>(testPackage->createExecutor());
}
else if (curNode->getNodeType() == NODETYPE_GROUP)
m_inflater.enterGroupNode(static_cast<TestCaseGroup *>(curNode),
m_nodeStack.back().children);
else if (compNdx + 1 != components.size())
throw Exception(string("Invalid test hierarchy path: ") + path);
}
DE_ASSERT(m_nodeStack.size() == components.size() + 1);
if (isTestNodeTypeExecutable(m_nodeStack.back().node->getNodeType()))
return dynamic_cast<TestCase *>(m_nodeStack.back().node);
else
throw Exception(string("Not a test case: ") + path);
}
static qpTestCaseType nodeTypeToTestCaseType(TestNodeType nodeType)
{
switch (nodeType)
{
case NODETYPE_SELF_VALIDATE:
return QP_TEST_CASE_TYPE_SELF_VALIDATE;
case NODETYPE_PERFORMANCE:
return QP_TEST_CASE_TYPE_PERFORMANCE;
case NODETYPE_CAPABILITY:
return QP_TEST_CASE_TYPE_CAPABILITY;
case NODETYPE_ACCURACY:
return QP_TEST_CASE_TYPE_ACCURACY;
default:
DE_ASSERT(false);
return QP_TEST_CASE_TYPE_LAST;
}
}
TestStatus RandomOrderExecutor::execute(const std::string &casePath)
{
TestCase *const testCase = seekToCase(casePath);
TestLog &log = m_testCtx.getLog();
const qpTestCaseType caseType = nodeTypeToTestCaseType(testCase->getNodeType());
m_testCtx.setTerminateAfter(false);
log.startCase(casePath.c_str(), caseType);
{
const TestStatus result = executeInner(testCase, casePath);
log.endCase(result.getCode(), result.getDescription().c_str());
return result;
}
}
tcu::TestStatus RandomOrderExecutor::executeInner(TestCase *testCase, const std::string &casePath)
{
TestLog &log = m_testCtx.getLog();
const uint64_t testStartTime = deGetMicroseconds();
m_testCtx.setTestResult(QP_TEST_RESULT_LAST, "");
// Initialize, will return immediately if fails
try
{
mRenderDoc.startFrame();
m_caseExecutor->init(testCase, casePath);
}
catch (const std::bad_alloc &)
{
m_testCtx.setTerminateAfter(true);
return TestStatus(QP_TEST_RESULT_RESOURCE_ERROR,
"Failed to allocate memory in test case init");
}
catch (const TestException &e)
{
DE_ASSERT(e.getTestResult() != QP_TEST_RESULT_LAST);
m_testCtx.setTerminateAfter(e.isFatal());
log << e;
return TestStatus(e.getTestResult(), e.getMessage());
}
catch (const Exception &e)
{
log << e;
return TestStatus(QP_TEST_RESULT_FAIL, e.getMessage());
}
bool isFirstFrameBeingCaptured = true;
// Execute
for (;;)
{
TestCase::IterateResult iterateResult = TestCase::STOP;
m_testCtx.touchWatchdog();
try
{
// Make every iteration produce one renderdoc frame. Include the init code in the first
// frame, and the deinit code in the last frame.
if (!isFirstFrameBeingCaptured)
{
mRenderDoc.endFrame();
mRenderDoc.startFrame();
}
isFirstFrameBeingCaptured = false;
iterateResult = m_caseExecutor->iterate(testCase);
}
catch (const std::bad_alloc &)
{
m_testCtx.setTestResult(QP_TEST_RESULT_RESOURCE_ERROR,
"Failed to allocate memory during test "
"execution");
}
catch (const TestException &e)
{
log << e;
m_testCtx.setTestResult(e.getTestResult(), e.getMessage());
m_testCtx.setTerminateAfter(e.isFatal());
}
catch (const Exception &e)
{
log << e;
m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, e.getMessage());
}
if (iterateResult == TestCase::STOP)
break;
}
DE_ASSERT(m_testCtx.getTestResult() != QP_TEST_RESULT_LAST);
if (m_testCtx.getTestResult() == QP_TEST_RESULT_RESOURCE_ERROR)
m_testCtx.setTerminateAfter(true);
// De-initialize
try
{
m_caseExecutor->deinit(testCase);
mRenderDoc.endFrame();
}
catch (const tcu::Exception &e)
{
log << e << TestLog::Message
<< "Error in test case deinit, test program "
"will terminate."
<< TestLog::EndMessage;
m_testCtx.setTerminateAfter(true);
}
if (m_testCtx.getWatchDog())
qpWatchDog_reset(m_testCtx.getWatchDog());
{
const TestStatus result =
TestStatus(m_testCtx.getTestResult(), m_testCtx.getTestResultDesc());
m_testCtx.setTestResult(QP_TEST_RESULT_LAST, "");
return result;
}
}
} // namespace tcu