mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: use slices and maps to clean up tests
Replace reflect.DeepEqual with slices.Equal/maps.Equal, which is
much faster.
Also remove some unecessary helper functions.
Change-Id: I3e4fa2938fed1598278c9e556cd4fa3b9ed3ad6d
GitHub-Last-Rev: 69bb43fc6e
GitHub-Pull-Request: golang/go#67603
Reviewed-on: https://go-review.googlesource.com/c/go/+/587815
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
2247afc0ae
commit
0b0dfcd540
9 changed files with 29 additions and 34 deletions
|
|
@ -201,10 +201,10 @@ func TestReadMetrics(t *testing.T) {
|
|||
checkUint64(t, "/gc/heap/frees:objects", frees, mstats.Frees-tinyAllocs)
|
||||
|
||||
// Verify that /gc/pauses:seconds is a copy of /sched/pauses/total/gc:seconds
|
||||
if !reflect.DeepEqual(gcPauses.Buckets, schedPausesTotalGC.Buckets) {
|
||||
if !slices.Equal(gcPauses.Buckets, schedPausesTotalGC.Buckets) {
|
||||
t.Errorf("/gc/pauses:seconds buckets %v do not match /sched/pauses/total/gc:seconds buckets %v", gcPauses.Buckets, schedPausesTotalGC.Counts)
|
||||
}
|
||||
if !reflect.DeepEqual(gcPauses.Counts, schedPausesTotalGC.Counts) {
|
||||
if !slices.Equal(gcPauses.Counts, schedPausesTotalGC.Counts) {
|
||||
t.Errorf("/gc/pauses:seconds counts %v do not match /sched/pauses/total/gc:seconds counts %v", gcPauses.Counts, schedPausesTotalGC.Counts)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue