]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: check TestUsingVDSO ExitError type assertion
authorMichael Pratt <mpratt@google.com>
Wed, 23 Jul 2025 20:56:50 +0000 (16:56 -0400)
committerGopher Robot <gobot@golang.org>
Wed, 23 Jul 2025 21:21:16 +0000 (14:21 -0700)
Currently this test panics if the error is not an ExitError. We aren't
expecting other errors, but we want to continue to the t.Fatal so the
error contents actually get logged.

For #74672.

Change-Id: I6a6a636cee5ddac500ed7ec549340b02944101ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/689956
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Michael Pratt <mpratt@google.com>

src/runtime/vdso_test.go

index b0f5fbe72882a808733b52995affe3ef25f7bb35..cb70a040d65fb414eb64fbc34baa690df9675f23 100644 (file)
@@ -62,7 +62,7 @@ func TestUsingVDSO(t *testing.T) {
                t.Logf("%s", out)
        }
        if err != nil {
-               if err := err.(*exec.ExitError); err != nil && err.Sys().(syscall.WaitStatus).Signaled() {
+               if err, ok := err.(*exec.ExitError); ok && err.Sys().(syscall.WaitStatus).Signaled() {
                        if !bytes.Contains(out, []byte("+++ killed by")) {
                                // strace itself occasionally crashes.
                                // Here, it exited with a signal, but