Commit cc9d0f75 by Jamie Madill Committed by Commit Bot

Improve test expectations overlap check.

Uses the conditions for the expectation to determine if there's a bug. Necessary for the new loading mechanism which defers filtering. Bug: angleproject:5951 Change-Id: Ic0c65438f7f155caff72b3ceeb4e65f8184c8efc Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2902666Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent ffb71dc2
...@@ -236,6 +236,38 @@ inline Token ParseToken(const std::string &word) ...@@ -236,6 +236,38 @@ inline Token ParseToken(const std::string &word)
} }
return kTokenWord; return kTokenWord;
} }
bool ConditionArrayIsSubset(const GPUTestConfig::ConditionArray &subset,
const GPUTestConfig::ConditionArray &superset)
{
for (size_t subsetCondition : subset)
{
bool foundCondition = false;
for (size_t supersetCondition : superset)
{
if (subsetCondition == supersetCondition)
{
foundCondition = true;
break;
}
}
if (!foundCondition)
{
return false;
}
}
return true;
}
// If one array is completely contained within the other, then we say the conditions overlap.
bool ConditionsOverlap(const GPUTestConfig::ConditionArray &conditionsI,
const GPUTestConfig::ConditionArray &conditionsJ)
{
return ConditionArrayIsSubset(conditionsI, conditionsJ) ||
ConditionArrayIsSubset(conditionsJ, conditionsI);
}
} // anonymous namespace } // anonymous namespace
const char *GetConditionName(uint32_t condition) const char *GetConditionName(uint32_t condition)
...@@ -601,10 +633,13 @@ bool GPUTestExpectationsParser::detectConflictsBetweenEntries() ...@@ -601,10 +633,13 @@ bool GPUTestExpectationsParser::detectConflictsBetweenEntries()
{ {
for (size_t j = i + 1; j < mEntries.size(); ++j) for (size_t j = i + 1; j < mEntries.size(); ++j)
{ {
if (mEntries[i].testName == mEntries[j].testName) const GPUTestExpectationEntry &entryI = mEntries[i];
const GPUTestExpectationEntry &entryJ = mEntries[j];
if (entryI.testName == entryJ.testName &&
ConditionsOverlap(entryI.conditions, entryJ.conditions))
{ {
pushErrorMessage(kErrorMessage[kErrorEntriesOverlap], mEntries[i].lineNumber, pushErrorMessage(kErrorMessage[kErrorEntriesOverlap], entryI.lineNumber,
mEntries[j].lineNumber); entryJ.lineNumber);
rt = true; rt = true;
} }
} }
......
...@@ -411,6 +411,20 @@ TEST_P(GPUTestExpectationsParserTest, GPUTestExpectationsParserOverrideExpectati ...@@ -411,6 +411,20 @@ TEST_P(GPUTestExpectationsParserTest, GPUTestExpectationsParserOverrideExpectati
EXPECT_TRUE(parser.getUnusedExpectationsMessages().empty()); EXPECT_TRUE(parser.getUnusedExpectationsMessages().empty());
} }
// Tests that overlap checking doesn't generate false positives.
TEST_P(GPUTestExpectationsParserTest, OverlapConditions)
{
std::string lines = R"(
100 NVIDIA VULKAN : dEQP-GLES31.functional.layout_binding.ubo.* = SKIP
100 NVIDIA D3D11 : dEQP-GLES31.functional.layout_binding.ubo.* = SKIP)";
ASSERT_TRUE(load(lines));
ASSERT_TRUE(parser.getErrorMessages().empty());
EXPECT_EQ(get("dEQP-GLES31.functional.layout_binding.ubo.vertex_binding_max"),
GPUTestExpectationsParser::kGpuTestSkip);
}
std::string ConditionTestTypeName(testing::TestParamInfo<ConditionTestType> testParamInfo) std::string ConditionTestTypeName(testing::TestParamInfo<ConditionTestType> testParamInfo)
{ {
if (testParamInfo.param == ConditionTestType::OnLoad) if (testParamInfo.param == ConditionTestType::OnLoad)
......
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