diff --git a/tools/src/cmd/cts/format/format.go b/tools/src/cmd/cts/format/format.go index 823e1bea1c..bb2aa702de 100644 --- a/tools/src/cmd/cts/format/format.go +++ b/tools/src/cmd/cts/format/format.go @@ -51,5 +51,11 @@ func (c *cmd) Run(ctx context.Context, cfg common.Config) error { if err != nil { return err } + + // Sort the expectations in each chunk. + for _, chunk := range ex.Chunks { + chunk.Expectations.Sort() + } + return ex.Save(c.flags.expectations) } diff --git a/tools/src/cts/expectations/parse.go b/tools/src/cts/expectations/parse.go index 42d16d026a..aafb800a4f 100644 --- a/tools/src/cts/expectations/parse.go +++ b/tools/src/cts/expectations/parse.go @@ -55,7 +55,6 @@ func Parse(body string) (Content, error) { // flush completes the current chunk, appending it to 'content' flush := func() { parseTags(&content.Tags, pending.Comments) - pending.Expectations.Sort() content.Chunks = append(content.Chunks, pending) pending = Chunk{} } diff --git a/tools/src/cts/expectations/update_test.go b/tools/src/cts/expectations/update_test.go index d85a9bc338..081ea11f97 100644 --- a/tools/src/cts/expectations/update_test.go +++ b/tools/src/cts/expectations/update_test.go @@ -169,8 +169,8 @@ a:b,c:* [ Failure ] { ////////////////////////////////////////////////////////////////////// name: "simple expectation with tags", expectations: ` -[ gpu-b ] a:b,c:* [ Failure ] [ os-a ] a:b,c:* [ Failure ] +[ gpu-b ] a:b,c:* [ Failure ] `, results: result.List{ result.Result{ @@ -186,7 +186,7 @@ a:b,c:* [ Failure ] { Severity: expectations.Error, Line: headerLines + 3, - Message: "[os-a] a:b,c:* collides with expectation at line 8", + Message: "[gpu-b] a:b,c:* collides with expectation at line 8", }, }, }, @@ -219,8 +219,8 @@ a:b,c:* [ Failure ] { ////////////////////////////////////////////////////////////////////// name: "collision with child-expectation", expectations: ` -crbug.com/a/1 a:b:x:* [ Failure ] -crbug.com/a/2 a:b:* [ Failure ] +a:b:x:* [ Failure ] +a:b:* [ Failure ] `, results: result.List{ result.Result{ @@ -235,7 +235,7 @@ crbug.com/a/2 a:b:* [ Failure ] }, }, updated: ` -crbug.com/a/1 a:b:x:* [ Failure ] +a:b:x:* [ Failure ] # New failures. Please triage: crbug.com/dawn/0000 a:b:y:* [ Failure ]