Before: 8.9 seconds for go test -short
After: 2.8 seconds
There are still 250 tests without t.Parallel, but I got the important
onces using a script:
$ go test -short -v 2>&1 | go run ~/slowtests.go
Where slowtests.go is https://play.golang.org/p/9mh5Wg1nLN
The remaining 250 (the output lines from slowtests.go) all have a
reported duration of 0ms, except one 50ms test which has to be serial.
Where tests can't be parallel, I left a comment at the top saying why,
so people don't add t.Parallel later and get surprised at failures.
Updates #17751
Change-Id: Icbe32cbe2b996e23c89f1af6339287fa22af5115
Reviewed-on: https://go-review.googlesource.com/32684
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
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.
Updates #17773 (will be fixed more elsewhere)
Change-Id: I183570f7346917828a4b6f7f1773094122a30406
Reviewed-on: https://go-review.googlesource.com/32595
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Rebuild cmd/objdump once instead of twice.
Speeds up standalone 'go test cmd/objdump' on my
machine from ~1.4s to ~1s.
Updates #17751
Change-Id: I15fd79cf18c310f892bc28a9e9ca47ee010c989a
Reviewed-on: https://go-review.googlesource.com/32673
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Use a separate symbol for reflect metadata for types with Noalg set.
Fixes#17752.
Change-Id: Icb6cade7e3004fc4108f67df61105dc4085cd7e2
Reviewed-on: https://go-review.googlesource.com/32679
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
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>
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>
So that testing can use context in its public API.
For #16221.
Change-Id: I6263fa7266c336c9490f20164ce79336df44a57e
Reviewed-on: https://go-review.googlesource.com/32648
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
- 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.
Fixes#17572
Change-Id: I35039dea6811480ccf2889f8ed9c6a39ce34bfff
Reviewed-on: https://go-review.googlesource.com/32014
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
See https://go-review.googlesource.com/32581.
This makes x/tools/go/gcimporter15/bimport.go a close copy again
and the importer more robust.
Change-Id: If96ad6acd611878b7dfa6a13d005d847ece82ab6
Reviewed-on: https://go-review.googlesource.com/32647
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
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>
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>
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.
Fixes#16540.
Change-Id: I1fec4bc2a53c7092e649dc0d4be1680a697cb79b
Reviewed-on: https://go-review.googlesource.com/32612
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Clear it before any tests begin.
Clear it again after TestIsSecureGitAllowProtocol sets it.
Fixes#17700.
Change-Id: I6ea50d37f8222d8c7c9fee0b1eac3bbdfb5d133e
Reviewed-on: https://go-review.googlesource.com/32640
Reviewed-by: Quentin Smith <quentin@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
The goal of the test is to provoke a custom import path check error,
which will contain the current repo path, to see that it says ssh:// in it.
But the fix to #16471 made the test no longer provoke that error.
Provoke the error by checking out from rsc.io instead of github.com/rsc.
Fixes#17701.
Change-Id: I750ffda2ff59c2be8e111d26160997214a73fd9a
Reviewed-on: https://go-review.googlesource.com/32641
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This matches the removal of .so files and makes the processing
of '-L/path/to -lfoo' and plain '/path/to/foo.a' match.
Fixes#16463.
Change-Id: I1464c5390d7eb6a3a33b4b2c951f87ef392ec94a
Reviewed-on: https://go-review.googlesource.com/32642
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Cover-annotated cgo-rebuilt package for xtest was
not linked into package graph and so not being rebuilt.
Link into package graph.
Fixes#13625.
Change-Id: I685f7276f92bbc85fbc4b389111c83d9fe517637
Reviewed-on: https://go-review.googlesource.com/32614
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
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>
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>
Some of these whitelist entries could be
eliminated, e.g. by the addition of Go
declarations, but this is a start.
Change-Id: I2fb3234cf05ebc6b161aacac2d4c15d810d50527
Reviewed-on: https://go-review.googlesource.com/32671
Reviewed-by: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Follow-up to CL 32114
Change-Id: I75247ed9c1c0a0e8a278eb75a60d4c5bee355409
Reviewed-on: https://go-review.googlesource.com/32690
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The original go tool pprof (written in Perl) got this right.
The Go rewrite never has, but should.
Change-Id: Ie1fc571214c61b1b5654a0bc90e15eb889adf059
Reviewed-on: https://go-review.googlesource.com/32617
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The exported symbol for a plugin can be the only reference to a
type in a program. In particular, "var F func()" will have
the type *func(), which is uncommon.
Fixes#17140
Change-Id: Ide2104edbf087565f5377374057ae54e0c00c57e
Reviewed-on: https://go-review.googlesource.com/29692
Run-TryBot: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Since Dial(":80") was implemented on Plan 9 (CL 32593),
TestProtocolDialError is failing because dialing a port
superior to 65535 is supported on Plan 9.
This change disallows dialing and listening on ports
superior to 65535.
Fixes#17761.
Change-Id: I95e8a163eeacf1ccd8ece7b650f16a0531c59709
Reviewed-on: https://go-review.googlesource.com/32594
Reviewed-by: Russ Cox <rsc@golang.org>
CL 32101 fixed Dial(":80") on Windows and added TestDialLocal,
which was failing on Plan 9, because it wasn't implemented
on Plan 9.
This change implements Dial(":80") by connecting to 127.0.0.1
or ::1 (depending on network), so it works as documented.
Fixes#17760.
Change-Id: If0ff769299e09bebce11fc3708639c1d8c96c280
Reviewed-on: https://go-review.googlesource.com/32593
Reviewed-by: Russ Cox <rsc@golang.org>