Skip to content

Commit

Permalink
all: merge master into release-branch.go1.6
Browse files Browse the repository at this point in the history
Change-Id: Ifbe63b764e3d6933b112a4307a3701a047227976
  • Loading branch information
broady committed Feb 3, 2016
2 parents 62e5355 + 91911e3 commit ce8d5ba
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 28 deletions.
4 changes: 2 additions & 2 deletions lib/time/update.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified lib/time/zoneinfo.zip
Binary file not shown.
3 changes: 2 additions & 1 deletion src/cmd/go/alldocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/cmd/go/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
86 changes: 79 additions & 7 deletions src/cmd/go/go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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)
Expand All @@ -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) {
Expand Down
9 changes: 6 additions & 3 deletions src/cmd/go/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
3 changes: 3 additions & 0 deletions src/cmd/vet/cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions src/cmd/vet/testdata/cgo2.go
Original file line number Diff line number Diff line change
@@ -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))
5 changes: 3 additions & 2 deletions src/net/http/httputil/reverseproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
Expand Down
8 changes: 8 additions & 0 deletions src/net/http/httputil/reverseproxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand All @@ -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)
}
Expand Down
5 changes: 2 additions & 3 deletions src/net/http/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
14 changes: 8 additions & 6 deletions src/runtime/pprof/pprof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down
11 changes: 8 additions & 3 deletions src/sync/waitgroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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")
Expand Down

0 comments on commit ce8d5ba

Please sign in to comment.