aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2019-04-18 21:34:41 +0000
committerBrad Fitzpatrick <bradfitz@golang.org>2019-04-18 21:49:02 +0000
commitc8aaec2f70c5ccbca1ec2152c57d19981ac09133 (patch)
tree6683d9a00a725d3a88617aebc0a998ab790261ae /src/runtime
parent02bd0fd39cb6ffd840901ea751a61047ccad47cb (diff)
downloadgo-c8aaec2f70c5ccbca1ec2152c57d19981ac09133.tar.xz
runtime/trace: also treat plan9 as a low memory system
Fixes #31554 Updates #12032 (also originally about plan9, but later openbsd/arm) Change-Id: Ib9f35d27a2304f38bf271c38c0b9153d210d8f95 Reviewed-on: https://go-review.googlesource.com/c/go/+/172837 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: David du Colombier <0intro@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/trace/trace_test.go21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/runtime/trace/trace_test.go b/src/runtime/trace/trace_test.go
index fc81abc30f..e289fa5e12 100644
--- a/src/runtime/trace/trace_test.go
+++ b/src/runtime/trace/trace_test.go
@@ -237,7 +237,7 @@ func TestTraceStress(t *testing.T) {
runtime.GC()
// Trigger GC from malloc.
n := int(1e3)
- if runtime.GOOS == "openbsd" && runtime.GOARCH == "arm" {
+ if isMemoryConstrained() {
// Reduce allocation to avoid running out of
// memory on the builder - see issue/12032.
n = 512
@@ -322,6 +322,21 @@ func TestTraceStress(t *testing.T) {
testBrokenTimestamps(t, trace)
}
+// isMemoryConstrained reports whether the current machine is likely
+// to be memory constrained.
+// This was originally for the openbsd/arm builder (Issue 12032).
+// TODO: move this to testenv? Make this look at memory? Look at GO_BUILDER_NAME?
+func isMemoryConstrained() bool {
+ if runtime.GOOS == "plan9" {
+ return true
+ }
+ switch runtime.GOARCH {
+ case "arm", "mips", "mipsle":
+ return true
+ }
+ return false
+}
+
// Do a bunch of various stuff (timers, GC, network, etc) in a separate goroutine.
// And concurrently with all that start/stop trace 3 times.
func TestTraceStressStartStop(t *testing.T) {
@@ -381,9 +396,9 @@ func TestTraceStressStartStop(t *testing.T) {
runtime.GC()
// Trigger GC from malloc.
n := int(1e3)
- if runtime.GOOS == "openbsd" && runtime.GOARCH == "arm" {
+ if isMemoryConstrained() {
// Reduce allocation to avoid running out of
- // memory on the builder - see issue/12032.
+ // memory on the builder.
n = 512
}
for i := 0; i < n; i++ {