mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 21:57:32 +00:00
all: add (*testing.B).ReportAllocs() to every benchmark
This ensures that we can properly track and catch allocation slippages that could otherwise have been missed. Fixes #2748
This commit is contained in:

committed by
Brad Fitzpatrick

parent
44d71d1e42
commit
0daa32943e
@@ -1015,6 +1015,7 @@ func BenchmarkFull(b *testing.B) {
|
||||
|
||||
for _, tt := range tests {
|
||||
b.Run(tt.name, func(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
syncRespond(r, tt.request)
|
||||
}
|
||||
|
@@ -75,6 +75,7 @@ func TestNewContainsIPFunc(t *testing.T) {
|
||||
var sinkIP netaddr.IP
|
||||
|
||||
func BenchmarkTailscaleServiceAddr(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
sinkIP = TailscaleServiceIP()
|
||||
}
|
||||
|
@@ -397,6 +397,7 @@ func TestClose(t *testing.T) {
|
||||
}
|
||||
|
||||
func BenchmarkWrite(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
ftun, tun := newFakeTUN(b.Logf, true)
|
||||
defer tun.Close()
|
||||
|
||||
|
Reference in New Issue
Block a user