]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/go/go_test.go
[dev.boringcrypto] all: merge commit 9d0819b27c (CL 314609) into dev.boringcrypto
[gostls13.git] / src / cmd / go / go_test.go
index e3fd1cd53fb9c0ff441a5d7d141a93b797f182e8..52b11fbb20d3e2c2dda4092daced867baa37a658 100644 (file)
@@ -814,6 +814,7 @@ func TestNewReleaseRebuildsStalePackagesInGOPATH(t *testing.T) {
                "src/internal/abi",
                "src/internal/bytealg",
                "src/internal/cpu",
+               "src/internal/goexperiment",
                "src/math/bits",
                "src/unsafe",
                filepath.Join("pkg", runtime.GOOS+"_"+runtime.GOARCH),
@@ -2839,3 +2840,27 @@ func TestCoverpkgTestOnly(t *testing.T) {
        tg.grepStderrNot("no packages being tested depend on matches", "bad match message")
        tg.grepStdout("coverage: 100", "no coverage")
 }
+
+// Regression test for golang.org/issue/34499: version command should not crash
+// when executed in a deleted directory on Linux.
+func TestExecInDeletedDir(t *testing.T) {
+       switch runtime.GOOS {
+       case "windows", "plan9",
+               "aix",                // Fails with "device busy".
+               "solaris", "illumos": // Fails with "invalid argument".
+               t.Skipf("%v does not support removing the current working directory", runtime.GOOS)
+       }
+       tg := testgo(t)
+       defer tg.cleanup()
+
+       wd, err := os.Getwd()
+       tg.check(err)
+       tg.makeTempdir()
+       tg.check(os.Chdir(tg.tempdir))
+       defer func() { tg.check(os.Chdir(wd)) }()
+
+       tg.check(os.Remove(tg.tempdir))
+
+       // `go version` should not fail
+       tg.run("version")
+}