1
0
mirror of https://github.com/golang/go synced 2024-11-06 22:26:11 -07:00

runtime: remove stale runtime check in tests

The check is not relevant anymore.
The comment claims that go run does not rebuild packages,
but this is not true. And we use go build anyway.
We may have added the check because without caching
rebuilding everything starting from runtime for each test
takes a while. But now we have caching.
So from every side this check just adds code and pain.

Change-Id: Ifbbb643724100622e5f9db884339b67cde4ba729
Reviewed-on: https://go-review.googlesource.com/c/go/+/202450
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Dmitry Vyukov 2019-10-22 14:44:29 +02:00
parent 61089984a8
commit 0ea7440139
2 changed files with 0 additions and 32 deletions

View File

@ -104,8 +104,6 @@ func buildTestProg(t *testing.T, binary string, flags ...string) (string, error)
t.Skip("-quick") t.Skip("-quick")
} }
checkStaleRuntime(t)
testprog.Lock() testprog.Lock()
defer testprog.Unlock() defer testprog.Unlock()
if testprog.dir == "" { if testprog.dir == "" {
@ -152,34 +150,6 @@ func TestVDSO(t *testing.T) {
} }
} }
var (
staleRuntimeOnce sync.Once // guards init of staleRuntimeErr
staleRuntimeErr error
)
func checkStaleRuntime(t *testing.T) {
staleRuntimeOnce.Do(func() {
// 'go run' uses the installed copy of runtime.a, which may be out of date.
out, err := testenv.CleanCmdEnv(exec.Command(testenv.GoToolPath(t), "list", "-gcflags=all="+os.Getenv("GO_GCFLAGS"), "-f", "{{.Stale}}", "runtime")).CombinedOutput()
if err != nil {
staleRuntimeErr = fmt.Errorf("failed to execute 'go list': %v\n%v", err, string(out))
return
}
if string(out) != "false\n" {
t.Logf("go list -f {{.Stale}} runtime:\n%s", out)
out, err := testenv.CleanCmdEnv(exec.Command(testenv.GoToolPath(t), "list", "-gcflags=all="+os.Getenv("GO_GCFLAGS"), "-f", "{{.StaleReason}}", "runtime")).CombinedOutput()
if err != nil {
t.Logf("go list -f {{.StaleReason}} failed: %v", err)
}
t.Logf("go list -f {{.StaleReason}} runtime:\n%s", out)
staleRuntimeErr = fmt.Errorf("Stale runtime.a. Run 'go install runtime'.")
}
})
if staleRuntimeErr != nil {
t.Fatal(staleRuntimeErr)
}
}
func testCrashHandler(t *testing.T, cgo bool) { func testCrashHandler(t *testing.T, cgo bool) {
type crashTest struct { type crashTest struct {
Cgo bool Cgo bool

View File

@ -78,8 +78,6 @@ func TestCrashDumpsAllThreads(t *testing.T) {
testenv.MustHaveGoBuild(t) testenv.MustHaveGoBuild(t)
checkStaleRuntime(t)
t.Parallel() t.Parallel()
dir, err := ioutil.TempDir("", "go-build") dir, err := ioutil.TempDir("", "go-build")