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