aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/export_test.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2021-11-22 15:33:01 -0500
committerAustin Clements <austin@google.com>2021-11-29 19:45:58 +0000
commitf598e2962d3a358b59faa68471b6ed378fc68806 (patch)
tree796f6a3fddbb2b85db17bffa8ca68c663b73a5ab /src/runtime/export_test.go
parent61ff5019687c125910c48c22d672a9b6985ee61e (diff)
downloadgo-f598e2962d3a358b59faa68471b6ed378fc68806.tar.gz
go-f598e2962d3a358b59faa68471b6ed378fc68806.zip
runtime: fix preemption sensitivity in TestTinyAllocIssue37262
TestTinyAllocIssue37262 assumes that all of its allocations will come from the same tiny allocator (that is, the same P), and that nothing else will allocate from that tiny allocator while it's running. It can fail incorrectly if these assumptions aren't met. Fix this potential test flakiness by disabling preemption during this test. As far as I know, this has never happened on the builders. It was found by mayMoreStackPreempt. Change-Id: I59f993e0bdbf46a9add842d0e278415422c3f804 Reviewed-on: https://go-review.googlesource.com/c/go/+/366994 Trust: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/export_test.go')
-rw-r--r--src/runtime/export_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go
index b2e64f14ad..ef601f770c 100644
--- a/src/runtime/export_test.go
+++ b/src/runtime/export_test.go
@@ -1307,3 +1307,12 @@ func escape(x interface{}) interface{} {
escapeSink = nil
return x
}
+
+// Acquirem blocks preemption.
+func Acquirem() {
+ acquirem()
+}
+
+func Releasem() {
+ releasem(getg().m)
+}