CTS expectations: support multiple test prefixes

For some reason Android uses a different test prefix

Bug: chromium:1363409
Change-Id: I6f43b2f35e440f26842779fff58e2e9e3d36bd87
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/134346
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2023-05-25 16:04:51 +00:00 committed by Dawn LUCI CQ
parent 32b6746cd9
commit 6c5f683802
3 changed files with 57 additions and 48 deletions

View File

@ -32,7 +32,7 @@ type Config struct {
// Test holds configuration data for test results. // Test holds configuration data for test results.
Test struct { Test struct {
// The ResultDB string prefix for CTS tests. // The ResultDB string prefix for CTS tests.
Prefix string Prefixes []string
// The time threshold used to classify tests as slow. // The time threshold used to classify tests as slow.
SlowThreshold time.Duration SlowThreshold time.Duration
} }

View File

@ -204,55 +204,61 @@ func GetResults(
} }
results := result.List{} results := result.List{}
err := rdb.QueryTestResults(ctx, builds.ids(), cfg.Test.Prefix+".*", func(rpb *rdbpb.TestResult) error { var err error = nil
if time.Since(lastPrintedDot) > 5*time.Second { for _, prefix := range cfg.Test.Prefixes {
lastPrintedDot = time.Now() err = rdb.QueryTestResults(ctx, builds.ids(), prefix+".*", func(rpb *rdbpb.TestResult) error {
fmt.Printf(".") if time.Since(lastPrintedDot) > 5*time.Second {
} lastPrintedDot = time.Now()
fmt.Printf(".")
}
if !strings.HasPrefix(rpb.GetTestId(), prefix) {
return nil
}
testName := rpb.GetTestId()[len(prefix):]
status := toStatus(rpb.Status)
tags := result.NewTags()
duration := rpb.GetDuration().AsDuration()
mayExonerate := false
for _, sp := range rpb.Tags {
if sp.Key == "typ_tag" {
tags.Add(sp.Value)
}
if sp.Key == "javascript_duration" {
var err error
if duration, err = time.ParseDuration(sp.Value); err != nil {
return err
}
}
if sp.Key == "may_exonerate" {
var err error
if mayExonerate, err = strconv.ParseBool(sp.Value); err != nil {
return err
}
}
}
if status == result.Pass && duration > cfg.Test.SlowThreshold {
status = result.Slow
}
results = append(results, result.Result{
Query: query.Parse(testName),
Status: status,
Tags: tags,
Duration: duration,
MayExonerate: mayExonerate,
})
if !strings.HasPrefix(rpb.GetTestId(), cfg.Test.Prefix) {
return nil return nil
}
testName := rpb.GetTestId()[len(cfg.Test.Prefix):]
status := toStatus(rpb.Status)
tags := result.NewTags()
duration := rpb.GetDuration().AsDuration()
mayExonerate := false
for _, sp := range rpb.Tags {
if sp.Key == "typ_tag" {
tags.Add(sp.Value)
}
if sp.Key == "javascript_duration" {
var err error
if duration, err = time.ParseDuration(sp.Value); err != nil {
return err
}
}
if sp.Key == "may_exonerate" {
var err error
if mayExonerate, err = strconv.ParseBool(sp.Value); err != nil {
return err
}
}
}
if status == result.Pass && duration > cfg.Test.SlowThreshold {
status = result.Slow
}
results = append(results, result.Result{
Query: query.Parse(testName),
Status: status,
Tags: tags,
Duration: duration,
MayExonerate: mayExonerate,
}) })
if err != nil {
return nil break
}) }
}
fmt.Println(" done") fmt.Println(" done")

View File

@ -1,6 +1,9 @@
{ {
"Test": { "Test": {
"Prefix": "ninja://chrome/test:telemetry_gpu_integration_test/gpu_tests.webgpu_cts_integration_test.WebGpuCtsIntegrationTest.", "Prefixes": [
"ninja://chrome/test:telemetry_gpu_integration_test/gpu_tests.webgpu_cts_integration_test.WebGpuCtsIntegrationTest.",
"ninja://chrome/test:telemetry_gpu_integration_test_android_chrome/gpu_tests.webgpu_cts_integration_test.WebGpuCtsIntegrationTest."
],
"SlowThreshold": 45000000000 // 45 seconds "SlowThreshold": 45000000000 // 45 seconds
}, },
"Gerrit": { "Gerrit": {