Moves sorting into `format` and out of `parse`.

- Reverts test updates in
  https://dawn-review.googlesource.com/c/dawn/+/98761 that were
  introduced because of the sorting in `parse`.

Change-Id: Ia27386e9aa2f16b9a4ba26e77207e5a4d6f4df97
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/99020
Auto-Submit: Loko Kung <lokokung@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Loko Kung 2022-08-12 22:05:13 +00:00 committed by Dawn LUCI CQ
parent a3553af2c4
commit 4681f5bddd
3 changed files with 11 additions and 6 deletions

View File

@ -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)
}

View File

@ -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{}
}

View File

@ -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 ]