Change-Id: I214c87579ef21ced8d0ba94aa170dd7780afec4b
Reviewed-on: https://go-review.googlesource.com/32312 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Volodymyr Paprotski [Fri, 14 Oct 2016 20:19:25 +0000 (16:19 -0400)]
crypto/elliptic: add s390x assembly implementation of NIST P-256 Curve
A paranoid go at constant time implementation of P256 curve.
This code relies on z13 SIMD instruction set. For zEC12 and below,
the fallback is the existing P256 implementation. To facilitate this
fallback mode, I've refactored the code so that implementations can
be picked at run-time.
Its 'slightly' difficult to grok, but there is ASCII art..
name old time/op new time/op delta
BaseMultP256 419µs ± 3% 27µs ± 1% -93.65% (p=0.000 n=10+8)
ScalarMultP256 1.05ms ±10% 0.09ms ± 1% -90.94% (p=0.000 n=10+8)
Change-Id: Ic1ded898a2ceab055b1c69570c03179c4b85b177
Reviewed-on: https://go-review.googlesource.com/31231
Run-TryBot: Michael Munday <munday@ca.ibm.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Mohit Agarwal [Tue, 8 Nov 2016 12:16:10 +0000 (17:46 +0530)]
os: cleanup directories created by TestLongPath
Add tmpdir as a parameter to the closure otherwise the subsequent
modifications to tmpdir causes only the last subdirectory to be
removed.
Additionally, add the missing argument for the t.Fatalf call.
Change-Id: I3df53f9051f7ea40cf3f846d47d9cefe445e9b9d
Reviewed-on: https://go-review.googlesource.com/32892 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Shenghou Ma [Sun, 1 Nov 2015 09:18:58 +0000 (04:18 -0500)]
os: add Executable() (string, error)
// Executable returns the path name for the executable that started
// the current process. There is no guarantee that the path is still
// pointing to the correct executable. If a symlink was used to start
// the process, depending on the operating system, the result might
// be the symlink or the path it pointed to. If a stable result is
// needed, path/filepath.EvalSymlinks might help.
//
// Executable returns an absolute path unless an error occurred.
//
// The main use case is finding resources located relative to an
// executable.
//
// Executable is not supported on nacl or OpenBSD (unless procfs is
// mounted.)
func Executable() (string, error) {
return executable()
}
Michael Munday [Mon, 7 Nov 2016 20:40:48 +0000 (15:40 -0500)]
crypto/tls: use default cipher suites in BenchmarkThroughput
CL 32871 updated the default cipher suites to use AES-GCM in
preference to ChaCha20-Poly1305 on platforms which have hardware
implementations of AES-GCM. This change makes BenchmarkThroughput
use the default cipher suites instead of the test cipher suites to
ensure that the recommended (fastest) algorithms are used.
Updates #17779.
Change-Id: Ib551223e4a00b5ea197d4d73748e1fdd8a47c32d
Reviewed-on: https://go-review.googlesource.com/32838
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Adam Langley <agl@golang.org>
Quentin Smith [Fri, 28 Oct 2016 17:01:51 +0000 (13:01 -0400)]
os: use extended-length paths on Windows when possible
Windows has a limit of 260 characters on normal paths, but it's possible
to use longer paths by using "extended-length paths" that begin with
`\\?\`. This commit attempts to transparently convert an absolute path
to an extended-length path, following the subtly different rules those
paths require. It does not attempt to handle relative paths, which
continue to be passed to the operating system unmodified.
This adds a new test, TestLongPath, to the os package. This test makes
sure that it is possible to write a path at least 400 characters long
and runs on every platform. It also tests symlinks and hardlinks, though
symlinks are not testable with our builder configuration.
HasLink is moved to internal/testenv so it can be used by multiple tests.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
has Microsoft's documentation on extended-length paths.
Adam Langley [Mon, 7 Nov 2016 18:25:57 +0000 (10:25 -0800)]
crypto/{cipher,tls,internal/cryptohw}: prioritise AES-GCM when hardware support is present.
Support for ChaCha20-Poly1305 ciphers was recently added to crypto/tls.
These ciphers are preferable in software, but they cannot beat hardware
support for AES-GCM, if present.
This change moves detection for hardware AES-GCM support into
cipher/internal/cipherhw so that it can be used from crypto/tls. Then,
when AES-GCM hardware is present, the AES-GCM cipher suites are
prioritised by default in crypto/tls. (Some servers, such as Google,
respect the client's preference between AES-GCM and ChaCha20-Poly1305.)
Brad Fitzpatrick [Mon, 7 Nov 2016 01:21:15 +0000 (01:21 +0000)]
cmd/go: parallelize some tests
Cuts tests from 35 to 25 seconds.
Many of these could be parallel if the test runner were modified to
give each test its own workdir cloned from the tempdir files they
use. But later. This helps for now.
Updates #17751
Change-Id: Icc2ff87cca60a33ec5fd8abb1eb0a9ca3e85bf95
Reviewed-on: https://go-review.googlesource.com/32850
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Joe Farrell [Mon, 7 Nov 2016 18:43:13 +0000 (18:43 +0000)]
doc: fix broken links in 1.7 release docs
Change-Id: Ibf73ee7be4591393f4e08d464edfa325c3ec2c11
Reviewed-on: https://go-review.googlesource.com/32798 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Lynn Boger [Fri, 4 Nov 2016 19:53:59 +0000 (14:53 -0500)]
cmd/link: don't use trampolines in ppc64le ext linking
On ppc64x, trampolines are used to resolve too-far
branches for internal linking. The external linking,
solution on ppc64x is to split text sections when they
get too large, allowing the external linker to handle
the long branches.
On arm trampolines are generanted for too-far branches
for internal and external linking. When the change
was made recently to enable trampolines for external linking
on arm, that broke the ppc64x fix for too-far branches
with external linking.
The fix adds a check to use trampolines only for internal
linking with ppc64x.
Alex Brainman [Sun, 6 Nov 2016 07:43:49 +0000 (18:43 +1100)]
runtime/race: allow TestFail to run longer than 0.00s
Fixes #17811
Change-Id: I7bf9cbc5245417047ad28a14d9b9ad6592607d3d
Reviewed-on: https://go-review.googlesource.com/32774 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Brad Fitzpatrick [Fri, 4 Nov 2016 19:12:09 +0000 (19:12 +0000)]
cmd/vet: parallelize tests
Was 2.3 seconds. Now 1.4 seconds.
Next win would be not running a child process and refactoring main so
it could be called from tests easily. But that would also require
rewriting the errchk written in Perl. This appears to be the last user
of errchk in the tree.
Leon Klingele [Fri, 4 Nov 2016 23:57:45 +0000 (00:57 +0100)]
plugin: fix doc example fmt usage
Change-Id: I0520a37a48a56d231a8ac2dc58b2bf1762282760
Reviewed-on: https://go-review.googlesource.com/32795 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Fitzpatrick [Wed, 2 Nov 2016 21:45:27 +0000 (14:45 -0700)]
crypto/x509: update __MAC_OS_X_VERSION_MAX_ALLOWED on Mac
Reportedly, -mmacosx-version-min=10.6 -D__MAC_OS_X_VERSION_MAX_ALLOWED=1060
is problematic.
It means min 10.6 and max 10.6, thus exactly 10.6. But we only support
10.8+.
It never caused us problems, because we build on Macs, but apparently
if you cross-compile from Linux with some Mac compiler SDK thing, then
things break?
This was added in https://golang.org/cl/5700083 for #3131, and the
intent at the time was to pin to exactly 10.6. So it wasn't a mistake,
but it is definitely outdated.
Given that we now support 10.8 as the min, update it to 1080.
Alan Donovan [Fri, 4 Nov 2016 21:11:51 +0000 (17:11 -0400)]
go/types: avoid redundant call to recordUse for anonymous fields
Anonymous fields are type expressions, and Checker.typexpr already
correctly records uses within them. There's no need for a second
call, and the second call caused a bug when we implemented aliases.
Change-Id: I1bf2429cd4948d68b085e75dfb1bdc03ad8caffd
Reviewed-on: https://go-review.googlesource.com/32837 Reviewed-by: Robert Griesemer <gri@golang.org>
Brad Fitzpatrick [Thu, 3 Nov 2016 20:53:05 +0000 (20:53 +0000)]
net/http: tweak the new Client 307/308 redirect behavior a bit
This CL tweaks the new (unreleased) 307/308 support added in
https://golang.org/cl/29852 for #10767.
Change 1: if a 307/308 response doesn't have a Location header in its
response (as observed in the wild in #17773), just do what we used to
do in Go 1.7 and earlier, and don't try to follow that redirect.
Change 2: don't follow a 307/308 if we sent a body on the first
request and the caller's Request.GetBody func is nil so we can't
"rewind" the body to send it again.
Vladimir Stefanovic [Tue, 18 Oct 2016 21:50:25 +0000 (23:50 +0200)]
runtime/internal/sys: add arch defs for GOARCH=mips{,le}
Change-Id: I6288f1fca1ae4c64b3907af700811ee842053020
Reviewed-on: https://go-review.googlesource.com/31472 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Vladimir Stefanovic [Tue, 18 Oct 2016 21:50:29 +0000 (23:50 +0200)]
cmd/internal/sys: add support for GOARCH=mips{,le}
Change-Id: I8c6b8839c68818430510702719dca15b8d748fb8
Reviewed-on: https://go-review.googlesource.com/31473 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Vladimir Stefanovic [Wed, 31 Aug 2016 14:58:56 +0000 (16:58 +0200)]
runtime: 8-byte align the heap_live field for atomic access
mheap_.heap_live is an atomically accessed uint64. It is currently not 8-byte
aligned on 32-bit platforms, which has been okay because it's only accessed via
Xadd64, which doesn't require alignment on 386 or ARM32. However, Xadd64 on
MIPS32 does require 8-byte alignment.
Add a padding field to force 8-byte alignment of heap_live and prevent an
alignment check crash on MIPS32.
Change-Id: I7eddf7883aec7a0a7e0525af5d58ed4338a401d0
Reviewed-on: https://go-review.googlesource.com/31635
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Brad Fitzpatrick [Sat, 22 Oct 2016 14:25:21 +0000 (07:25 -0700)]
testing: add T.Context method
From the doc comment:
Context returns the context for the current test or benchmark.
The context is cancelled when the test or benchmark finishes.
A goroutine started during a test or benchmark can wait for the
context's Done channel to become readable as a signal that the
test or benchmark is over, so that the goroutine can exit.
Fixes #16221.
Fixes #17552.
Change-Id: I657df946be2c90048cc74615436c77c7d9d1226c
Reviewed-on: https://go-review.googlesource.com/31724 Reviewed-by: Rob Pike <r@golang.org>
Russ Cox [Thu, 3 Nov 2016 01:40:47 +0000 (21:40 -0400)]
testing: mark tests and benchmarks failed if a race occurs during execution
Before:
$ go test -race -v -run TestRace
=== RUN TestRace
==================
WARNING: DATA RACE
Write at 0x00c420076420 by goroutine 7:
_/Users/rsc/go/src/cmd/go/testdata/src/testrace.TestRace.func1()
/Users/rsc/go/src/cmd/go/testdata/src/testrace/race_test.go:10 +0x3b
Previous write at 0x00c420076420 by goroutine 6:
_/Users/rsc/go/src/cmd/go/testdata/src/testrace.TestRace()
/Users/rsc/go/src/cmd/go/testdata/src/testrace/race_test.go:13 +0xcc
testing.tRunner()
/Users/rsc/go/src/testing/testing.go:656 +0x104
$ go test -race -v -run TestRace
=== RUN TestRace
==================
WARNING: DATA RACE
Write at 0x00c420076420 by goroutine 7:
_/Users/rsc/go/src/cmd/go/testdata/src/testrace.TestRace.func1()
/Users/rsc/go/src/cmd/go/testdata/src/testrace/race_test.go:10 +0x3b
Previous write at 0x00c420076420 by goroutine 6:
_/Users/rsc/go/src/cmd/go/testdata/src/testrace.TestRace()
/Users/rsc/go/src/cmd/go/testdata/src/testrace/race_test.go:13 +0xcc
testing.tRunner()
/Users/rsc/go/src/testing/testing.go:656 +0x104
Dan Harrington [Tue, 25 Oct 2016 19:51:39 +0000 (12:51 -0700)]
net/http: support If-Match in ServeContent
- Added support for If-Match and If-Unmodified-Since.
- Precondition checks now more strictly follow RFC 7232 section 6, which
affects precedence when multiple condition headers are present.
- When serving a 304, Last-Modified header is now removed when no ETag is
present (as suggested by RFC 7232 section 4.1).
- If-None-Match supports multiple ETags.
- ETag comparison now correctly handles weak ETags.
David Chase [Thu, 3 Nov 2016 15:50:14 +0000 (11:50 -0400)]
runtime/cgo: correct type declaration for Windows
Newer versions of gcc notice a type mismatch and complain.
Fix code to match documented signature in MSDN.
Trybots say this still compiles with the older (5.1) version
of gcc.
Fixes #17771.
Change-Id: Ib3fe6f71b40751e1146249e31232da5ac69b9e00
Reviewed-on: https://go-review.googlesource.com/32646
Run-TryBot: David Chase <drchase@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Russ Cox [Wed, 2 Nov 2016 23:41:01 +0000 (19:41 -0400)]
cmd/cgo: add #line directives to avoid printing bogus references to Go source files
A bit contrived to come up with an example, but it happened in #15836, somehow.
$ cat /tmp/x.go
package main
/*
#include <stddef.h>
int foo(void);
int foo(void) {
return 2;
}
#define int asdf
*/
import "C"
func main() {
println(C.foo())
}
$ go run /tmp/x.go
# command-line-arguments
cgo-builtin-prolog:9:31: error: unknown type name 'asdf' <<<<<
_GoString_ GoStringN(char *p, int l);
^
/tmp/x.go:12:13: note: expanded from macro 'int'
#define int asdf
^
cgo-builtin-prolog:10:28: error: unknown type name 'asdf' <<<<<
_GoBytes_ GoBytes(void *p, int n);
^
/tmp/x.go:12:13: note: expanded from macro 'int'
#define int asdf
^
2 errors generated.
The two marked lines used to refer incorrectly to /tmp/x.go.
Fixes #15836.
Change-Id: I08ef60a53cfd148112fceb651eaf7b75d94a7a8d
Reviewed-on: https://go-review.googlesource.com/32613
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Russ Cox [Thu, 3 Nov 2016 00:18:47 +0000 (20:18 -0400)]
cmd/cover: change covered block for switch/select case to exclude expression
Consider a switch like
switch x {
case foo:
f()
g()
}
Before, the coverage annotation for the block calling f and g included
in its position span the text for 'case foo:'. This looks nice in the coverage
report, but it breaks the invariant that coverage blocks are disjoint if
you have a more complex expression like:
switch x {
case func() int { return foo }():
f()
g()
}
Then the coverage analysis wants to annotate the func literal body,
which overlaps with the case body, because the case body is considered
to begin at the case token.
Change the annotation for a case body to start just after the colon of
the case clause, avoiding any potential conflict with complex case
expressions. Could have started at the colon instead, but it seemed
less weird to start just after it.
Russ Cox [Thu, 3 Nov 2016 01:52:27 +0000 (21:52 -0400)]
cmd/go: fix TestGoGetDashTIssue8181
The test case was importing golang.org/x/build/cmd/cl,
which is a package main and cannot be imported.
The test case (stored in a separate repo) has been changed
to import golang.org/x/build/gerrit. Update the test accordingly.
Fixes #17702.
Change-Id: I80e150092111b5a04bb00c992b32edb271edb086
Reviewed-on: https://go-review.googlesource.com/32616
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Quentin Smith [Wed, 2 Nov 2016 20:18:22 +0000 (16:18 -0400)]
runtime/testdata/testprog: increase GCFairness2 timeout to 1s
OpenBSD's scheduler causes preemption to take 20+ms, so 30ms is not
enough time for 3 goroutines to run. This change continues to sleep for
30ms, but if it finds that the 3 goroutines have not run, it sleeps for
an additional 1s before declaring failure.
Updates #17712
Change-Id: I3e886e40d05192b7cb71b4f242af195836ef62a8
Reviewed-on: https://go-review.googlesource.com/32634 Reviewed-by: Rick Hudson <rlh@golang.org>
Run-TryBot: Quentin Smith <quentin@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>