]> Cypherpunks.ru repositories - gostls13.git/commitdiff
runtime: remove stale runtime check in tests
authorDmitry Vyukov <dvyukov@google.com>
Tue, 22 Oct 2019 12:44:29 +0000 (14:44 +0200)
committerDmitry Vyukov <dvyukov@google.com>
Wed, 6 Nov 2019 09:09:21 +0000 (09:09 +0000)
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>
src/runtime/crash_test.go
src/runtime/crash_unix_test.go

index 0bee734a2776b87c24ce99c310a42faf1e63de14..6c3127fa7558a8c69f8895a0c8e3f13d835cd309 100644 (file)
@@ -104,8 +104,6 @@ func buildTestProg(t *testing.T, binary string, flags ...string) (string, error)
                t.Skip("-quick")
        }
 
-       checkStaleRuntime(t)
-
        testprog.Lock()
        defer testprog.Unlock()
        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) {
        type crashTest struct {
                Cgo bool
index 93cee350d0018e7e4b3dbbe2d852c37cb3dc34ec..2944c9904c67600d2c2d6ea72ce4c82e61768ca8 100644 (file)
@@ -78,8 +78,6 @@ func TestCrashDumpsAllThreads(t *testing.T) {
 
        testenv.MustHaveGoBuild(t)
 
-       checkStaleRuntime(t)
-
        t.Parallel()
 
        dir, err := ioutil.TempDir("", "go-build")