mirror of
https://github.com/golang/go
synced 2024-11-23 12:30:11 -07:00
cmd/go: convert TestBuildIDContainsArchModeEnv to the script framework
Part of converting all tests to script framework to improve test parallelism. Updates #36320 Updates #17751 Change-Id: I69c69809fb1698c8198ef3ea00103a9acb7b6ce7 Reviewed-on: https://go-review.googlesource.com/c/go/+/214387 Run-TryBot: Michael Matloob <matloob@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
This commit is contained in:
parent
1e43298df8
commit
3791594e36
@ -2642,45 +2642,6 @@ func TestNeedVersion(t *testing.T) {
|
|||||||
tg.grepStderr("compile", "does not match go tool version")
|
tg.grepStderr("compile", "does not match go tool version")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue 9737: verify that GOARM and GO386 affect the computed build ID.
|
|
||||||
func TestBuildIDContainsArchModeEnv(t *testing.T) {
|
|
||||||
if testing.Short() {
|
|
||||||
t.Skip("skipping in short mode")
|
|
||||||
}
|
|
||||||
|
|
||||||
var tg *testgoData
|
|
||||||
testWith := func(before, after func()) func(*testing.T) {
|
|
||||||
return func(t *testing.T) {
|
|
||||||
tg = testgo(t)
|
|
||||||
defer tg.cleanup()
|
|
||||||
tg.tempFile("src/mycmd/x.go", `package main
|
|
||||||
func main() {}`)
|
|
||||||
tg.setenv("GOPATH", tg.path("."))
|
|
||||||
|
|
||||||
tg.cd(tg.path("src/mycmd"))
|
|
||||||
tg.setenv("GOOS", "linux")
|
|
||||||
before()
|
|
||||||
tg.run("install", "mycmd")
|
|
||||||
after()
|
|
||||||
tg.wantStale("mycmd", "stale dependency", "should be stale after environment variable change")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
t.Run("386", testWith(func() {
|
|
||||||
tg.setenv("GOARCH", "386")
|
|
||||||
tg.setenv("GO386", "387")
|
|
||||||
}, func() {
|
|
||||||
tg.setenv("GO386", "sse2")
|
|
||||||
}))
|
|
||||||
|
|
||||||
t.Run("arm", testWith(func() {
|
|
||||||
tg.setenv("GOARCH", "arm")
|
|
||||||
tg.setenv("GOARM", "5")
|
|
||||||
}, func() {
|
|
||||||
tg.setenv("GOARM", "7")
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestBuildmodePIE(t *testing.T) {
|
func TestBuildmodePIE(t *testing.T) {
|
||||||
if testing.Short() && testenv.Builder() == "" {
|
if testing.Short() && testenv.Builder() == "" {
|
||||||
t.Skipf("skipping in -short mode on non-builder")
|
t.Skipf("skipping in -short mode on non-builder")
|
||||||
|
27
src/cmd/go/testdata/script/build_cache_arch_mode.txt
vendored
Normal file
27
src/cmd/go/testdata/script/build_cache_arch_mode.txt
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Issue 9737: verify that GOARM and GO386 affect the computed build ID
|
||||||
|
|
||||||
|
[short] skip
|
||||||
|
|
||||||
|
# 386
|
||||||
|
cd $GOPATH/src/mycmd
|
||||||
|
env GOOS=linux
|
||||||
|
env GOARCH=386
|
||||||
|
env GO386=387
|
||||||
|
go install mycmd
|
||||||
|
env GO386=sse2
|
||||||
|
stale mycmd
|
||||||
|
|
||||||
|
# arm
|
||||||
|
cd $GOPATH/src/mycmd
|
||||||
|
env GOOS=linux
|
||||||
|
env GOARCH=arm
|
||||||
|
env GOARM=5
|
||||||
|
go install mycmd
|
||||||
|
env GOARM=7
|
||||||
|
stale mycmd
|
||||||
|
|
||||||
|
|
||||||
|
-- mycmd/x.go --
|
||||||
|
package main
|
||||||
|
|
||||||
|
func main() {}
|
Loading…
Reference in New Issue
Block a user