Skip to content

Commit

Permalink
[release-branch.go1.14] cmd/go: convert TestBuildIDContainsArchModeEn…
Browse files Browse the repository at this point in the history
…v to the script framework

Part of converting all tests to script framework to improve
test parallelism.

Fixes #39824
Updates #36320
Updates #17751

Change-Id: I69c69809fb1698c8198ef3ea00103a9acb7b6ce7
Reviewed-on: https://go-review.googlesource.com/c/go/+/214387
Run-TryBot: Michael Matloob <[email protected]>
Reviewed-by: Jay Conrod <[email protected]>
(cherry picked from CL 214387)
Reviewed-on: https://go-review.googlesource.com/c/go/+/239738
Run-TryBot: Dmitri Shuralyov <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Reviewed-by: Michael Matloob <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
  • Loading branch information
matloob authored and cagedmantis committed Jun 29, 2020
1 parent 67d894e commit efed90a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 39 deletions.
39 changes: 0 additions & 39 deletions src/cmd/go/go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3955,45 +3955,6 @@ func TestCgoFlagContainsSpace(t *testing.T) {
tg.grepStderrNot(`"-L[^"]+c flags".*"-L[^"]+c flags"`, "found too many quoted ld flags")
}

// 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 TestListTests(t *testing.T) {
tooSlow(t)
var tg *testgoData
Expand Down
27 changes: 27 additions & 0 deletions src/cmd/go/testdata/script/build_cache_arch_mode.txt
Original file line number Diff line number Diff line change
@@ -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() {}

0 comments on commit efed90a

Please sign in to comment.