aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Broadfoot <cbro@golang.org>2016-02-03 14:11:49 -0800
committerChris Broadfoot <cbro@golang.org>2016-02-03 14:12:32 -0800
commitce8d5ba53e1b0c4bc5b9708f06f7fd6318d73154 (patch)
treed517da7418d6335a88ab24ec9e9e80db1b4df043
parent62e5355fdd649171dc601b88a2a15e69061e7890 (diff)
parent91911e39f0fdfecc5453f9eca7ff74215ffb28a2 (diff)
downloadgo-ce8d5ba53e1b0c4bc5b9708f06f7fd6318d73154.tar.gz
go-ce8d5ba53e1b0c4bc5b9708f06f7fd6318d73154.zip
all: merge master into release-branch.go1.6
Change-Id: Ifbe63b764e3d6933b112a4307a3701a047227976
-rwxr-xr-xlib/time/update.bash4
-rw-r--r--lib/time/zoneinfo.zipbin360617 -> 360703 bytes
-rw-r--r--src/cmd/go/alldocs.go3
-rw-r--r--src/cmd/go/build.go3
-rw-r--r--src/cmd/go/go_test.go86
-rw-r--r--src/cmd/go/pkg.go9
-rw-r--r--src/cmd/vet/cgo.go3
-rw-r--r--src/cmd/vet/testdata/cgo2.go9
-rw-r--r--src/net/http/httputil/reverseproxy.go5
-rw-r--r--src/net/http/httputil/reverseproxy_test.go8
-rw-r--r--src/net/http/transport_test.go5
-rw-r--r--src/runtime/pprof/pprof_test.go14
-rw-r--r--src/sync/waitgroup_test.go11
13 files changed, 132 insertions, 28 deletions
diff --git a/lib/time/update.bash b/lib/time/update.bash
index 3ffadc2ab4..86b1f21100 100755
--- a/lib/time/update.bash
+++ b/lib/time/update.bash
@@ -8,8 +8,8 @@
# Consult http://www.iana.org/time-zones for the latest versions.
# Versions to use.
-CODE=2015g
-DATA=2015g
+CODE=2016a
+DATA=2016a
set -e
rm -rf work
diff --git a/lib/time/zoneinfo.zip b/lib/time/zoneinfo.zip
index 740d81988b..0207d6bcbc 100644
--- a/lib/time/zoneinfo.zip
+++ b/lib/time/zoneinfo.zip
Binary files differ
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index 5db4bc6bec..c81bd40864 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -93,7 +93,8 @@ and test commands:
Supported only on linux/amd64, freebsd/amd64, darwin/amd64 and windows/amd64.
-msan
enable interoperation with memory sanitizer.
- Supported only on linux/amd64.
+ Supported only on linux/amd64,
+ and only with Clang/LLVM as the host C compiler.
-v
print the names of packages as they are compiled.
-work
diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go
index 12867004aa..a1f925ed0b 100644
--- a/src/cmd/go/build.go
+++ b/src/cmd/go/build.go
@@ -72,7 +72,8 @@ and test commands:
Supported only on linux/amd64, freebsd/amd64, darwin/amd64 and windows/amd64.
-msan
enable interoperation with memory sanitizer.
- Supported only on linux/amd64.
+ Supported only on linux/amd64,
+ and only with Clang/LLVM as the host C compiler.
-v
print the names of packages as they are compiled.
-work
diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go
index 0136ba4b1b..6d12f75073 100644
--- a/src/cmd/go/go_test.go
+++ b/src/cmd/go/go_test.go
@@ -657,6 +657,9 @@ func TestGoBuildDashAInDevBranch(t *testing.T) {
tg.setenv("TESTGO_IS_GO_RELEASE", "0")
tg.run("build", "-v", "-a", "math")
tg.grepStderr("runtime", "testgo build -a math in dev branch DID NOT build runtime, but should have")
+
+ // Everything is out of date. Rebuild to leave things in a better state.
+ tg.run("install", "std")
}
func TestGoBuildDashAInReleaseBranch(t *testing.T) {
@@ -672,11 +675,80 @@ func TestGoBuildDashAInReleaseBranch(t *testing.T) {
tg.grepStderr("runtime", "testgo build -a math in release branch DID NOT build runtime, but should have")
// Now runtime.a is updated (newer mtime), so everything would look stale if not for being a release.
- //
tg.run("build", "-v", "net/http")
tg.grepStderrNot("strconv", "testgo build -v net/http in release branch with newer runtime.a DID build strconv but should not have")
tg.grepStderrNot("golang.org/x/net/http2/hpack", "testgo build -v net/http in release branch with newer runtime.a DID build .../golang.org/x/net/http2/hpack but should not have")
tg.grepStderrNot("net/http", "testgo build -v net/http in release branch with newer runtime.a DID build net/http but should not have")
+
+ // Everything is out of date. Rebuild to leave things in a better state.
+ tg.run("install", "std")
+}
+
+func TestNewReleaseRebuildsStalePackagesInGOPATH(t *testing.T) {
+ if testing.Short() {
+ t.Skip("don't rebuild the standard library in short mode")
+ }
+
+ tg := testgo(t)
+ defer tg.cleanup()
+
+ addNL := func(name string) (restore func()) {
+ data, err := ioutil.ReadFile(name)
+ if err != nil {
+ t.Fatal(err)
+ }
+ old := data
+ data = append(data, '\n')
+ if err := ioutil.WriteFile(name, append(data, '\n'), 0666); err != nil {
+ t.Fatal(err)
+ }
+ tg.sleep()
+ return func() {
+ if err := ioutil.WriteFile(name, old, 0666); err != nil {
+ t.Fatal(err)
+ }
+ }
+ }
+
+ tg.setenv("TESTGO_IS_GO_RELEASE", "1")
+
+ tg.tempFile("d1/src/p1/p1.go", `package p1`)
+ tg.setenv("GOPATH", tg.path("d1"))
+ tg.run("install", "-a", "p1")
+ tg.wantNotStale("p1", "./testgo list claims p1 is stale, incorrectly")
+ tg.sleep()
+
+ // Changing mtime and content of runtime/internal/sys/sys.go
+ // should have no effect: we're in a release, which doesn't rebuild
+ // for general mtime or content changes.
+ sys := runtime.GOROOT() + "/src/runtime/internal/sys/sys.go"
+ restore := addNL(sys)
+ defer restore()
+ tg.wantNotStale("p1", "./testgo list claims p1 is stale, incorrectly, after updating runtime/internal/sys/sys.go")
+ restore()
+ tg.wantNotStale("p1", "./testgo list claims p1 is stale, incorrectly, after restoring runtime/internal/sys/sys.go")
+
+ // But changing runtime/internal/sys/zversion.go should have an effect:
+ // that's how we tell when we flip from one release to another.
+ zversion := runtime.GOROOT() + "/src/runtime/internal/sys/zversion.go"
+ restore = addNL(zversion)
+ defer restore()
+ tg.wantStale("p1", "./testgo list claims p1 is NOT stale, incorrectly, after changing to new release")
+ restore()
+ tg.wantNotStale("p1", "./testgo list claims p1 is stale, incorrectly, after changing back to old release")
+ addNL(zversion)
+ tg.wantStale("p1", "./testgo list claims p1 is NOT stale, incorrectly, after changing again to new release")
+ tg.run("install", "p1")
+ tg.wantNotStale("p1", "./testgo list claims p1 is stale after building with new release")
+
+ // Restore to "old" release.
+ restore()
+ tg.wantStale("p1", "./testgo list claims p1 is NOT stale, incorrectly, after changing to old release after new build")
+ tg.run("install", "p1")
+ tg.wantNotStale("p1", "./testgo list claims p1 is stale after building with old release")
+
+ // Everything is out of date. Rebuild to leave things in a better state.
+ tg.run("install", "std")
}
func TestGoListStandard(t *testing.T) {
@@ -756,8 +828,8 @@ func TestGoInstallRebuildsStalePackagesInOtherGOPATH(t *testing.T) {
sep := string(filepath.ListSeparator)
tg.setenv("GOPATH", tg.path("d1")+sep+tg.path("d2"))
tg.run("install", "p1")
- tg.wantNotStale("p1", "./testgo list mypkg claims p1 is stale, incorrectly")
- tg.wantNotStale("p2", "./testgo list mypkg claims p2 is stale, incorrectly")
+ tg.wantNotStale("p1", "./testgo list claims p1 is stale, incorrectly")
+ tg.wantNotStale("p2", "./testgo list claims p2 is stale, incorrectly")
tg.sleep()
if f, err := os.OpenFile(tg.path("d2/src/p2/p2.go"), os.O_WRONLY|os.O_APPEND, 0); err != nil {
t.Fatal(err)
@@ -766,12 +838,12 @@ func TestGoInstallRebuildsStalePackagesInOtherGOPATH(t *testing.T) {
} else {
tg.must(f.Close())
}
- tg.wantStale("p2", "./testgo list mypkg claims p2 is NOT stale, incorrectly")
- tg.wantStale("p1", "./testgo list mypkg claims p1 is NOT stale, incorrectly")
+ tg.wantStale("p2", "./testgo list claims p2 is NOT stale, incorrectly")
+ tg.wantStale("p1", "./testgo list claims p1 is NOT stale, incorrectly")
tg.run("install", "p1")
- tg.wantNotStale("p2", "./testgo list mypkg claims p2 is stale after reinstall, incorrectly")
- tg.wantNotStale("p1", "./testgo list mypkg claims p1 is stale after reinstall, incorrectly")
+ tg.wantNotStale("p2", "./testgo list claims p2 is stale after reinstall, incorrectly")
+ tg.wantNotStale("p1", "./testgo list claims p1 is stale after reinstall, incorrectly")
}
func TestGoInstallDetectsRemovedFiles(t *testing.T) {
diff --git a/src/cmd/go/pkg.go b/src/cmd/go/pkg.go
index 95a06ffedc..a804ccd277 100644
--- a/src/cmd/go/pkg.go
+++ b/src/cmd/go/pkg.go
@@ -1542,11 +1542,14 @@ func computeBuildID(p *Package) {
fmt.Fprintf(h, "file %s\n", file)
}
- // Include the content of runtime/zversion.go in the hash
+ // Include the content of runtime/internal/sys/zversion.go in the hash
// for package runtime. This will give package runtime a
// different build ID in each Go release.
- if p.Standard && p.ImportPath == "runtime" {
- data, _ := ioutil.ReadFile(filepath.Join(p.Dir, "zversion.go"))
+ if p.Standard && p.ImportPath == "runtime/internal/sys" {
+ data, err := ioutil.ReadFile(filepath.Join(p.Dir, "zversion.go"))
+ if err != nil {
+ fatalf("go: %s", err)
+ }
fmt.Fprintf(h, "zversion %q\n", string(data))
}
diff --git a/src/cmd/vet/cgo.go b/src/cmd/vet/cgo.go
index 8807952b48..1985a86fe0 100644
--- a/src/cmd/vet/cgo.go
+++ b/src/cmd/vet/cgo.go
@@ -72,6 +72,9 @@ func cgoBaseType(f *File, arg ast.Expr) types.Type {
}
// Here arg is *f(v).
t := f.pkg.types[call.Fun].Type
+ if t == nil {
+ break
+ }
ptr, ok := t.Underlying().(*types.Pointer)
if !ok {
break
diff --git a/src/cmd/vet/testdata/cgo2.go b/src/cmd/vet/testdata/cgo2.go
new file mode 100644
index 0000000000..276aea9619
--- /dev/null
+++ b/src/cmd/vet/testdata/cgo2.go
@@ -0,0 +1,9 @@
+// Copyright 2016 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Test the cgo checker on a file that doesn't use cgo.
+
+package testdata
+
+var _ = C.f(*p(**p))
diff --git a/src/net/http/httputil/reverseproxy.go b/src/net/http/httputil/reverseproxy.go
index 4dba352a4f..54411caeca 100644
--- a/src/net/http/httputil/reverseproxy.go
+++ b/src/net/http/httputil/reverseproxy.go
@@ -106,11 +106,12 @@ func copyHeader(dst, src http.Header) {
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html
var hopHeaders = []string{
"Connection",
+ "Proxy-Connection", // non-standard but still sent by libcurl and rejected by e.g. google
"Keep-Alive",
"Proxy-Authenticate",
"Proxy-Authorization",
- "Te", // canonicalized version of "TE"
- "Trailers",
+ "Te", // canonicalized version of "TE"
+ "Trailer", // not Trailers per URL above; http://www.rfc-editor.org/errata_search.php?eid=4522
"Transfer-Encoding",
"Upgrade",
}
diff --git a/src/net/http/httputil/reverseproxy_test.go b/src/net/http/httputil/reverseproxy_test.go
index 7f203d878f..0849427b85 100644
--- a/src/net/http/httputil/reverseproxy_test.go
+++ b/src/net/http/httputil/reverseproxy_test.go
@@ -45,9 +45,13 @@ func TestReverseProxy(t *testing.T) {
if c := r.Header.Get("Upgrade"); c != "" {
t.Errorf("handler got Upgrade header value %q", c)
}
+ if c := r.Header.Get("Proxy-Connection"); c != "" {
+ t.Errorf("handler got Proxy-Connection header value %q", c)
+ }
if g, e := r.Host, "some-name"; g != e {
t.Errorf("backend got Host header %q, want %q", g, e)
}
+ w.Header().Set("Trailers", "not a special header field name")
w.Header().Set("Trailer", "X-Trailer")
w.Header().Set("X-Foo", "bar")
w.Header().Set("Upgrade", "foo")
@@ -71,6 +75,7 @@ func TestReverseProxy(t *testing.T) {
getReq, _ := http.NewRequest("GET", frontend.URL, nil)
getReq.Host = "some-name"
getReq.Header.Set("Connection", "close")
+ getReq.Header.Set("Proxy-Connection", "should be deleted")
getReq.Header.Set("Upgrade", "foo")
getReq.Close = true
res, err := http.DefaultClient.Do(getReq)
@@ -86,6 +91,9 @@ func TestReverseProxy(t *testing.T) {
if c := res.Header.Get(fakeHopHeader); c != "" {
t.Errorf("got %s header value %q", fakeHopHeader, c)
}
+ if g, e := res.Header.Get("Trailers"), "not a special header field name"; g != e {
+ t.Errorf("header Trailers = %q; want %q", g, e)
+ }
if g, e := len(res.Header["X-Multi-Value"]), 2; g != e {
t.Errorf("got %d X-Multi-Value header values; expected %d", g, e)
}
diff --git a/src/net/http/transport_test.go b/src/net/http/transport_test.go
index 3b2a5f978e..8cb89a4220 100644
--- a/src/net/http/transport_test.go
+++ b/src/net/http/transport_test.go
@@ -2208,9 +2208,8 @@ func TestTransportTLSHandshakeTimeout(t *testing.T) {
// Trying to repro golang.org/issue/3514
func TestTLSServerClosesConnection(t *testing.T) {
defer afterTest(t)
- if runtime.GOOS == "windows" {
- t.Skip("skipping flaky test on Windows; golang.org/issue/7634")
- }
+ setFlaky(t, 7634)
+
closedc := make(chan bool, 1)
ts := httptest.NewTLSServer(HandlerFunc(func(w ResponseWriter, r *Request) {
if strings.Contains(r.URL.Path, "/keep-alive-then-die") {
diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go
index 621d21d327..ab6b1835c5 100644
--- a/src/runtime/pprof/pprof_test.go
+++ b/src/runtime/pprof/pprof_test.go
@@ -96,7 +96,7 @@ func parseProfile(t *testing.T, bytes []byte, f func(uintptr, []uintptr)) {
if l < 5+3 {
t.Logf("profile too short: %#x", val)
if badOS[runtime.GOOS] {
- t.Skipf("ignoring failure on %s; see golang.org/issue/6047", runtime.GOOS)
+ t.Skipf("ignoring failure on %s; see golang.org/issue/13841", runtime.GOOS)
return
}
t.FailNow()
@@ -171,7 +171,7 @@ func testCPUProfile(t *testing.T, need []string, f func(dur time.Duration)) {
}
if badOS[runtime.GOOS] {
- t.Skipf("ignoring failure on %s; see golang.org/issue/6047", runtime.GOOS)
+ t.Skipf("ignoring failure on %s; see golang.org/issue/13841", runtime.GOOS)
return
}
// Ignore the failure if the tests are running in a QEMU-based emulator,
@@ -420,11 +420,13 @@ func deepStack(depth int) int {
return deepStack(depth-1) + 1
}
-// Operating systems that are expected to fail the tests. See issue 6047.
+// Operating systems that are expected to fail the tests. See issue 13841.
var badOS = map[string]bool{
- "darwin": true,
- "netbsd": true,
- "plan9": true,
+ "darwin": true,
+ "netbsd": true,
+ "plan9": true,
+ "dragonfly": true,
+ "solaris": true,
}
func TestBlockProfile(t *testing.T) {
diff --git a/src/sync/waitgroup_test.go b/src/sync/waitgroup_test.go
index a581660940..8ec34fd343 100644
--- a/src/sync/waitgroup_test.go
+++ b/src/sync/waitgroup_test.go
@@ -128,13 +128,16 @@ func TestWaitGroupMisuse3(t *testing.T) {
}
}()
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(4))
- done := make(chan interface{}, 1)
+ done := make(chan interface{}, 2)
// The detection is opportunistically, so we want it to panic
// at least in one run out of a million.
for i := 0; i < 1e6; i++ {
var wg WaitGroup
wg.Add(1)
go func() {
+ defer func() {
+ done <- recover()
+ }()
wg.Done()
}()
go func() {
@@ -150,8 +153,10 @@ func TestWaitGroupMisuse3(t *testing.T) {
wg.Wait()
}()
wg.Wait()
- if err := <-done; err != nil {
- panic(err)
+ for j := 0; j < 2; j++ {
+ if err := <-done; err != nil {
+ panic(err)
+ }
}
}
t.Fatal("Should panic")