diff --git a/ssh/test/agent_unix_test.go b/ssh/test/agent_unix_test.go index f481253..5d320d0 100644 --- a/ssh/test/agent_unix_test.go +++ b/ssh/test/agent_unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd linux netbsd openbsd +// +build aix darwin dragonfly freebsd linux netbsd openbsd package test diff --git a/ssh/test/banner_test.go b/ssh/test/banner_test.go index d3b21ac..c3f0a08 100644 --- a/ssh/test/banner_test.go +++ b/ssh/test/banner_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd linux netbsd openbsd +// +build aix darwin dragonfly freebsd linux netbsd openbsd package test diff --git a/ssh/test/cert_test.go b/ssh/test/cert_test.go index b231dd8..84ac31e 100644 --- a/ssh/test/cert_test.go +++ b/ssh/test/cert_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd linux netbsd openbsd +// +build aix darwin dragonfly freebsd linux netbsd openbsd package test diff --git a/ssh/test/dial_unix_test.go b/ssh/test/dial_unix_test.go index 20d6d56..8e1362c 100644 --- a/ssh/test/dial_unix_test.go +++ b/ssh/test/dial_unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!solaris,!aix,!js +// +build !windows,!solaris,!js package test @@ -104,8 +104,8 @@ func (x *unixDialTester) TestServerConn(t *testing.T, c net.Conn) { if c.LocalAddr().String() != x.listenAddr { t.Fatalf("expected %q, got %q", x.listenAddr, c.LocalAddr().String()) } - if c.RemoteAddr().String() != "@" { - t.Fatalf("expected \"@\", got %q", c.RemoteAddr().String()) + if c.RemoteAddr().String() != "@" && c.RemoteAddr().String() != "" { + t.Fatalf("expected \"@\" or \"\", got %q", c.RemoteAddr().String()) } } diff --git a/ssh/test/forward_unix_test.go b/ssh/test/forward_unix_test.go index ea81937..2f5669a 100644 --- a/ssh/test/forward_unix_test.go +++ b/ssh/test/forward_unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd linux netbsd openbsd +// +build aix darwin dragonfly freebsd linux netbsd openbsd package test diff --git a/ssh/test/session_test.go b/ssh/test/session_test.go index 1dac0d0..dcd2249 100644 --- a/ssh/test/session_test.go +++ b/ssh/test/session_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!solaris,!aix,!js +// +build !windows,!solaris,!js package test @@ -13,6 +13,7 @@ import ( "errors" "fmt" "io" + "runtime" "strings" "testing" @@ -217,6 +218,11 @@ func TestKeyChange(t *testing.T) { } func TestInvalidTerminalMode(t *testing.T) { + if runtime.GOOS == "aix" { + // On AIX, sshd cannot acquire /dev/pts/* if launched as + // a non-root user. + t.Skipf("skipping on %s", runtime.GOOS) + } server := newServer(t) defer server.Shutdown() conn := server.Dial(clientConfig()) @@ -234,6 +240,11 @@ func TestInvalidTerminalMode(t *testing.T) { } func TestValidTerminalMode(t *testing.T) { + if runtime.GOOS == "aix" { + // On AIX, sshd cannot acquire /dev/pts/* if launched as + // a non-root user. + t.Skipf("skipping on %s", runtime.GOOS) + } server := newServer(t) defer server.Shutdown() conn := server.Dial(clientConfig()) @@ -278,6 +289,11 @@ func TestValidTerminalMode(t *testing.T) { } func TestWindowChange(t *testing.T) { + if runtime.GOOS == "aix" { + // On AIX, sshd cannot acquire /dev/pts/* if launched as + // a non-root user. + t.Skipf("skipping on %s", runtime.GOOS) + } server := newServer(t) defer server.Shutdown() conn := server.Dial(clientConfig()) @@ -351,7 +367,7 @@ func testOneCipher(t *testing.T, cipher string, cipherOrder []string) { t.Fatalf("NewSession: %v", err) } - out, err := session.Output(fmt.Sprintf("dd if=/dev/zero of=/dev/stdout bs=%d count=1", numBytes)) + out, err := session.Output(fmt.Sprintf("dd if=/dev/zero bs=%d count=1", numBytes)) if err != nil { t.Fatalf("Output: %v", err) } diff --git a/ssh/test/test_unix_test.go b/ssh/test/test_unix_test.go index 2fbe880..cf62d42 100644 --- a/ssh/test/test_unix_test.go +++ b/ssh/test/test_unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd linux netbsd openbsd plan9 +// +build aix darwin dragonfly freebsd linux netbsd openbsd plan9 package test @@ -306,7 +306,13 @@ func newServerForConfig(t *testing.T, config string, configVars map[string]strin if err != nil { t.Fatalf("user.Current: %v", err) } - if u.Name == "root" { + uname := u.Name + if uname == "" { + // Check the value of u.Username as u.Name + // can be "" on some OSes like AIX. + uname = u.Username + } + if uname == "root" { t.Skip("skipping test because current user is root") } dir, err := ioutil.TempDir("", "sshtest")