Skip to content

Commit

Permalink
Merge commit 'd5d4e82fb28f506701791f622ec0b03b984e41a5' into ios3
Browse files Browse the repository at this point in the history
Conflicts:
	src/runtime/stack.h
  • Loading branch information
minux committed Jan 26, 2015
2 parents 242b776 + d5d4e82 commit ff1a23f
Show file tree
Hide file tree
Showing 145 changed files with 2,253 additions and 1,925 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Go is the work of hundreds of contributors. We appreciate your help!
To contribute, please read the contribution guidelines:
https://golang.org/doc/contribute.html

##### Please note that we do not use pull requests.

Unless otherwise noted, the Go source files are distributed
under the BSD-style license found in the LICENSE file.

Expand Down
2 changes: 0 additions & 2 deletions api/next.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,3 @@ pkg runtime (openbsd-amd64-cgo), const EWOULDBLOCK = 35
pkg runtime (openbsd-amd64-cgo), const EWOULDBLOCK ideal-int
pkg runtime (openbsd-amd64-cgo), const HW_NCPU = 3
pkg runtime (openbsd-amd64-cgo), const HW_NCPU ideal-int
pkg runtime, func GCcheckmarkdisable()
pkg runtime, func GCcheckmarkenable()
7 changes: 7 additions & 0 deletions doc/devel/release.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ <h2 id="go1.4">go1.4 (released 2014/12/10)</h2>
Read the <a href="/doc/go1.4">Go 1.4 Release Notes</a> for more information.
</p>

<h3 id="go1.4.minor">Minor revisions</h3>

<p>
go1.4.1 (released 2015/01/15) includes bug fixes to the linker and the <code>log</code>, <code>syscall</code>, and <code>runtime</code> packages.
See the <a href="https://github.com/golang/go/issues?q=milestone%3AGo1.4.1">Go 1.4.1 milestone on our issue tracker</a> for details.
</p>

<h2 id="go1.3">go1.3 (released 2014/06/18)</h2>

<p>
Expand Down
6 changes: 6 additions & 0 deletions doc/go1.5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ bufio: add Reader.Discard (https://golang.org/cl/2260)
crypto/cipher: clarify what will happen if len(src) != len(dst) for the Stream interface. (https://golang.org/cl/1754)
crypto/tls: change default minimum version to TLS 1.0. (https://golang.org/cl/1791)
encoding/base64: add unpadded encodings (https://golang.org/cl/1511)
log: add global Output function (https://golang.org/cl/2686)
net/http: support for setting trailers from a server Handler (https://golang.org/cl/2157)
net/smtp: add TLSConnectionState accessor (https://golang.org/cl/2151)

Tools:

cmd/vet: better validation of struct tags (https://golang.org/cl/2685)

Performance:

strconv: optimize decimal to string conversion (https://golang.org/cl/2105)
math/big: faster assembly kernels for amd64 and 386 (https://golang.org/cl/2503, https://golang.org/cl/2560)
math/big: faster "pure Go" kernels for platforms w/o assembly kernels (https://golang.org/cl/2480)
4 changes: 2 additions & 2 deletions misc/android/README
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ Android
=======

For details on developing Go for Android, see the documentation in the
go.mobile subrepository:
mobile subrepository:

https://code.google.com/p/go/source/browse/README?repo=mobile
https://github.com/golang/mobile

To run the standard library tests, see androidtest.bash. Run it as

Expand Down
82 changes: 59 additions & 23 deletions misc/android/go_android_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package main
import (
"bytes"
"fmt"
"go/build"
"io"
"log"
"os"
Expand All @@ -32,33 +33,36 @@ func run(args ...string) string {
return buf.String()
}

const (
// Directory structure on the target device androidtest.bash assumes.
deviceGoroot = "/data/local/tmp/goroot"
deviceGopath = "/data/local/tmp/gopath"
)

func main() {
log.SetFlags(0)
log.SetPrefix("go_android_exec: ")

// Determine thepackage by examining the current working
// Prepare a temporary directory that will be cleaned up at the end.
deviceGotmp := fmt.Sprintf("/data/local/tmp/%s-%d",
filepath.Base(os.Args[1]), os.Getpid())
run("shell", "mkdir", "-p", deviceGotmp)

// Determine the package by examining the current working
// directory, which will look something like
// "$GOROOT/src/mime/multipart". We extract everything
// after the $GOROOT to run on the same relative directory
// on the target device.
//
// TODO(crawshaw): Pick useful subdir when we are not
// inside a GOROOT, e.g. we are in a GOPATH.
cwd, err := os.Getwd()
if err != nil {
log.Fatal(err)
// "$GOROOT/src/mime/multipart" or "$GOPATH/src/golang.org/x/mobile".
// We extract everything after the $GOROOT or $GOPATH to run on the
// same relative directory on the target device.
subdir, inGoRoot := subdir()
deviceCwd := filepath.Join(deviceGoroot, subdir)
if !inGoRoot {
deviceCwd = filepath.Join(deviceGopath, subdir)
}
subdir, err := filepath.Rel(runtime.GOROOT(), cwd)
if err != nil {
log.Fatal(err)
}
subdir = filepath.ToSlash(subdir)

// Binary names can conflict.
// E.g. template.test from the {html,text}/template packages.
binName := filepath.Base(os.Args[1])
deviceGoroot := "/data/local/tmp/goroot"
deviceBin := fmt.Sprintf("%s/%s-%d", deviceGoroot, binName, os.Getpid())
deviceBin := fmt.Sprintf("%s/%s-%d", deviceGotmp, binName, os.Getpid())

// The push of the binary happens in parallel with other tests.
// Unfortunately, a simultaneous call to adb shell hold open
Expand All @@ -71,19 +75,22 @@ func main() {

// The adb shell command will return an exit code of 0 regardless
// of the command run. E.g.
// $ adb shell false
// $ echo $?
// 0
// $ adb shell false
// $ echo $?
// 0
// https://code.google.com/p/android/issues/detail?id=3254
// So we append the exitcode to the output and parse it from there.
const exitstr = "exitcode="
cmd := `export TMPDIR="/data/local/tmp"` +
cmd := `export TMPDIR="` + deviceGotmp + `"` +
`; export GOROOT="` + deviceGoroot + `"` +
`; cd "$GOROOT/` + subdir + `"` +
`; export GOPATH="` + deviceGopath + `"` +
`; cd "` + deviceCwd + `"` +
"; '" + deviceBin + "' " + strings.Join(os.Args[2:], " ") +
"; echo -n " + exitstr + "$?"
output := run("shell", cmd)
run("shell", "rm '"+deviceBin+"'") // cleanup

run("shell", "rm", "-rf", deviceGotmp) // Clean up.

output = output[strings.LastIndex(output, "\n")+1:]
if !strings.HasPrefix(output, exitstr) {
log.Fatalf("no exit code: %q", output)
Expand All @@ -94,3 +101,32 @@ func main() {
}
os.Exit(code)
}

// subdir determines the package based on the current working directory,
// and returns the path to the package source relative to $GOROOT (or $GOPATH).
func subdir() (pkgpath string, underGoRoot bool) {
cwd, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
if root := runtime.GOROOT(); strings.HasPrefix(cwd, root) {
subdir, err := filepath.Rel(root, cwd)
if err != nil {
log.Fatal(err)
}
return subdir, true
}

for _, p := range filepath.SplitList(build.Default.GOPATH) {
if !strings.HasPrefix(cwd, p) {
continue
}
subdir, err := filepath.Rel(p, cwd)
if err == nil {
return subdir, false
}
}
log.Fatalf("the current path %q is not in either GOROOT(%q) or GOPATH(%q)",
cwd, runtime.GOROOT(), build.Default.GOPATH)
return "", false
}
1 change: 1 addition & 0 deletions misc/cgo/test/cgo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@ func Test8811(t *testing.T) { test8811(t) }
func TestReturnAfterGrow(t *testing.T) { testReturnAfterGrow(t) }
func TestReturnAfterGrowFromGo(t *testing.T) { testReturnAfterGrowFromGo(t) }
func Test9026(t *testing.T) { test9026(t) }
func Test9557(t *testing.T) { test9557(t) }

func BenchmarkCgoCall(b *testing.B) { benchCgoCall(b) }
2 changes: 1 addition & 1 deletion misc/cgo/test/issue7234_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import "testing"

var v7234 = [...]string{"runtime/cgo"}

func TestIssue7234(t *testing.T) {
func Test7234(t *testing.T) {
if v7234[0] != "runtime/cgo" {
t.Errorf("bad string constant %q", v7234[0])
}
Expand Down
36 changes: 36 additions & 0 deletions misc/cgo/test/issue9557.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2015 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.

// cgo rewrote C.var to *_Cvar_var, but left
// C.var.field as _Cvar.var.field. It now rewrites
// the latter as (*_Cvar_var).field.
// See https://golang.org/issue/9557.

package cgotest

// struct issue9557_t {
// int a;
// } test9557bar = { 42 };
//
// struct issue9557_t *issue9557foo = &test9557bar;
import "C"
import "testing"

func test9557(t *testing.T) {
// implicitly dereference a Go variable
foo := C.issue9557foo
if v := foo.a; v != 42 {
t.Fatalf("foo.a expected 42, but got %d", v)
}

// explicitly dereference a C variable
if v := (*C.issue9557foo).a; v != 42 {
t.Fatalf("(*C.issue9557foo).a expected 42, but is %d", v)
}

// implicitly dereference a C variable
if v := C.issue9557foo.a; v != 42 {
t.Fatalf("C.issue9557foo.a expected 42, but is %d", v)
}
}
6 changes: 6 additions & 0 deletions misc/cgo/testso/test.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

set -e

if [ "$(uname -m)" == ppc64 -o "$(uname -m)" == ppc64le ]; then
# External linking not implemented on ppc64
echo "skipping test on ppc64 (issue #8912)"
exit
fi

args=
dyld_envvar=LD_LIBRARY_PATH
ext=so
Expand Down
Loading

0 comments on commit ff1a23f

Please sign in to comment.