From dbb6ec16ecef7a66638d8514be54b13660551b0a Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Fri, 5 Jan 2024 18:21:50 -0500 Subject: [PATCH] ssh/test: skip tests on darwin that fail on the darwin-amd64-longtest LUCI builder We don't yet understand why these tests fail, but the Apple sshd seems to have some non-trivial vendor patches, so it is plausibly a platform-specific bug in the test. Let's skip that failure mode on the whole platform until/unless someone has time to reproduce and investigate the failure. For golang/go#64959. Cq-Include-Trybots: luci.golang.try:x_crypto-gotip-darwin-amd64-longtest,x_crypto-gotip-linux-amd64-longtest,x_crypto-gotip-windows-amd64-longtest Change-Id: I9e43579469de3fe9329c093b5916bbed0edd3751 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/554077 Reviewed-by: Dmitri Shuralyov Reviewed-by: Dmitri Shuralyov Reviewed-by: Nicola Murino LUCI-TryBot-Result: Go LUCI Auto-Submit: Bryan Mills --- ssh/test/agent_unix_test.go | 1 + ssh/test/dial_unix_test.go | 1 + ssh/test/forward_unix_test.go | 10 ++++++++++ ssh/test/session_test.go | 17 +++++++++++++++++ 4 files changed, 29 insertions(+) diff --git a/ssh/test/agent_unix_test.go b/ssh/test/agent_unix_test.go index aeecaeb..a9c4893 100644 --- a/ssh/test/agent_unix_test.go +++ b/ssh/test/agent_unix_test.go @@ -34,6 +34,7 @@ func TestAgentForward(t *testing.T) { sess, err := conn.NewSession() if err != nil { + skipIfIssue64959(t, err) t.Fatalf("NewSession: %v", err) } if err := agent.RequestAgentForwarding(sess); err != nil { diff --git a/ssh/test/dial_unix_test.go b/ssh/test/dial_unix_test.go index 8ec8d50..7d6fb28 100644 --- a/ssh/test/dial_unix_test.go +++ b/ssh/test/dial_unix_test.go @@ -53,6 +53,7 @@ func testDial(t *testing.T, n, listenAddr string, x dialTester) { // on the opened connection. cancel() if err != nil { + skipIfIssue64959(t, err) t.Fatalf("Dial: %v", err) } x.TestClientConn(t, conn) diff --git a/ssh/test/forward_unix_test.go b/ssh/test/forward_unix_test.go index 611122b..e32d732 100644 --- a/ssh/test/forward_unix_test.go +++ b/ssh/test/forward_unix_test.go @@ -12,6 +12,7 @@ import ( "io" "math/rand" "net" + "runtime" "testing" "time" ) @@ -27,6 +28,9 @@ func testPortForward(t *testing.T, n, listenAddr string) { sshListener, err := conn.Listen(n, listenAddr) if err != nil { + if runtime.GOOS == "darwin" && err == io.EOF { + t.Skipf("skipping test broken on some versions of macOS; see https://go.dev/issue/64959") + } t.Fatal(err) } @@ -122,6 +126,9 @@ func testAcceptClose(t *testing.T, n, listenAddr string) { sshListener, err := conn.Listen(n, listenAddr) if err != nil { + if runtime.GOOS == "darwin" && err == io.EOF { + t.Skipf("skipping test broken on some versions of macOS; see https://go.dev/issue/64959") + } t.Fatal(err) } @@ -163,6 +170,9 @@ func testPortForwardConnectionClose(t *testing.T, n, listenAddr string) { sshListener, err := client.Listen(n, listenAddr) if err != nil { + if runtime.GOOS == "darwin" && err == io.EOF { + t.Skipf("skipping test broken on some versions of macOS; see https://go.dev/issue/64959") + } t.Fatal(err) } diff --git a/ssh/test/session_test.go b/ssh/test/session_test.go index 69c8b86..c128b2a 100644 --- a/ssh/test/session_test.go +++ b/ssh/test/session_test.go @@ -22,6 +22,13 @@ import ( "golang.org/x/crypto/ssh" ) +func skipIfIssue64959(t *testing.T, err error) { + if err != nil && runtime.GOOS == "darwin" && strings.Contains(err.Error(), "ssh: unexpected packet in response to channel open: ") { + t.Helper() + t.Skipf("skipping test broken on some versions of macOS; see https://go.dev/issue/64959") + } +} + func TestRunCommandSuccess(t *testing.T) { server := newServer(t) conn := server.Dial(clientConfig()) @@ -29,6 +36,7 @@ func TestRunCommandSuccess(t *testing.T) { session, err := conn.NewSession() if err != nil { + skipIfIssue64959(t, err) t.Fatalf("session failed: %v", err) } defer session.Close() @@ -66,6 +74,7 @@ func TestRunCommandStdin(t *testing.T) { session, err := conn.NewSession() if err != nil { + skipIfIssue64959(t, err) t.Fatalf("session failed: %v", err) } defer session.Close() @@ -88,6 +97,7 @@ func TestRunCommandStdinError(t *testing.T) { session, err := conn.NewSession() if err != nil { + skipIfIssue64959(t, err) t.Fatalf("session failed: %v", err) } defer session.Close() @@ -111,6 +121,7 @@ func TestRunCommandFailed(t *testing.T) { session, err := conn.NewSession() if err != nil { + skipIfIssue64959(t, err) t.Fatalf("session failed: %v", err) } defer session.Close() @@ -127,6 +138,7 @@ func TestRunCommandWeClosed(t *testing.T) { session, err := conn.NewSession() if err != nil { + skipIfIssue64959(t, err) t.Fatalf("session failed: %v", err) } err = session.Shell() @@ -146,6 +158,7 @@ func TestFuncLargeRead(t *testing.T) { session, err := conn.NewSession() if err != nil { + skipIfIssue64959(t, err) t.Fatalf("unable to create new session: %s", err) } @@ -182,6 +195,7 @@ func TestKeyChange(t *testing.T) { for i := 0; i < 4; i++ { session, err := conn.NewSession() if err != nil { + skipIfIssue64959(t, err) t.Fatalf("unable to create new session: %s", err) } @@ -223,6 +237,7 @@ func TestValidTerminalMode(t *testing.T) { session, err := conn.NewSession() if err != nil { + skipIfIssue64959(t, err) t.Fatalf("session failed: %v", err) } defer session.Close() @@ -287,6 +302,7 @@ func TestWindowChange(t *testing.T) { session, err := conn.NewSession() if err != nil { + skipIfIssue64959(t, err) t.Fatalf("session failed: %v", err) } defer session.Close() @@ -349,6 +365,7 @@ func testOneCipher(t *testing.T, cipher string, cipherOrder []string) { // Exercise receiving data from the server session, err := conn.NewSession() if err != nil { + skipIfIssue64959(t, err) t.Fatalf("NewSession: %v", err) }