aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/runtime/trace/trace_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2019-09-06 18:12:46 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-09-06 18:12:46 +0000
commitaa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13 (patch)
tree7e63b06d1eec92beec6997c9d3ab47a5d6a835be /libgo/go/runtime/trace/trace_test.go
parent920ea3b8ba3164b61ac9490dfdfceb6936eda6dd (diff)
downloadgcc-aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13.zip
gcc-aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13.tar.gz
gcc-aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13.tar.bz2
libgo: update to Go 1.13beta1 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/193497 From-SVN: r275473
Diffstat (limited to 'libgo/go/runtime/trace/trace_test.go')
-rw-r--r--libgo/go/runtime/trace/trace_test.go25
1 files changed, 22 insertions, 3 deletions
diff --git a/libgo/go/runtime/trace/trace_test.go b/libgo/go/runtime/trace/trace_test.go
index fc81abc..235845d 100644
--- a/libgo/go/runtime/trace/trace_test.go
+++ b/libgo/go/runtime/trace/trace_test.go
@@ -186,6 +186,10 @@ func TestTraceStress(t *testing.T) {
if IsEnabled() {
t.Skip("skipping because -test.trace is set")
}
+ if testing.Short() {
+ t.Skip("skipping in -short mode")
+ }
+
var wg sync.WaitGroup
done := make(chan bool)
@@ -237,7 +241,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 +326,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 +400,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++ {