mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
Add negative number parsing into @test_value
This CL updates the intrinsics lexer to allow negative values for int and float numerics. This allows doing `@test_value(-2)` in the def file. Change-Id: I2cad9b25a2932057ce9bc51dec6c32231e06f0a0 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/107440 Commit-Queue: Dan Sinclair <dsinclair@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Auto-Submit: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
91ed6f7289
commit
c3cbc35650
@@ -39,8 +39,8 @@ type Content struct {
|
||||
// A chunk ends at the first blank line, or at the transition from an
|
||||
// expectation to a line-comment.
|
||||
type Chunk struct {
|
||||
Comments []string // Line comments at the top of the chunk
|
||||
Expectations Expectations // Expectations for the chunk
|
||||
Comments []string // Line comments at the top of the chunk
|
||||
Expectations Expectations // Expectations for the chunk
|
||||
}
|
||||
|
||||
// Tags holds the tag information parsed in the comments between the
|
||||
@@ -234,9 +234,11 @@ func (e Expectation) Clone() Expectation {
|
||||
}
|
||||
|
||||
// Compare compares the relative order of a and b, returning:
|
||||
// -1 if a should come before b
|
||||
// 1 if a should come after b
|
||||
// 0 if a and b are identical
|
||||
//
|
||||
// -1 if a should come before b
|
||||
// 1 if a should come after b
|
||||
// 0 if a and b are identical
|
||||
//
|
||||
// Note: Only comparing bug, query, and tags (in that order).
|
||||
func (a Expectation) Compare(b Expectation) int {
|
||||
switch strings.Compare(a.Bug, b.Bug) {
|
||||
|
||||
@@ -29,12 +29,12 @@ import (
|
||||
// results.
|
||||
//
|
||||
// Update will:
|
||||
// • Remove any expectation lines that have a query where no results match.
|
||||
// • Remove expectations lines that are in a chunk which is not annotated with
|
||||
// 'KEEP', and all test results have the status 'Pass'.
|
||||
// • Remove chunks that have had all expectation lines removed.
|
||||
// • Appends new chunks for flaky and failing tests which are not covered by
|
||||
// existing expectation lines.
|
||||
// - Remove any expectation lines that have a query where no results match.
|
||||
// - Remove expectations lines that are in a chunk which is not annotated with
|
||||
// 'KEEP', and all test results have the status 'Pass'.
|
||||
// - Remove chunks that have had all expectation lines removed.
|
||||
// - Appends new chunks for flaky and failing tests which are not covered by
|
||||
// existing expectation lines.
|
||||
//
|
||||
// Update returns a list of diagnostics for things that should be addressed.
|
||||
//
|
||||
@@ -93,8 +93,8 @@ type updater struct {
|
||||
}
|
||||
|
||||
// Returns 'results' with additional 'consumed' results for tests that have
|
||||
// 'Skip' expectations. This fills in gaps for results, preventing tree
|
||||
// reductions from marking skipped results as failure, which could result in
|
||||
// 'Skip' expectations. This fills in gaps for results, preventing tree
|
||||
// reductions from marking skipped results as failure, which could result in
|
||||
// expectation collisions.
|
||||
func (c *Content) appendConsumedResultsForSkippedTests(results result.List,
|
||||
testlist []query.Query,
|
||||
@@ -539,10 +539,10 @@ func (u *updater) resultsToExpectations(results result.List, bug, comment string
|
||||
}
|
||||
|
||||
// cleanupTags returns a copy of the provided results with:
|
||||
// • All tags not found in the expectations list removed
|
||||
// • All but the highest priority tag for any tag-set.
|
||||
// The tag sets are defined by the `BEGIN TAG HEADER` / `END TAG HEADER`
|
||||
// section at the top of the expectations file.
|
||||
// - All tags not found in the expectations list removed
|
||||
// - All but the highest priority tag for any tag-set.
|
||||
// The tag sets are defined by the `BEGIN TAG HEADER` / `END TAG HEADER`
|
||||
// section at the top of the expectations file.
|
||||
func (u *updater) cleanupTags(results result.List) result.List {
|
||||
return results.TransformTags(func(t result.Tags) result.Tags {
|
||||
type HighestPrioritySetTag struct {
|
||||
@@ -570,11 +570,11 @@ func (u *updater) cleanupTags(results result.List) result.List {
|
||||
// treeReducer is a function that can be used by StatusTree.Reduce() to reduce
|
||||
// tree nodes with the same status.
|
||||
// treeReducer will collapse trees nodes if any of the following are true:
|
||||
// • All child nodes have the same status
|
||||
// • More than 75% of the child nodes have a non-pass status, and none of the
|
||||
// children are consumed.
|
||||
// • There are more than 20 child nodes with a non-pass status, and none of the
|
||||
// children are consumed.
|
||||
// - All child nodes have the same status
|
||||
// - More than 75% of the child nodes have a non-pass status, and none of the
|
||||
// children are consumed.
|
||||
// - There are more than 20 child nodes with a non-pass status, and none of the
|
||||
// children are consumed.
|
||||
func treeReducer(statuses []result.Status) *result.Status {
|
||||
counts := map[result.Status]int{}
|
||||
for _, s := range statuses {
|
||||
|
||||
@@ -37,15 +37,16 @@ import (
|
||||
|
||||
// Query represents a WebGPU test query
|
||||
// Example queries:
|
||||
// 'suite'
|
||||
// 'suite:*'
|
||||
// 'suite:file'
|
||||
// 'suite:file,*'
|
||||
// 'suite:file,file'
|
||||
// 'suite:file,file,*'
|
||||
// 'suite:file,file,file:test'
|
||||
// 'suite:file,file,file:test:*'
|
||||
// 'suite:file,file,file:test,test:case;*'
|
||||
//
|
||||
// 'suite'
|
||||
// 'suite:*'
|
||||
// 'suite:file'
|
||||
// 'suite:file,*'
|
||||
// 'suite:file,file'
|
||||
// 'suite:file,file,*'
|
||||
// 'suite:file,file,file:test'
|
||||
// 'suite:file,file,file:test:*'
|
||||
// 'suite:file,file,file:test,test:case;*'
|
||||
type Query struct {
|
||||
Suite string
|
||||
Files string
|
||||
@@ -269,9 +270,10 @@ func (q Query) String() string {
|
||||
}
|
||||
|
||||
// Compare compares the relative order of q and o, returning:
|
||||
// -1 if q should come before o
|
||||
// 1 if q should come after o
|
||||
// 0 if q and o are identical
|
||||
//
|
||||
// -1 if q should come before o
|
||||
// 1 if q should come after o
|
||||
// 0 if q and o are identical
|
||||
func (q Query) Compare(o Query) int {
|
||||
for _, cmp := range []struct{ a, b string }{
|
||||
{q.Suite, o.Suite},
|
||||
@@ -335,9 +337,10 @@ func (q Query) Contains(o Query) bool {
|
||||
}
|
||||
|
||||
// Callback function for Query.Walk()
|
||||
// q is the query for the current segment.
|
||||
// t is the target of the query q.
|
||||
// n is the name of the new segment.
|
||||
//
|
||||
// q is the query for the current segment.
|
||||
// t is the target of the query q.
|
||||
// n is the name of the new segment.
|
||||
type WalkCallback func(q Query, t Target, n string) error
|
||||
|
||||
// Walk calls 'f' for each suite, file, test segment, and calls f once for all
|
||||
|
||||
@@ -414,12 +414,12 @@ func (t *Tree[Data]) List() []QueryData[Data] {
|
||||
// Glob returns a list of QueryData's for every node that is under the given
|
||||
// query, which holds data.
|
||||
// Glob handles wildcards as well as non-wildcard queries:
|
||||
// * A non-wildcard query will match the node itself, along with every node
|
||||
// under the query. For example: 'a:b' will match every File and Test
|
||||
// node under 'a:b', including 'a:b' itself.
|
||||
// * A wildcard Query will include every node under the parent node with the
|
||||
// matching Query target. For example: 'a:b:*' will match every Test
|
||||
// node (excluding File nodes) under 'a:b', 'a:b' will not be included.
|
||||
// - A non-wildcard query will match the node itself, along with every node
|
||||
// under the query. For example: 'a:b' will match every File and Test
|
||||
// node under 'a:b', including 'a:b' itself.
|
||||
// - A wildcard Query will include every node under the parent node with the
|
||||
// matching Query target. For example: 'a:b:*' will match every Test
|
||||
// node (excluding File nodes) under 'a:b', 'a:b' will not be included.
|
||||
func (t *Tree[Data]) Glob(q Query) ([]QueryData[Data], error) {
|
||||
out := []QueryData[Data]{}
|
||||
err := t.glob(q, func(n *TreeNode[Data]) error {
|
||||
|
||||
@@ -43,7 +43,9 @@ type Result struct {
|
||||
|
||||
// Format writes the Result to the fmt.State
|
||||
// The Result is printed as a single line, in the form:
|
||||
// <query> <tags> <status>
|
||||
//
|
||||
// <query> <tags> <status>
|
||||
//
|
||||
// This matches the order in which results are sorted.
|
||||
func (r Result) Format(f fmt.State, verb rune) {
|
||||
if len(r.Tags) > 0 {
|
||||
@@ -61,9 +63,11 @@ func (r Result) String() string {
|
||||
}
|
||||
|
||||
// Compare compares the relative order of r and o, returning:
|
||||
// -1 if r should come before o
|
||||
// 1 if r should come after o
|
||||
// 0 if r and o are identical
|
||||
//
|
||||
// -1 if r should come before o
|
||||
// 1 if r should come after o
|
||||
// 0 if r and o are identical
|
||||
//
|
||||
// Note: Result.Duration is not considered in comparison.
|
||||
func (r Result) Compare(o Result) int {
|
||||
a, b := r, o
|
||||
@@ -89,7 +93,9 @@ func (r Result) Compare(o Result) int {
|
||||
}
|
||||
|
||||
// Parse parses the result from a string of the form:
|
||||
// <query> <tags> <status>
|
||||
//
|
||||
// <query> <tags> <status>
|
||||
//
|
||||
// <tags> may be omitted if there were no tags.
|
||||
func Parse(in string) (Result, error) {
|
||||
line := in
|
||||
@@ -302,7 +308,7 @@ func (l List) FilterByVariant(tags Tags) List {
|
||||
})
|
||||
}
|
||||
|
||||
/// FilterByQuery returns the results that match the given query
|
||||
// / FilterByQuery returns the results that match the given query
|
||||
func (l List) FilterByQuery(q query.Query) List {
|
||||
return l.Filter(func(r Result) bool {
|
||||
return q.Contains(r.Query)
|
||||
|
||||
Reference in New Issue
Block a user