Report test-based aggregation of CTS times
Adds an "-aggregate" flags to ./tools/run/cts time to report results aggregated by test Change-Id: Id8d15188846b3bff79ac4c65a09e5d6740acde73 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/93300 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
5b72deca22
commit
6cc677761d
|
@ -23,6 +23,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"dawn.googlesource.com/dawn/tools/src/cmd/cts/common"
|
"dawn.googlesource.com/dawn/tools/src/cmd/cts/common"
|
||||||
|
"dawn.googlesource.com/dawn/tools/src/cts/query"
|
||||||
"dawn.googlesource.com/dawn/tools/src/cts/result"
|
"dawn.googlesource.com/dawn/tools/src/cts/result"
|
||||||
"dawn.googlesource.com/dawn/tools/src/subcmd"
|
"dawn.googlesource.com/dawn/tools/src/subcmd"
|
||||||
"go.chromium.org/luci/auth/client/authcli"
|
"go.chromium.org/luci/auth/client/authcli"
|
||||||
|
@ -37,6 +38,7 @@ type cmd struct {
|
||||||
source common.ResultSource
|
source common.ResultSource
|
||||||
auth authcli.Flags
|
auth authcli.Flags
|
||||||
tags string
|
tags string
|
||||||
|
aggregate bool
|
||||||
topN int
|
topN int
|
||||||
histogram bool
|
histogram bool
|
||||||
}
|
}
|
||||||
|
@ -56,6 +58,7 @@ func (c *cmd) RegisterFlags(ctx context.Context, cfg common.Config) ([]string, e
|
||||||
flag.IntVar(&c.flags.topN, "top", 0, "print the top N slowest tests")
|
flag.IntVar(&c.flags.topN, "top", 0, "print the top N slowest tests")
|
||||||
flag.BoolVar(&c.flags.histogram, "histogram", false, "print a histogram of test timings")
|
flag.BoolVar(&c.flags.histogram, "histogram", false, "print a histogram of test timings")
|
||||||
flag.StringVar(&c.flags.tags, "tags", "", "comma-separated list of tags to filter results")
|
flag.StringVar(&c.flags.tags, "tags", "", "comma-separated list of tags to filter results")
|
||||||
|
flag.BoolVar(&c.flags.aggregate, "aggregate", false, "aggregate times by test")
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,6 +87,44 @@ func (c *cmd) Run(ctx context.Context, cfg common.Config) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if c.flags.aggregate {
|
||||||
|
type Key struct {
|
||||||
|
Query query.Query
|
||||||
|
Status result.Status
|
||||||
|
Tags string
|
||||||
|
}
|
||||||
|
merged := map[Key]result.Result{}
|
||||||
|
for _, r := range results {
|
||||||
|
k := Key{
|
||||||
|
Query: query.Query{
|
||||||
|
Suite: r.Query.Suite,
|
||||||
|
Files: r.Query.Files,
|
||||||
|
Tests: r.Query.Tests,
|
||||||
|
Cases: "*",
|
||||||
|
},
|
||||||
|
Status: r.Status,
|
||||||
|
Tags: result.TagsToString(r.Tags),
|
||||||
|
}
|
||||||
|
entry, exists := merged[k]
|
||||||
|
if exists {
|
||||||
|
entry.Duration += r.Duration
|
||||||
|
} else {
|
||||||
|
entry = result.Result{
|
||||||
|
Query: k.Query,
|
||||||
|
Duration: r.Duration,
|
||||||
|
Status: r.Status,
|
||||||
|
Tags: r.Tags,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
merged[k] = entry
|
||||||
|
}
|
||||||
|
|
||||||
|
results = result.List{}
|
||||||
|
for _, r := range merged {
|
||||||
|
results = append(results, r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Sort the results with longest duration first
|
// Sort the results with longest duration first
|
||||||
sort.Slice(results, func(i, j int) bool {
|
sort.Slice(results, func(i, j int) bool {
|
||||||
return results[i].Duration > results[j].Duration
|
return results[i].Duration > results[j].Duration
|
||||||
|
|
Loading…
Reference in New Issue