Validate that [ Slow ] is not used in expectations.txt

Bug: dawn:1832
Change-Id: Ic4b5f752aab7e4c26808703ffeb89545200204e6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134102
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
Austin Eng 2023-05-24 21:58:50 +00:00 committed by Dawn LUCI CQ
parent 817c076eb8
commit 1fbf40857c
2 changed files with 22 additions and 0 deletions

View File

@ -51,6 +51,15 @@ func (c Content) Validate() Diagnostics {
var out Diagnostics
for _, chunk := range c.Chunks {
for _, ex := range chunk.Expectations {
for _, status := range ex.Status {
if status == "Slow" {
out = append(out, Diagnostic{
Severity: Error,
Line: ex.Line,
Message: fmt.Sprintf("\"Slow\" expectation is not valid here. Use slow_tests.txt instead."),
})
}
}
glob, err := tree.Glob(query.Parse(ex.Query))
if err != nil {
out = append(out, Diagnostic{

View File

@ -116,6 +116,19 @@ crbug.com/a/123 [ os-a ] a:b,c:d,* [ Failure ]
},
},
},
{ //////////////////////////////////////////////////////////////////////
name: "slow invalid",
expectations: `
crbug.com/a/123 a:b,c:d,* [ Slow ]
`,
diagnostics: expectations.Diagnostics{
{
Line: 8,
Severity: expectations.Error,
Message: "\"Slow\" expectation is not valid here. Use slow_tests.txt instead.",
},
},
},
} {
ex, err := expectations.Parse("expectations.txt", header+test.expectations)
if err != nil {