mirror of
https://github.com/golang/go.git
synced 2024-09-22 10:58:58 +00:00
runtime: avoid loop variable capture in test
In TestSegv, the t.Run closure captures the loop variable 'test'. Since the subtest calls t.Parallel, the parent test is allowed to keep running, changing the loop variable and thus changing the value of 'test' in the subtest. Change-Id: I021ddc50304de08a341e6ffe486aa54e573d3b94 Reviewed-on: https://go-review.googlesource.com/c/go/+/339911 Trust: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
181e8cde30
commit
b2c04f0d48
@ -591,6 +591,7 @@ func TestSegv(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, test := range []string{"Segv", "SegvInCgo"} {
|
||||
test := test
|
||||
t.Run(test, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
got := runTestProg(t, "testprogcgo", test)
|
||||
|
Loading…
Reference in New Issue
Block a user