1
0
mirror of https://github.com/golang/go synced 2024-11-17 16:04:47 -07:00

net: use testenv.SkipIfOptimizationOff in TestAllocs

Use the helper added by CL 422038 instead of manually detecting the
noopt builder.

Change-Id: I353f1a9d5f0184d73869520eb1ae8d0bdbbe2006
Reviewed-on: https://go-review.googlesource.com/c/go/+/423855
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
Tobias Klauser 2022-08-15 11:13:06 +02:00 committed by Damien Neil
parent 1d66144bfd
commit 8ec1aa889f

View File

@ -464,12 +464,9 @@ func TestAllocs(t *testing.T) {
// Plan9 wasn't optimized. // Plan9 wasn't optimized.
t.Skipf("skipping on %v", runtime.GOOS) t.Skipf("skipping on %v", runtime.GOOS)
} }
builder := os.Getenv("GO_BUILDER_NAME") // Optimizations are required to remove the allocs.
switch builder { testenv.SkipIfOptimizationOff(t)
case "linux-amd64-noopt":
// Optimizations are required to remove the allocs.
t.Skipf("skipping on %v", builder)
}
conn, err := ListenUDP("udp4", &UDPAddr{IP: IPv4(127, 0, 0, 1)}) conn, err := ListenUDP("udp4", &UDPAddr{IP: IPv4(127, 0, 0, 1)})
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)