The new code generation test harness introduced in CL 97355 does not work when working on tip with a codegen transformation only present on tip. For example, I recently taught the 386 backend to intrisify math.Sqrt and when I add the following test
func sqrt(x float64) float64 {
// 386:"SQRTSD"
return math.Sqrt(x)
}
to the tip repository and run it, it'll fail because the asmcheck driver in test/run.go uses this line to compile the codegen test files:
cmdline := []string{"go", "build", "-gcflags", "-S"}
and on my system go points to the stable installation in /usr/local/go, which is a 1.10 toolchain, where math.Sqrt is not intrisified on 386.
In the old test harness we use internal/testenv to ensure we're using the right go toolchain:
testenv.MustHaveGoRun(t)
gotool := testenv.GoToolPath(t)
cmd := exec.Command(gotool, "run", [etc...])
but I believe we can't do this inside a test in the go/test.
The new code generation test harness introduced in CL 97355 does not work when working on
tipwith a codegen transformation only present on tip. For example, I recently taught the 386 backend to intrisifymath.Sqrtand when I add the following testto the tip repository and run it, it'll fail because the
asmcheckdriver intest/run.gouses this line to compile the codegen test files:and on my system
gopoints to the stable installation in/usr/local/go, which is a 1.10 toolchain, wheremath.Sqrtis not intrisified on 386.In the old test harness we use
internal/testenvto ensure we're using the right go toolchain:but I believe we can't do this inside a test in the
go/test.