]> Cypherpunks.ru repositories - gostls13.git/commitdiff
reflect: adjust MapRange allocation test for noopt builder, take 2
authorKeith Randall <khr@golang.org>
Tue, 19 Apr 2022 17:33:46 +0000 (10:33 -0700)
committerKeith Randall <khr@golang.org>
Tue, 19 Apr 2022 17:53:51 +0000 (17:53 +0000)
Change-Id: If2887f84b3d14fac3c059fc5bad4186ec9d69d0f
Reviewed-on: https://go-review.googlesource.com/c/go/+/401077
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/reflect/all_test.go

index f18df4e6c508d55fc77da72579e5faa25c4d72c4..a886f9f64abbc8b2574825fd07e36241a47b30c3 100644 (file)
@@ -364,6 +364,10 @@ func TestMapIterSet(t *testing.T) {
                }
        }
 
+       if strings.HasSuffix(testenv.Builder(), "-noopt") {
+               return // no inlining with the noopt builder
+       }
+
        got := int(testing.AllocsPerRun(10, func() {
                iter := v.MapRange()
                for iter.Next() {
@@ -375,9 +379,6 @@ func TestMapIterSet(t *testing.T) {
        // The function is inlineable, so if the local usage does not escape
        // the *MapIter, it can remain stack allocated.
        want := 0
-       if strings.HasSuffix(testenv.Builder(), "-noopt") {
-               want = 1 // no inlining with the noopt builder
-       }
        if got != want {
                t.Errorf("wanted %d alloc, got %d", want, got)
        }