Commit 1c55f579 authored by Russ Cox's avatar Russ Cox

cmd/go: apply same per-package flags to test and xtest builds

If package strings has a particular set of gcflags, then the strings_test
pseudo-package built as part of the test binary should inherit the same flags.

Fixes #22831.

Change-Id: I0e896b6c0f1063454300b7323f577feffbd6650b
Reviewed-on: https://go-review.googlesource.com/81496
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 4fb0af5d
......@@ -5191,6 +5191,12 @@ func TestGcflagsPatterns(t *testing.T) {
tg.grepStderr("reflect", "did not rebuild reflect")
tg.grepStderr("compile.* -N .*-p reflect", "did not build reflect with -N flag")
tg.grepStderrNot("compile.* -N .*-p fmt", "incorrectly built fmt with -N flag")
tg.run("test", "-c", "-n", "-gcflags=-N", "strings")
tg.grepStderr("compile.* -N .*compare_test.go", "did not build strings_test package with -N flag")
tg.run("test", "-c", "-n", "-gcflags=strings=-N", "strings")
tg.grepStderr("compile.* -N .*compare_test.go", "did not build strings_test package with -N flag")
}
func TestGoTestMinusN(t *testing.T) {
......
......@@ -892,6 +892,11 @@ func builderTest(b *work.Builder, p *load.Package) (buildAction, runAction, prin
},
Imports: ximports,
RawImports: rawXTestImports,
Asmflags: p.Internal.Asmflags,
Gcflags: p.Internal.Gcflags,
Ldflags: p.Internal.Ldflags,
Gccgoflags: p.Internal.Gccgoflags,
},
}
if pxtestNeedsPtest {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment