Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add is:tentative command #1611

Merged
merged 4 commits into from
Nov 7, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions api/query/atoms.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ const (
// MetadataQualityDifferent represents an is:different atom.
// "different" ensures that one or more results differs from the other results.
MetadataQualityDifferent MetadataQuality = 1
// MetadataQualityTentative represents an is:tentative atom.
// "tentative" ensures that the results are from a tentative test.
MetadataQualityTentative MetadataQuality = 2
Hexcles marked this conversation as resolved.
Show resolved Hide resolved
)

// BindToRuns for MetadataQuality is a no-op; it is independent of test runs.
Expand Down Expand Up @@ -902,6 +905,8 @@ func MetadataQualityFromString(quality string) (MetadataQuality, error) {
switch quality {
case "different":
return MetadataQualityDifferent, nil
case "tentative":
return MetadataQualityTentative, nil
}
return MetadataQualityUnknown, fmt.Errorf(`Unknown "is" quality "%s"`, quality)
}
Expand Down
25 changes: 21 additions & 4 deletions api/query/cache/index/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,28 @@ func (l Link) Filter(t TestID) bool {

// Filter interprets a MetadataQuality as a filter function over TestIDs.
func (q MetadataQuality) Filter(t TestID) bool {
set := mapset.NewSet()
for _, result := range q.runResults {
set.Add(result.GetResult(t))
switch (q.quality) {
case query.MetadataQualityDifferent:
// is:different only returns subtest rows where the result
// differs between the runs we are comparing. To detect this,
// put them into a set and then check the size.
set := mapset.NewSet()
for _, result := range q.runResults {
set.Add(result.GetResult(t))
}
return set.Cardinality() > 1
case query.MetadataQualityTentative:
// is:tentative only returns rows from tests with .tentative.
// in their name. See
// https://web-platform-tests.org/writing-tests/file-names.html
name, subtest, err := q.tests.GetName(t)
Hexcles marked this conversation as resolved.
Show resolved Hide resolved
if (err != nil) {
return false
}
return strings.Contains(name, ".tentative.")
default:
return false
}
return set.Cardinality() > 1
}

// Filter interprets an And as a filter function over TestIDs.
Expand Down
2 changes: 2 additions & 0 deletions api/query/cache/service/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The binary for the searchcache service
service
1 change: 1 addition & 0 deletions webapp/components/test-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ const QUERY_GRAMMAR = ohm.grammar(`

metadataQualityLiteral
= caseInsensitive<"different">
| caseInsensitive<"tentative">

nameFragment
= basicNameFragment -- basic
Expand Down