1
0
mirror of https://github.com/golang/go synced 2024-10-04 11:21:21 -06:00
Commit Graph

83 Commits

Author SHA1 Message Date
Hiroshi Ioka
9be2a279ee internal/testenv: make MustHaveSymlink message friendly
Change-Id: If6e12ebc41152bc0534d3d383df80e960efe97f0
Reviewed-on: https://go-review.googlesource.com/27577
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-24 05:08:52 +00:00
Alex Brainman
af9342ca10 syscall, internal/syscall/windows, internal/syscall/windows/registry: make go generate work on every os
Fixes #16368

Change-Id: I2ef7a2deb5798e11cc1d3f8ca29a6e1655155422
Reviewed-on: https://go-review.googlesource.com/27411
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-24 00:52:32 +00:00
Hiroshi Ioka
8a9b96ace4 internal/testenv: add HasSymlink/MustHaveSymlink
os package and path/filepath package have duplicated code for
checking symlink supports in test code.
This CL tries to simplify such test code.

Change-Id: I0371488337f5e951eca699852daab9ccb16ddd62
Reviewed-on: https://go-review.googlesource.com/27331
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-23 05:35:06 +00:00
Dmitry Vyukov
a50f9859bd internal/trace: fix analysis of EvGoWaiting/EvGoInSyscall events
When tracing is started in the middle of program execution,
we already have a number of runnable goroutines and a number
of blocked/in syscall goroutines. In order to reflect these
goroutines in the trace, we emit EvGoCreate for all existing
goroutines. Then for blocked/in syscall goroutines we additionally
emit EvGoWaiting/EvGoInSyscall events. These events don't reset g.ev
during trace analysis. So next EvGoStart finds g.ev set to the
previous EvGoCreate. As the result time between EvGoCreate and
EvGoStart is accounted as scheduler latency. While in reality
it is blocking/syscall time.

Properly reset g.ev for EvGoWaiting/EvGoInSyscall events.

Change-Id: I0615ba31ed7567600a0667ebb27458481da73adb
Reviewed-on: https://go-review.googlesource.com/25572
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-08-19 19:22:17 +00:00
Hana Kim
c3818e56d0 internal/trace: err if binary is not supplied for old trace
Change-Id: Id25c90993c4cbb7449d7031301b6d214a67d7633
Reviewed-on: https://go-review.googlesource.com/24134
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-16 16:22:03 +00:00
Tom Bergan
19619c21c3 net, net/http: don't trace DNS dials
This fixes change https://go-review.googlesource.com/#/c/23069/, which
assumes all DNS requests are UDP. This is not true -- DNS requests can
be TCP in some cases. See:
https://tip.golang.org/src/net/dnsclient_unix.go#L154
https://en.wikipedia.org/wiki/Domain_Name_System#Protocol_transport

Also, the test code added by the above change doesn't actually test
anything because the test uses a faked DNS resolver that doesn't
actually make any DNS queries. I fixed that by adding another test
that uses the system DNS resolver.

Updates #12580

Change-Id: I6c24c03ebab84d437d3ac610fd6eb5353753c490
Reviewed-on: https://go-review.googlesource.com/23101
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-14 00:14:25 +00:00
Brad Fitzpatrick
15f2d0e452 net, net/http: don't trace UDP dials
The httptrace.ConnectStart and ConnectDone hooks are just about the
post-DNS connection to the host. We were accidentally also firing on
the UDP dials to DNS. Exclude those for now. We can add them back
later as separate hooks if desired. (but they'd only work for pure Go
DNS)

This wasn't noticed earlier because I was developing on a Mac at the
time, which always uses cgo for DNS. When running other tests on
Linux, I started seeing UDP dials.

Updates #12580

Change-Id: I2b2403f2483e227308fe008019f1100f6300250b
Reviewed-on: https://go-review.googlesource.com/23069
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-13 01:19:05 +00:00
Alex Brainman
81b70f3751 syscall: make mksyscall_windows.go -systemdll flag true by default
Updates #15167

Change-Id: I826f67e75011ba79325a1294ac0d70d7c6a3e32f
Reviewed-on: https://go-review.googlesource.com/23022
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-12 03:15:06 +00:00
Alex Brainman
0efc16284b syscall: remove mksyscall_windows.go -xsys flag
Also run "go generate" in
internal/syscall/windows and internal/syscall/windows/registry

Updates #15167

Change-Id: I0109226962f81857fe11d308b869d561ea8ed9f9
Reviewed-on: https://go-review.googlesource.com/23021
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-05-11 05:59:24 +00:00
Brad Fitzpatrick
1ff57143af net: ignore network failures on some builders
We run the external network tests on builders, but some of our
builders have less-than-ideal DNS connectivity. This change continues
to run the tests on all builders, but marks certain builders as flaky
(network-wise), and only validates their DNS results if they got DNS
results.

Change-Id: I826dc2a6f6da55add89ae9c6db892b3b2f7b526b
Reviewed-on: https://go-review.googlesource.com/22852
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-06 17:24:09 +00:00
Brad Fitzpatrick
1518d43132 net/http, net/http/httptrace: new package for tracing HTTP client requests
Updates #12580

Change-Id: I9f9578148ef2b48dffede1007317032d39f6af55
Reviewed-on: https://go-review.googlesource.com/22191
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tom Bergan <tombergan@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-28 20:56:38 +00:00
Dmitry Vyukov
c4c182140a internal/trace: fix event ordering for coarse timestamps
Arm arch uses coarse-grained kernel timer as cputicks.
As the result sort.Sort smashes trace entirely. Use sort.Stable instead.

Change-Id: Idfa017a86a489be58cf239f7fe56d7f4b66b52a9
Reviewed-on: https://go-review.googlesource.com/22317
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2016-04-24 16:50:25 +00:00
Dmitry Vyukov
75b844f0d2 runtime/trace: test detection of broken timestamps
On some processors cputicks (used to generate trace timestamps)
produce non-monotonic timestamps. It is important that the parser
distinguishes logically inconsistent traces (e.g. missing, excessive
or misordered events) from broken timestamps. The former is a bug
in tracer, the latter is a machine issue.

Test that (1) parser does not return a logical error in case of
broken timestamps and (2) broken timestamps are eventually detected
and reported.

Change-Id: Ib4b1eb43ce128b268e754400ed8b5e8def04bd78
Reviewed-on: https://go-review.googlesource.com/21608
Reviewed-by: Austin Clements <austin@google.com>
2016-04-24 09:11:37 +00:00
Dmitry Vyukov
a3703618ea runtime: use per-goroutine sequence numbers in tracer
Currently tracer uses global sequencer and it introduces
significant slowdown on parallel machines (up to 10x).
Replace the global sequencer with per-goroutine sequencer.

If we assign per-goroutine sequence numbers to only 3 types
of events (start, unblock and syscall exit), it is enough to
restore consistent partial ordering of all events. Even these
events don't need sequence numbers all the time (if goroutine
starts on the same P where it was unblocked, then start does
not need sequence number).
The burden of restoring the order is put on trace parser.
Details of the algorithm are described in the comments.

On http benchmark with GOMAXPROCS=48:
no tracing: 5026 ns/op
tracing: 27803 ns/op (+453%)
with this change: 6369 ns/op (+26%, mostly for traceback)

Also trace size is reduced by ~22%. Average event size before: 4.63
bytes/event, after: 3.62 bytes/event.

Besides running trace tests, I've also tested with manually broken
cputicks (random skew for each event, per-P skew and episodic random skew).
In all cases broken timestamps were detected and no test failures.

Change-Id: I078bde421ccc386a66f6c2051ab207bcd5613efa
Reviewed-on: https://go-review.googlesource.com/21512
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-23 15:57:05 +00:00
Dmitry Vyukov
2d342fba78 runtime: fix description of trace events
Change-Id: I037101b1921fe151695d32e9874b50dd64982298
Reviewed-on: https://go-review.googlesource.com/22314
Reviewed-by: Austin Clements <austin@google.com>
2016-04-22 21:32:37 +00:00
Dmitry Vyukov
944a0859b9 internal/trace: fix int overflow in timestamps
Fixes #15102

Change-Id: I7fdb6464afd0b7af9b6652051416f0fddd34dc9a
Reviewed-on: https://go-review.googlesource.com/21730
Reviewed-by: Austin Clements <austin@google.com>
2016-04-12 07:25:11 +00:00
Dmitry Vyukov
3fafe2e888 internal/trace: support parsing of 1.5 traces
1. Parse out version from trace header.
2. Restore handling of 1.5 traces.
3. Restore optional symbolization of traces.
4. Add some canned 1.5 traces for regression testing
   (http benchmark trace, runtime/trace stress traces,
    plus one with broken timestamps).

Change-Id: Idb18a001d03ded8e13c2730eeeb37c5836e31256
Reviewed-on: https://go-review.googlesource.com/21803
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2016-04-11 17:56:44 +00:00
Dmitry Vyukov
527ffebb2c internal/trace: fix a typo in error message
Change-Id: Id79eaa6d49dae80c334c7243b0a5bbcdcb9397d3
Reviewed-on: https://go-review.googlesource.com/21758
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2016-04-10 14:39:59 +00:00
Dmitry Vyukov
0fb7b4cccd runtime: emit file:line info into traces
This makes traces self-contained and simplifies trace workflow
in modern cloud environments where it is simpler to reach
a service via HTTP than to obtain the binary.

Change-Id: I6ff3ca694dc698270f1e29da37d5efaf4e843a0d
Reviewed-on: https://go-review.googlesource.com/21732
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-04-08 20:52:30 +00:00
Brad Fitzpatrick
2cefd12a1b net, runtime: skip flaky tests on OpenBSD
Flaky tests are a distraction and cover up real problems.

File bugs instead and mark them as flaky.

This moves the net/http flaky test flagging mechanism to internal/testenv.

Updates #15156
Updates #15157
Updates #15158

Change-Id: I0e561cd2a09c0dec369cd4ed93bc5a2b40233dfe
Reviewed-on: https://go-review.googlesource.com/21614
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-06 19:28:24 +00:00
Brad Fitzpatrick
683448a304 runtime, syscall: only search for Windows DLLs in the System32 directory
Make sure that for any DLL that Go uses itself, we only look for the
DLL in the Windows System32 directory, guarding against DLL preloading
attacks.

(Unless the Windows version is ancient and LoadLibraryEx is
unavailable, in which case the user probably has bigger security
problems anyway.)

This does not change the behavior of syscall.LoadLibrary or NewLazyDLL
if the DLL name is something unused by Go itself.

This change also intentionally does not add any new API surface. Instead,
x/sys is updated with a LoadLibraryEx function and LazyDLL.Flags in:
    https://golang.org/cl/21388

Updates #14959

Change-Id: I8d29200559cc19edf8dcf41dbdd39a389cd6aeb9
Reviewed-on: https://go-review.googlesource.com/21140
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-01 22:55:36 +00:00
Dominik Honnef
1cb3044c9f all: use bytes.Equal, bytes.Contains and strings.Contains
Change-Id: Iba82a5bd3846f7ab038cc10ec72ff6bcd2c0b484
Reviewed-on: https://go-review.googlesource.com/21377
Run-TryBot: Dave Cheney <dave@cheney.net>
Reviewed-by: Dave Cheney <dave@cheney.net>
2016-04-01 02:05:01 +00:00
Brad Fitzpatrick
ca72f5f5df internal/testenv: prefer to find go binary in GOROOT
Partial revert of https://golang.org/cl/20967 which
I can't reproduce and actually breaks me more.

Fixes #14901

Change-Id: I8cce443fbd95f5f6f2a5b6a4b9f2faab36167a12
Reviewed-on: https://go-review.googlesource.com/21292
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-03-30 19:12:50 +00:00
Brad Fitzpatrick
0104a31b8f vendor: move golang.org/x/net/http2/hpack back to vendor
Updates #14047

Change-Id: I7e314e2c7e3e8da18ab023729740fbc9ea3f661e
Reviewed-on: https://go-review.googlesource.com/21063
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-03-24 20:26:51 +00:00
Dominik Honnef
77f4b773e7 encoding/json, internal/testenv: use Fatalf
Change-Id: I64dd09e76d811000a914776fdad47808e3895690
Reviewed-on: https://go-review.googlesource.com/20989
Reviewed-by: Dave Cheney <dave@cheney.net>
2016-03-22 05:58:27 +00:00
Michael Munday
5f0935b7d4 internal/syscall/unix: add randomTrap const for s390x
Change-Id: I81376f524e76db25fd52cc5bec2c80fbf618a0c5
Reviewed-on: https://go-review.googlesource.com/20877
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-22 04:25:34 +00:00
David Crawshaw
d37d3bdcfc net/http, internal/testenv: find go binary in PATH
Fixes #14901

Change-Id: Ia32e09767374a341c9a36c5d977d47d7d1a82315
Reviewed-on: https://go-review.googlesource.com/20967
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
2016-03-22 02:02:23 +00:00
Brad Fitzpatrick
f226e886c2 internal/syscall/unix: document randomTrap
Updates #10848

Change-Id: I8353100ed01cb0e8fc19225157f5709bae388612
Reviewed-on: https://go-review.googlesource.com/20975
Reviewed-by: Rob Pike <r@golang.org>
2016-03-21 08:36:38 +00:00
Brad Fitzpatrick
519474451a all: make copyright headers consistent with one space after period
This is a subset of https://golang.org/cl/20022 with only the copyright
header lines, so the next CL will be smaller and more reviewable.

Go policy has been single space after periods in comments for some time.

The copyright header template at:

    https://golang.org/doc/contribute.html#copyright

also uses a single space.

Make them all consistent.

Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0
Reviewed-on: https://go-review.googlesource.com/20111
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-01 23:34:33 +00:00
Michael McConville
ddfe7b3dc0 crypto/rand: use the getentropy syscall on OpenBSD
Go already supports Linux's getrandom, which is a slightly modified
version of getentropy.

getentropy was added in OpenBSD 5.6. All supported versions of OpenBSD
include it so, unlike with Linux and getrandom, we don't need to test
for its presence.

Fixes #13785.

Change-Id: Ib536b96675f257cd8c5de1e3a36165e15c9abac9
Reviewed-on: https://go-review.googlesource.com/18219
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-02-26 19:58:09 +00:00
Martin Möhrmann
fdd0179bb1 all: fix typos and spelling
Change-Id: Icd06d99c42b8299fd931c7da821e1f418684d913
Reviewed-on: https://go-review.googlesource.com/19829
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-02-24 18:42:29 +00:00
Brad Fitzpatrick
e8e1928bd2 net/http: update http2 to check header values, move from vendor to internal
Updates x/net/http2 to git rev b2ed34f for https://golang.org/cl/18727

Updates #14029 (fixes it enough for Go 1.6)
Fixes #13961

Change-Id: Id301247545507671f4e79df0e7c6ec9c421d5a7c
Reviewed-on: https://go-review.googlesource.com/18728
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-21 00:19:02 +00:00
Alex Brainman
d75acd67ec internal/syscall/windows: correct GetACP and MultiByteToWideChar
CL 4310 introduced these functions, but their
implementation does not match with their published
documentation. Correct the implementation.

Change-Id: I285e41f9c7c5fc4e550ff59b0adb8b2bcbf6737a
Reviewed-on: https://go-review.googlesource.com/17997
Reviewed-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-08 16:15:59 +00:00
Alex Brainman
a8f8d550e8 internal/syscall/windows/registry: adjust TestGetMUIStringValue
Do not check DaylightName if DynamicDaylightTimeDisabled is false.

Fixes #13502

Change-Id: I03e01ec0afdeb0037a5d3ee243674e5a6b559da5
Reviewed-on: https://go-review.googlesource.com/17998
Reviewed-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-06 16:13:50 +00:00
mattn
7a48117899 os,internal/syscall/windows: use ReadFile/MultiByteToWideChar to read from console
Fixes #6303

Change-Id: Ib2cd15ac6106ef8e6b975943db8efc8d8ab21052
Reviewed-on: https://go-review.googlesource.com/4310
Reviewed-by: Russ Cox <rsc@golang.org>
2015-12-17 16:23:39 +00:00
Mikio Hara
e05b48e22c net, internal/syscall/windows: fix interface and address identification on windows
The current implementation including Go 1.5 through 1.5.2 misuses
Windows API and mishandles the returned values from GetAdapterAddresses
on Windows. This change fixes various issues related to network facility
information by readjusting interface and interface address parsers.

Updates #5395.
Updates #10530.
Updates #12301.
Updates #12551.
Updates #13542.
Fixes #12691.
Fixes #12811.
Fixes #13476.
Fixes #13544.

Also fixes fragile screen scraping test cases in net_windows_test.go.

Additional information for reviewers:

It seems like almost all the issues above have the same root cause and
it is misunderstanding of Windows API. If my interpretation of the
information on MSDN is correctly, current implementation contains the
following bugs:

- SIO_GET_INTERFACE_LIST should not be used for IPv6. The behavior of
  SIO_GET_INTERFACE_LIST is different on kernels and probably it doesn't
  work correctly for IPv6 on old kernels such as Windows XP w/ SP2.
  Unfortunately MSDN doesn't describe the detail of
  SIO_GET_INTERFACE_LIST, but information on the net suggests so.

- Fetching IP_ADAPTER_ADDRESSES structures with fixed size area may not
  work when using IPv6. IPv6 generates ton of interface addresses for
  various addressing scopes. We need to adjust the area appropriately.

- PhysicalAddress field of IP_ADAPTER_ADDRESSES structure may have extra
  space. We cannot ignore PhysicalAddressLength field of
  IP_ADAPTER_ADDRESS structure.

- Flags field of IP_ADAPTER_ADDRESSES structure doesn't represent any of
  administratively and operatinal statuses. It just represents settings
  for windows network adapter.

- MTU field of IP_ADAPTER_ADDRESSES structure may have a uint32(-1) on
  64-bit platform. We need to convert the value to interger
  appropriately.

- IfType field of IP_ADAPTER_ADDRESSES structure is not a bit field.
  Bitwire operation for the field is completely wrong.

- OperStatus field of IP_ADAPTER_ADDRESSES structure is not a bit field.
  Bitwire operation for the field is completely wrong.

- IPv6IfIndex field of IP_ADAPTER_ADDRESSES structure is just a
  substitute for IfIndex field. We cannot prefer IPv6IfIndex to IfIndex.

- Windows XP, 2003 server and below don't set OnLinkPrefixLength field
  of IP_ADAPTER_UNICAST_ADDRESS structure. We cannot rely on the field
  on old kernels. We can use FirstPrefix field of IP_ADAPTER_ADDRESSES
  structure and IP_ADAPTER_PREFIX structure instead.

- Length field of IP_ADAPTER_{UNICAST,ANYCAST,MULTICAST}_ADDRESS
  sturecures doesn't represent an address prefix length. It just
  represents a socket address length.

Change-Id: Icabdaf7bd1d41360a981d2dad0b830b02b584528
Reviewed-on: https://go-review.googlesource.com/17412
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-12-10 08:04:07 +00:00
Dmitry Vyukov
7b767f4e52 internal/race: add package
Factor out duplicated race thunks from sync, syscall net
and fmt packages into a separate package and use it.

Fixes #8593

Change-Id: I156869c50946277809f6b509463752e7f7d28cdb
Reviewed-on: https://go-review.googlesource.com/14870
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dmitry Vyukov <dvyukov@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-11-26 16:50:31 +00:00
Yao Zhang
7f762704e9 internal/syscall/unix: added support for linux/mips64{,le}
Change-Id: Ib6f168b6a2daf3befbf75b4b95967ff91ac95d12
Reviewed-on: https://go-review.googlesource.com/14456
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-11-12 04:51:12 +00:00
Matthew Dempsky
b16c699195 internal/syscall/unix: eliminate non-trivial randomTrap initializer
While here, enable getrandom on arm64 too (using the value found in
include/uapi/asm-generic/unistd.h, which seems to match up with other
GOARCH=arm64 syscall numbers).

Updates #10848.

Change-Id: I5ab36ccf6ee8d5cc6f0e1a61d09f0da7410288b9
Reviewed-on: https://go-review.googlesource.com/16662
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-11-05 00:09:59 +00:00
Robert Griesemer
a4fc3512ba go/format, cmd/gofmt: avoid dependency on internal package format
Fixes #11844.

Change-Id: I32edd39e79f7c9bdc132c49bd06081f35dac245d
Reviewed-on: https://go-review.googlesource.com/15114
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-09-30 16:32:47 +00:00
Didier Spezia
4f33436004 runtime,internal/trace: map/slice literals janitoring
Simplify slice/map literal expressions.
Caught with gofmt -d -s, fixed with gofmt -w -s
Checked that the result can still be compiled with Go 1.4.

Change-Id: I06bce110bb5f46ee2f45113681294475aa6968bc
Reviewed-on: https://go-review.googlesource.com/13839
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-09-11 14:03:43 +00:00
Alex Brainman
13e06d89c3 internal/syscall/windows/registry: do not panic when data is large
Allow registry blobs to be as large as 500MB

Update #12493

Change-Id: I1d0e5c10772d25f8e7e17fed6e2e7dd12ca4e7cf
Reviewed-on: https://go-review.googlesource.com/14287
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-04 04:47:26 +00:00
Daniel Johansson
12663b4627 registry: Explain how GetMUIStringValue works and where it falls short
GetMUIStringValue tries as a convenience to resolve string values even for pathless
resource DLLs by searching the system directory (one of several paths used
by the system's standard DLL search order algorithm). This would not be
needed if regLoadMUIString searched for pathless DLLs itself, but it
doesn't, instead it needs an absolute path, otherwise it will fail.

This approach works fine for solving issue #12015 (handle localized time
zone names; for which GetMUIStringValue was created) since tzres.dll that
is used to resolve localized time zone names has no path in the registry
but is located under the system directory.

However, this approach will fail if a pathless DLL is located somewhere
else than the system directory.

Because of this limitation GetMUIStringValue may have to be revised in the
future to allow for custom paths, possibly through another version of the
function.

See also:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724890%28v=vs.85%29.aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586%28v=vs.85%29.aspx

Change-Id: Ida66a0ef1928e0461ce248c795827902d785e6cd
Reviewed-on: https://go-review.googlesource.com/13929
Reviewed-by: Rob Pike <r@golang.org>
2015-08-28 05:41:29 +00:00
Daniel Johansson
cba1528ceb time: handle localized time zone names
The existing implementation fails to determine the correct time zone
abbreviations when the display language is non-English. This change adds
support for localized time zone names (standard- and daylightname)
by using the function RegLoadMUIString.

Fixes #12015

Change-Id: Ic0dc89c50993af8f292b199c20bc5932903e7e87
Reviewed-on: https://go-review.googlesource.com/13854
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-08-26 04:40:59 +00:00
Alex Brainman
cfb5bc993a internal/syscall/windows/registry: remove debugging dreg
Change-Id: I1b9f6ad322a7f68fa160c4f09d7fb56815e505a7
Reviewed-on: https://go-review.googlesource.com/13828
Reviewed-by: Rob Pike <r@golang.org>
2015-08-24 04:25:18 +00:00
Rob Pike
f62b749ae2 all: fix some vet-caught formatting errors, mostly but not only in tests
Could go in 1.5, although not critical.
See also #12107

Change-Id: I7f1608b58581d21df4db58f0db654fef79e33a90
Reviewed-on: https://go-review.googlesource.com/13481
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-08-21 05:37:36 +00:00
Russ Cox
7721ac0535 internal/testenv: add Builder, to report builder name
This works after golang.org/cl/13120 is running on the
coordinator (maybe it already is).

Change-Id: I4053d8e2f32fafd47b927203a6f66d5858e23376
Reviewed-on: https://go-review.googlesource.com/13165
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-08-05 16:13:25 +00:00
Russ Cox
ca6f7e45cb runtime/trace: report negative frequency as a time-ordering problem
This should fix the solaris/amd64 builder.

Change-Id: Idd6460cc9e842f7b874c9757379986aa723c974c
Reviewed-on: https://go-review.googlesource.com/12922
Reviewed-by: Austin Clements <austin@google.com>
2015-07-30 20:32:01 +00:00
Russ Cox
80c98fa901 runtime/trace: record event sequence numbers explicitly
Nearly all the flaky failures we've seen in trace tests have been
due to the use of time stamps to determine relative event ordering.
This is tricky for many reasons, including:
 - different cores might not have exactly synchronized clocks
 - VMs are worse than real hardware
 - non-x86 chips have different timer resolution than x86 chips
 - on fast systems two events can end up with the same time stamp

Stop trying to make time reliable. It's clearly not going to be for Go 1.5.
Instead, record an explicit event sequence number for ordering.
Using our own counter solves all of the above problems.

The trace still contains time stamps, of course. The sequence number
is just used for ordering.

Should alleviate #10554 somewhat. Then tickDiv can be chosen to
be a useful time unit instead of having to be exact for ordering.

Separating ordering and time stamps lets the trace parser diagnose
systems where the time stamp order and actual order do not match
for one reason or another. This CL adds that check to the end of
trace.Parse, after all other sequence order-based checking.
If that error is found, we skip the test instead of failing it.
Putting the check in trace.Parse means that cmd/trace will pick
up the same check, refusing to display a trace where the time stamps
do not match actual ordering.

Using net/http's BenchmarkClientServerParallel4 on various CPU counts,
not tracing vs tracing:

name                      old time/op    new time/op    delta
ClientServerParallel4       50.4µs ± 4%    80.2µs ± 4%  +59.06%        (p=0.000 n=10+10)
ClientServerParallel4-2     33.1µs ± 7%    57.8µs ± 5%  +74.53%        (p=0.000 n=10+10)
ClientServerParallel4-4     18.5µs ± 4%    32.6µs ± 3%  +75.77%        (p=0.000 n=10+10)
ClientServerParallel4-6     12.9µs ± 5%    24.4µs ± 2%  +89.33%        (p=0.000 n=10+10)
ClientServerParallel4-8     11.4µs ± 6%    21.0µs ± 3%  +83.40%        (p=0.000 n=10+10)
ClientServerParallel4-12    14.4µs ± 4%    23.8µs ± 4%  +65.67%        (p=0.000 n=10+10)

Fixes #10512.

Change-Id: I173eecf8191e86feefd728a5aad25bf1bc094b12
Reviewed-on: https://go-review.googlesource.com/12579
Reviewed-by: Austin Clements <austin@google.com>
2015-07-29 22:32:14 +00:00
Austin Clements
e3ba0977be internal/singleflight: deflake TestDoDupSuppress
Currently TestDoDupSuppress can fail if the goroutines created by its
loop run sequentially. This is rare, but it has caused failures on the
dashboard and in stress testing.

While I think there's no way to eliminate all possible thread
schedules that could make this test fail because it depends on waiting
until a Group.Do blocks, it is possible to make it much more robust.

This commit deflakes this test by forcing at least one invocation of
fn to start and all goroutines to reach the line just before the Do
call before allowing fn to proceed. fn then waits 10 milliseconds
before returning to allow the goroutines to pass through the Do.

With this change, in 50,000 runs of the stress testing configuration,
the number of calls to fn never even exceeded 1.

Fixes #11784.

Change-Id: Ie5adf5764545050ec407619769a656251c4cff04
Reviewed-on: https://go-review.googlesource.com/12681
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-26 20:35:09 +00:00