aboutsummaryrefslogtreecommitdiff
path: root/src/reflect/all_test.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2022-04-19 10:33:46 -0700
committerKeith Randall <khr@golang.org>2022-04-19 17:53:51 +0000
commitaa8262d800f0cba2e4d4472a7e344eb60481b0ff (patch)
tree5ffad544469f8208a6b39126106442aa4ebe275f /src/reflect/all_test.go
parent689dc17793991746eb27ba4520d45af19a661f98 (diff)
downloadgo-aa8262d800f0cba2e4d4472a7e344eb60481b0ff.tar.gz
go-aa8262d800f0cba2e4d4472a7e344eb60481b0ff.zip
reflect: adjust MapRange allocation test for noopt builder, take 2
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>
Diffstat (limited to 'src/reflect/all_test.go')
-rw-r--r--src/reflect/all_test.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go
index f18df4e6c5..a886f9f64a 100644
--- a/src/reflect/all_test.go
+++ b/src/reflect/all_test.go
@@ -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)
}