tools/cts/roll: Preserve RetryOnFailure expectations

It's intended for the Unexpected Pass Finder to clean these up.

This should help prevent known flakes from causing retries.

Bug: chromium:1426512
Change-Id: I58c7baf2585dc4ca2e061e4a53c7b7d0f41e0af9
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127420
Auto-Submit: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Ben Clayton 2023-04-14 18:26:36 +00:00 committed by Dawn LUCI CQ
parent b7291554c7
commit 4489109c86
1 changed files with 33 additions and 0 deletions

View File

@ -73,6 +73,10 @@ func (c *Content) Update(results result.List, testlist []query.Query) (Diagnosti
tagSets: tagSets,
}
if err := u.preserveRetryOnFailures(); err != nil {
return nil, err
}
// Update those expectations!
if err := u.build(); err != nil {
return nil, fmt.Errorf("while updating expectations: %w", err)
@ -263,6 +267,35 @@ func (qt *queryTree) markAsConsumed(q query.Query, t result.Tags, line int) {
}
}
// preserveRetryOnFailures changes any results matching expectations with a
// RetryOnFailure expectation to RetryOnFailure.
func (u *updater) preserveRetryOnFailures() error {
// For each expectation...
for _, c := range u.in.Chunks {
for _, ex := range c.Expectations {
// Does the expectation contain a RetryOnFailure status?
if !container.NewSet(ex.Status...).Contains(string(result.RetryOnFailure)) {
continue // Nope.
}
q := query.Parse(ex.Query)
glob, err := u.qt.tree.Glob(q)
if err != nil {
return err
}
for _, indices := range glob {
for _, idx := range indices.Data {
if u.qt.results[idx].Tags.ContainsAll(ex.Tags) {
u.qt.results[idx].Status = result.RetryOnFailure
}
}
}
}
}
return nil
}
// build is the updater top-level function.
// build first appends to u.out all chunks from 'u.in' with expectations updated
// using the new results, and then appends any new expectations to u.out.