From 6c5f6838026b06d6786442f0b174d2ab60d764ba Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Thu, 25 May 2023 16:04:51 +0000 Subject: [PATCH] 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 Kokoro: Austin Eng Commit-Queue: Austin Eng --- tools/src/cmd/cts/common/config.go | 2 +- tools/src/cmd/cts/common/results.go | 98 +++++++++++++++-------------- tools/src/cmd/cts/config.json | 5 +- 3 files changed, 57 insertions(+), 48 deletions(-) diff --git a/tools/src/cmd/cts/common/config.go b/tools/src/cmd/cts/common/config.go index 84393c5a16..1811c82af0 100644 --- a/tools/src/cmd/cts/common/config.go +++ b/tools/src/cmd/cts/common/config.go @@ -32,7 +32,7 @@ type Config struct { // Test holds configuration data for test results. Test struct { // The ResultDB string prefix for CTS tests. - Prefix string + Prefixes []string // The time threshold used to classify tests as slow. SlowThreshold time.Duration } diff --git a/tools/src/cmd/cts/common/results.go b/tools/src/cmd/cts/common/results.go index 00d829a241..3e4ed4dc59 100644 --- a/tools/src/cmd/cts/common/results.go +++ b/tools/src/cmd/cts/common/results.go @@ -204,55 +204,61 @@ func GetResults( } results := result.List{} - err := rdb.QueryTestResults(ctx, builds.ids(), cfg.Test.Prefix+".*", func(rpb *rdbpb.TestResult) error { - if time.Since(lastPrintedDot) > 5*time.Second { - lastPrintedDot = time.Now() - fmt.Printf(".") - } + var err error = nil + for _, prefix := range cfg.Test.Prefixes { + err = rdb.QueryTestResults(ctx, builds.ids(), prefix+".*", func(rpb *rdbpb.TestResult) error { + 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 - } - - 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, }) - - return nil - }) + if err != nil { + break + } + } fmt.Println(" done") diff --git a/tools/src/cmd/cts/config.json b/tools/src/cmd/cts/config.json index 5955b0ec7c..bb299a2099 100644 --- a/tools/src/cmd/cts/config.json +++ b/tools/src/cmd/cts/config.json @@ -1,6 +1,9 @@ { "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 }, "Gerrit": {