internal/testenv: add and use OptimizationOff/SkipIfOptimizationOff

So we don't have to duplicate the logic to detect noopt builder in
multiple places.

Based on khr@'s suggestion in CL 422037.

Change-Id: Idb338e8bc08cdf00460574bfc0d2f7018c79bbd5
Reviewed-on: https://go-review.googlesource.com/c/go/+/422038
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
Cuong Manh Le 2022-08-09 00:55:13 +07:00
parent 98277f30e4
commit a292b3905c
9 changed files with 28 additions and 25 deletions

View file

@ -364,7 +364,7 @@ func TestMapIterSet(t *testing.T) {
}
}
if strings.HasSuffix(testenv.Builder(), "-noopt") {
if testenv.OptimizationOff() {
return // no inlining with the noopt builder
}