ssh: print server exit reason in tests

This helps debugging protocol violations by the client

Change-Id: I8e5486b49515b719bbe3de44daa489fb7434875a
Reviewed-on: https://go-review.googlesource.com/c/crypto/+/171680
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Han-Wen Nienhuys 2019-04-11 11:35:10 +02:00
Родитель 9732e03de3
Коммит e7b772b700
1 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -35,7 +35,7 @@ func dial(handler serverType, t *testing.T) *Client {
} }
conf.AddHostKey(testSigners["rsa"]) conf.AddHostKey(testSigners["rsa"])
_, chans, reqs, err := NewServerConn(c1, &conf) conn, chans, reqs, err := NewServerConn(c1, &conf)
if err != nil { if err != nil {
t.Fatalf("Unable to handshake: %v", err) t.Fatalf("Unable to handshake: %v", err)
} }
@ -56,6 +56,9 @@ func dial(handler serverType, t *testing.T) *Client {
handler(ch, inReqs, t) handler(ch, inReqs, t)
}() }()
} }
if err := conn.Wait(); err != io.EOF {
t.Logf("server exit reason: %v", err)
}
}() }()
config := &ClientConfig{ config := &ClientConfig{
@ -358,10 +361,9 @@ func TestServerWindow(t *testing.T) {
} }
written, err := copyNRandomly("stdin", serverStdin, origBuf, windowTestBytes) written, err := copyNRandomly("stdin", serverStdin, origBuf, windowTestBytes)
if err != nil { if err != nil {
t.Fatalf("failed to copy origBuf to serverStdin: %v", err) t.Errorf("failed to copy origBuf to serverStdin: %v", err)
} } else if written != windowTestBytes {
if written != windowTestBytes { t.Errorf("Wrote only %d of %d bytes to server", written, windowTestBytes)
t.Fatalf("Wrote only %d of %d bytes to server", written, windowTestBytes)
} }
echoedBytes := <-result echoedBytes := <-result