tools/cts: Fix expectations update failure

appendConsumedResultsForSkippedTests() adds fake results for expectations that are 'Skip'ed, so that these sub-trees aren't collapsed as all passing.

However, this code was not handling the fact that there might actually be results for the cases.
This happened because there was an expectation collision in the expectations.txt file, and tests were not being skipped even though there was an expectation with a Skip (a collision expectation was used instead).

Change-Id: I2a1543d231db44dc8aa6683d051f884f4cb96853
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113520
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Ben Clayton 2022-12-08 20:59:01 +00:00 committed by Dawn LUCI CQ
parent 06c1af47bd
commit 5f55990471
1 changed files with 26 additions and 9 deletions

View File

@ -103,15 +103,32 @@ func (c *Content) appendConsumedResultsForSkippedTests(results result.List,
for _, q := range testlist {
tree.Add(q, struct{}{})
}
// For each variant...
for _, variant := range variants {
resultsForVariant := container.NewSet[string]()
for _, result := range results.FilterByVariant(variant) {
resultsForVariant.Add(result.Query.String())
}
// For each expectation...
for _, c := range c.Chunks {
for _, ex := range c.Expectations {
if container.NewSet(ex.Status...).Contains(string(result.Skip)) {
for _, variant := range variants {
// Does this expectation apply for variant?
if !variant.ContainsAll(ex.Tags) {
continue
continue // Nope.
}
// Does the expectation contain a Skip status?
if !container.NewSet(ex.Status...).Contains(string(result.Skip)) {
continue // Nope.
}
// Gather all the tests that apply to the expectation
glob, _ := tree.Glob(query.Parse(ex.Query))
for _, qd := range glob {
// If we don't have a result for the test, then append a
// synthetic 'consumed' result.
if !resultsForVariant.Contains(qd.Query.String()) {
results = append(results, result.Result{
Query: qd.Query,
Tags: variant,