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>
diff --git a/tools/src/cmd/cts/format/format.go b/tools/src/cmd/cts/format/format.go
index 823e1be..bb2aa70 100644
--- a/tools/src/cmd/cts/format/format.go
+++ b/tools/src/cmd/cts/format/format.go
@@ -51,5 +51,11 @@
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 42d16d0..aafb800 100644
--- a/tools/src/cts/expectations/parse.go
+++ b/tools/src/cts/expectations/parse.go
@@ -55,7 +55,6 @@
// 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 d85a9bc..081ea11 100644
--- a/tools/src/cts/expectations/update_test.go
+++ b/tools/src/cts/expectations/update_test.go
@@ -169,8 +169,8 @@
{ //////////////////////////////////////////////////////////////////////
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 @@
{
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 @@
{ //////////////////////////////////////////////////////////////////////
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 @@
},
},
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 ]