diff options
| author | Michael Pratt <mpratt@google.com> | 2021-03-09 16:13:23 -0500 |
|---|---|---|
| committer | Michael Pratt <mpratt@google.com> | 2021-03-10 19:07:29 +0000 |
| commit | c41bf9ee81e26d0fc0aca858a3d96d96be29ccba (patch) | |
| tree | d3abc5b6ab1296f962c9aca089c750b3d31c7d2a /src/runtime/export_test.go | |
| parent | 5ce51ea74177513b473e2da05d0e4e9b7affb3c4 (diff) | |
| download | go-c41bf9ee81e26d0fc0aca858a3d96d96be29ccba.tar.xz | |
runtime: check partial lock ranking order
To ease readability we typically keep the partial order lists sorted by
rank. This isn't required for correctness, it just makes it (slightly)
easier to read the lists.
Currently we must notice out-of-order entries during code review, which
is an error-prone process.
Add a test to enforce ordering, and fix the errors that have crept in.
Most of the existing errors were misordered lockRankHchan or
lockRankPollDesc.
While we're here, I've moved the correctness check that the partial
ordering satisfies the total ordering from init to a test case. This
will allow us to catch these errors without even running
staticlockranking.
Change-Id: I9c11abe49ea26c556439822bb6a3183129600c3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/300171
Trust: Michael Pratt <mpratt@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Diffstat (limited to 'src/runtime/export_test.go')
| -rw-r--r-- | src/runtime/export_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index a48bb2636f..5a87024b8a 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -46,6 +46,14 @@ var NetpollGenericInit = netpollGenericInit var Memmove = memmove var MemclrNoHeapPointers = memclrNoHeapPointers +var LockPartialOrder = lockPartialOrder + +type LockRank lockRank + +func (l LockRank) String() string { + return lockRank(l).String() +} + const PreemptMSupported = preemptMSupported type LFNode struct { |
