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) ...@@ -330,7 +330,7 @@ inline bool GetGPUTestSystemInfo(SystemInfo **sysInfo)
sSystemInfo = new SystemInfo; sSystemInfo = new SystemInfo;
if (!GetSystemInfo(sSystemInfo)) if (!GetSystemInfo(sSystemInfo))
{ {
std::cout << "Error populating SystemInfo for dEQP tests." << std::endl; std::cout << "Error populating SystemInfo." << std::endl;
} }
else else
{ {
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#include "common/debug.h" #include "common/debug.h"
#include "common/string_utils.h" #include "common/string_utils.h"
#include "GPUTestConfig.h"
namespace angle namespace angle
{ {
...@@ -272,8 +270,8 @@ GPUTestExpectationsParser::GPUTestExpectationsParser() ...@@ -272,8 +270,8 @@ GPUTestExpectationsParser::GPUTestExpectationsParser()
GPUTestExpectationsParser::~GPUTestExpectationsParser() = default; GPUTestExpectationsParser::~GPUTestExpectationsParser() = default;
bool GPUTestExpectationsParser::loadTestExpectations(const GPUTestConfig &config, bool GPUTestExpectationsParser::loadTestExpectationsImpl(const GPUTestConfig *config,
const std::string &data) const std::string &data)
{ {
mEntries.clear(); mEntries.clear();
mErrorMessages.clear(); mErrorMessages.clear();
...@@ -294,8 +292,19 @@ bool GPUTestExpectationsParser::loadTestExpectations(const GPUTestConfig &config ...@@ -294,8 +292,19 @@ bool GPUTestExpectationsParser::loadTestExpectations(const GPUTestConfig &config
return rt; return rt;
} }
bool GPUTestExpectationsParser::loadTestExpectationsFromFile(const GPUTestConfig &config, bool GPUTestExpectationsParser::loadTestExpectations(const GPUTestConfig &config,
const std::string &path) 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(); mEntries.clear();
mErrorMessages.clear(); mErrorMessages.clear();
...@@ -306,23 +315,50 @@ bool GPUTestExpectationsParser::loadTestExpectationsFromFile(const GPUTestConfig ...@@ -306,23 +315,50 @@ bool GPUTestExpectationsParser::loadTestExpectationsFromFile(const GPUTestConfig
mErrorMessages.push_back(kErrorMessage[kErrorFileIO]); mErrorMessages.push_back(kErrorMessage[kErrorFileIO]);
return false; 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; size_t maxExpectationLen = 0;
GPUTestExpectationEntry *foundEntry = nullptr; 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. // The longest/most specific matching expectation overrides any others.
if (expectationLen > maxExpectationLen) if (satisfiesConditions && expectationLen > maxExpectationLen)
{ {
maxExpectationLen = expectationLen; maxExpectationLen = expectationLen;
foundEntry = &mEntries[i]; foundEntry = &entry;
} }
} }
} }
...@@ -334,6 +370,17 @@ int32_t GPUTestExpectationsParser::getTestExpectation(const std::string &testNam ...@@ -334,6 +370,17 @@ int32_t GPUTestExpectationsParser::getTestExpectation(const std::string &testNam
return kGpuTestPass; 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 const std::vector<std::string> &GPUTestExpectationsParser::getErrorMessages() const
{ {
return mErrorMessages; return mErrorMessages;
...@@ -353,7 +400,7 @@ std::vector<std::string> GPUTestExpectationsParser::getUnusedExpectationsMessage ...@@ -353,7 +400,7 @@ std::vector<std::string> GPUTestExpectationsParser::getUnusedExpectationsMessage
return messages; return messages;
} }
bool GPUTestExpectationsParser::parseLine(const GPUTestConfig &config, bool GPUTestExpectationsParser::parseLine(const GPUTestConfig *config,
const std::string &lineData, const std::string &lineData,
size_t lineNumber) size_t lineNumber)
{ {
...@@ -421,9 +468,17 @@ bool GPUTestExpectationsParser::parseLine(const GPUTestConfig &config, ...@@ -421,9 +468,17 @@ bool GPUTestExpectationsParser::parseLine(const GPUTestConfig &config,
} }
{ {
bool err = false; 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) if (err)
{ {
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "GPUTestConfig.h"
namespace angle namespace angle
{ {
...@@ -38,6 +40,8 @@ class GPUTestExpectationsParser ...@@ -38,6 +40,8 @@ class GPUTestExpectationsParser
// Return true if parsing succeeds. // Return true if parsing succeeds.
bool loadTestExpectations(const GPUTestConfig &config, const std::string &data); bool loadTestExpectations(const GPUTestConfig &config, const std::string &data);
bool loadTestExpectationsFromFile(const GPUTestConfig &config, const std::string &path); 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. // Query error messages from the last LoadTestExpectations() call.
const std::vector<std::string> &getErrorMessages() const; const std::vector<std::string> &getErrorMessages() const;
...@@ -47,6 +51,7 @@ class GPUTestExpectationsParser ...@@ -47,6 +51,7 @@ class GPUTestExpectationsParser
// Get the test expectation of a given test on a given bot. // Get the test expectation of a given test on a given bot.
int32_t getTestExpectation(const std::string &testName); int32_t getTestExpectation(const std::string &testName);
int32_t getTestExpectationWithConfig(const GPUTestConfig &config, const std::string &testName);
private: private:
struct GPUTestExpectationEntry struct GPUTestExpectationEntry
...@@ -57,11 +62,12 @@ class GPUTestExpectationsParser ...@@ -57,11 +62,12 @@ class GPUTestExpectationsParser
int32_t testExpectation; int32_t testExpectation;
size_t lineNumber; size_t lineNumber;
bool used; bool used;
GPUTestConfig::ConditionArray conditions;
}; };
// Parse a line of text. If we have a valid entry, save it; otherwise, // Parse a line of text. If we have a valid entry, save it; otherwise,
// generate error messages. // 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. // Check a the condition assigned to a particular token.
bool checkTokenCondition(const GPUTestConfig &config, bool checkTokenCondition(const GPUTestConfig &config,
...@@ -82,6 +88,12 @@ class GPUTestExpectationsParser ...@@ -82,6 +88,12 @@ class GPUTestExpectationsParser
size_t entry1LineNumber, size_t entry1LineNumber,
size_t entry2LineNumber); 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<GPUTestExpectationEntry> mEntries;
std::vector<std::string> mErrorMessages; 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