go.crypto/ssh: skip tests that start ssh-agent.
Also stops leaking /tmp/ directories. Fixes golang/go#8489. LGTM=dave, minux R=dave, minux, agl CC=golang-codereviews https://golang.org/cl/124010043
This commit is contained in:
committed by
Adam Langley
parent
3092f0d93b
commit
9e886ee4f2
@@ -11,13 +11,21 @@ import (
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"code.google.com/p/go.crypto/ssh"
|
||||
)
|
||||
|
||||
// startAgent executes ssh-agent, and returns a Agent interface to it.
|
||||
func startAgent(t *testing.T) (client Agent, socket string, cleanup func()) {
|
||||
if testing.Short() {
|
||||
// ssh-agent is not always available, and the key
|
||||
// types supported vary by platform.
|
||||
t.Skip("skipping test due to -short")
|
||||
}
|
||||
|
||||
bin, err := exec.LookPath("ssh-agent")
|
||||
if err != nil {
|
||||
t.Skip("could not find ssh-agent")
|
||||
@@ -66,6 +74,7 @@ func startAgent(t *testing.T) (client Agent, socket string, cleanup func()) {
|
||||
proc.Kill()
|
||||
}
|
||||
conn.Close()
|
||||
os.RemoveAll(filepath.Dir(socket))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user