]> Cypherpunks repositories - gostls13.git/commitdiff
net/netip: skip some TestAddrStringAllocs tests on noopt builders
authorTobias Klauser <tklauser@distanz.ch>
Thu, 12 May 2022 07:30:54 +0000 (09:30 +0200)
committerGopher Robot <gobot@golang.org>
Thu, 12 May 2022 13:42:39 +0000 (13:42 +0000)
CL 403914 introduced TestAddrStringAllocs which checks that there is
only 1 alloc in Addr.String for v4-in-v6 addresses. This requires
optimizations to be enabled, otherwise there are 2 allocs. Skip the
ipv4-in-ipv6 sub-tests on noopt builders to fix failing
TestAddrStringAllocs on the noopt builders.

Change-Id: I0285264260b264b53cf822dc7cec4829e9854531
Reviewed-on: https://go-review.googlesource.com/c/go/+/405834
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/net/netip/netip_test.go

index 9fe7cae6ec6624beb6d01aac8cfdd6ffee6b3264..74dcc974f8a69912925774f19ba961754a10efb4 100644 (file)
@@ -10,6 +10,7 @@ import (
        "flag"
        "fmt"
        "internal/intern"
+       "internal/testenv"
        "net"
        . "net/netip"
        "reflect"
@@ -1907,8 +1908,13 @@ func TestAddrStringAllocs(t *testing.T) {
                {"ipv4-in-ipv6", MustParseAddr("::ffff:192.168.1.1"), 1},
                {"ipv4-in-ipv6+zone", MustParseAddr("::ffff:192.168.1.1%eth0"), 1},
        }
+       isNooptBuilder := strings.HasSuffix(testenv.Builder(), "-noopt")
        for _, tc := range tests {
                t.Run(tc.name, func(t *testing.T) {
+                       if isNooptBuilder && strings.HasPrefix(tc.name, "ipv4-in-ipv6") {
+                               // Optimizations are required to remove some allocs.
+                               t.Skipf("skipping on %v", testenv.Builder())
+                       }
                        allocs := int(testing.AllocsPerRun(1000, func() {
                                sinkString = tc.ip.String()
                        }))