Commit e601181d by Jamie Madill Committed by Commit Bot

Allow specifying GPU config on expectation check.

When we load the expectations we can now specify the config at a later point. This will make it easier to run test suites that use multiple APIs, like angle_end2end_tests. We can instead specify the config when we check the expectation. Bug: angleproject:5951 Change-Id: I9607db093e4a459550a7cd6864b17adfa55e17f2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2892273 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent c5e344b1
......@@ -330,7 +330,7 @@ inline bool GetGPUTestSystemInfo(SystemInfo **sysInfo)
sSystemInfo = new SystemInfo;
if (!GetSystemInfo(sSystemInfo))
{
std::cout << "Error populating SystemInfo for dEQP tests." << std::endl;
std::cout << "Error populating SystemInfo." << std::endl;
}
else
{
......
......@@ -14,8 +14,6 @@
#include "common/debug.h"
#include "common/string_utils.h"
#include "GPUTestConfig.h"
namespace angle
{
......@@ -272,8 +270,8 @@ GPUTestExpectationsParser::GPUTestExpectationsParser()
GPUTestExpectationsParser::~GPUTestExpectationsParser() = default;
bool GPUTestExpectationsParser::loadTestExpectations(const GPUTestConfig &config,
const std::string &data)
bool GPUTestExpectationsParser::loadTestExpectationsImpl(const GPUTestConfig *config,
const std::string &data)
{
mEntries.clear();
mErrorMessages.clear();
......@@ -294,8 +292,19 @@ bool GPUTestExpectationsParser::loadTestExpectations(const GPUTestConfig &config
return rt;
}
bool GPUTestExpectationsParser::loadTestExpectationsFromFile(const GPUTestConfig &config,
const std::string &path)
bool GPUTestExpectationsParser::loadTestExpectations(const GPUTestConfig &config,
const std::string &data)
{
return loadTestExpectationsImpl(&config, data);
}
bool GPUTestExpectationsParser::loadAllTestExpectations(const std::string &data)
{
return loadTestExpectationsImpl(nullptr, data);
}
bool GPUTestExpectationsParser::loadTestExpectationsFromFileImpl(const GPUTestConfig *config,
const std::string &path)
{
mEntries.clear();
mErrorMessages.clear();
......@@ -306,23 +315,50 @@ bool GPUTestExpectationsParser::loadTestExpectationsFromFile(const GPUTestConfig
mErrorMessages.push_back(kErrorMessage[kErrorFileIO]);
return false;
}
return loadTestExpectations(config, data);
return loadTestExpectationsImpl(config, data);
}
int32_t GPUTestExpectationsParser::getTestExpectation(const std::string &testName)
bool GPUTestExpectationsParser::loadTestExpectationsFromFile(const GPUTestConfig &config,
const std::string &path)
{
return loadTestExpectationsFromFileImpl(&config, path);
}
bool GPUTestExpectationsParser::loadAllTestExpectationsFromFile(const std::string &path)
{
return loadTestExpectationsFromFileImpl(nullptr, path);
}
int32_t GPUTestExpectationsParser::getTestExpectationImpl(const GPUTestConfig *config,
const std::string &testName)
{
size_t maxExpectationLen = 0;
GPUTestExpectationEntry *foundEntry = nullptr;
for (size_t i = 0; i < mEntries.size(); ++i)
for (GPUTestExpectationEntry &entry : mEntries)
{
if (NamesMatchWithWildcard(mEntries[i].testName.c_str(), testName.c_str()))
if (NamesMatchWithWildcard(entry.testName.c_str(), testName.c_str()))
{
size_t expectationLen = mEntries[i].testName.length();
size_t expectationLen = entry.testName.length();
// Filter by condition first.
bool satisfiesConditions = true;
if (config)
{
for (size_t condition : entry.conditions)
{
if (!config->getConditions()[condition])
{
satisfiesConditions = false;
break;
}
}
}
// The longest/most specific matching expectation overrides any others.
if (expectationLen > maxExpectationLen)
if (satisfiesConditions && expectationLen > maxExpectationLen)
{
maxExpectationLen = expectationLen;
foundEntry = &mEntries[i];
foundEntry = &entry;
}
}
}
......@@ -334,6 +370,17 @@ int32_t GPUTestExpectationsParser::getTestExpectation(const std::string &testNam
return kGpuTestPass;
}
int32_t GPUTestExpectationsParser::getTestExpectation(const std::string &testName)
{
return getTestExpectationImpl(nullptr, testName);
}
int32_t GPUTestExpectationsParser::getTestExpectationWithConfig(const GPUTestConfig &config,
const std::string &testName)
{
return getTestExpectationImpl(&config, testName);
}
const std::vector<std::string> &GPUTestExpectationsParser::getErrorMessages() const
{
return mErrorMessages;
......@@ -353,7 +400,7 @@ std::vector<std::string> GPUTestExpectationsParser::getUnusedExpectationsMessage
return messages;
}
bool GPUTestExpectationsParser::parseLine(const GPUTestConfig &config,
bool GPUTestExpectationsParser::parseLine(const GPUTestConfig *config,
const std::string &lineData,
size_t lineNumber)
{
......@@ -421,9 +468,17 @@ bool GPUTestExpectationsParser::parseLine(const GPUTestConfig &config,
}
{
bool err = false;
if (!checkTokenCondition(config, err, token, lineNumber))
if (config)
{
if (!checkTokenCondition(*config, err, token, lineNumber))
{
skipLine = true; // Move to the next line without adding this one.
}
}
else
{
skipLine = true; // Move to the next line without adding this one.
// Store the conditions for later comparison if we don't have a config.
entry.conditions[kTokenData[token].condition] = true;
}
if (err)
{
......
......@@ -13,6 +13,8 @@
#include <string>
#include <vector>
#include "GPUTestConfig.h"
namespace angle
{
......@@ -38,6 +40,8 @@ class GPUTestExpectationsParser
// Return true if parsing succeeds.
bool loadTestExpectations(const GPUTestConfig &config, const std::string &data);
bool loadTestExpectationsFromFile(const GPUTestConfig &config, const std::string &path);
bool loadAllTestExpectations(const std::string &data);
bool loadAllTestExpectationsFromFile(const std::string &path);
// Query error messages from the last LoadTestExpectations() call.
const std::vector<std::string> &getErrorMessages() const;
......@@ -47,6 +51,7 @@ class GPUTestExpectationsParser
// Get the test expectation of a given test on a given bot.
int32_t getTestExpectation(const std::string &testName);
int32_t getTestExpectationWithConfig(const GPUTestConfig &config, const std::string &testName);
private:
struct GPUTestExpectationEntry
......@@ -57,11 +62,12 @@ class GPUTestExpectationsParser
int32_t testExpectation;
size_t lineNumber;
bool used;
GPUTestConfig::ConditionArray conditions;
};
// Parse a line of text. If we have a valid entry, save it; otherwise,
// generate error messages.
bool parseLine(const GPUTestConfig &config, const std::string &lineData, size_t lineNumber);
bool parseLine(const GPUTestConfig *config, const std::string &lineData, size_t lineNumber);
// Check a the condition assigned to a particular token.
bool checkTokenCondition(const GPUTestConfig &config,
......@@ -82,6 +88,12 @@ class GPUTestExpectationsParser
size_t entry1LineNumber,
size_t entry2LineNumber);
// Config is optional.
bool loadTestExpectationsFromFileImpl(const GPUTestConfig *config, const std::string &path);
bool loadTestExpectationsImpl(const GPUTestConfig *config, const std::string &data);
int32_t getTestExpectationImpl(const GPUTestConfig *config, const std::string &testName);
std::vector<GPUTestExpectationEntry> mEntries;
std::vector<std::string> mErrorMessages;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment