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.
t.Skipf("skipping on %v", runtime.GOOS)
}
builder := os.Getenv("GO_BUILDER_NAME")
switch builder {
case "linux-amd64-noopt":
// Optimizations are required to remove the allocs.
t.Skipf("skipping on %v", builder)
}
// Optimizations are required to remove the allocs.
testenv.SkipIfOptimizationOff(t)
conn, err := ListenUDP("udp4", &UDPAddr{IP: IPv4(127, 0, 0, 1)})
if err != nil {
t.Fatal(err)