Skip to content

Commit f162ad8

Browse files
chigotcbradfitz
chigotc
authored andcommitted
ssh/test: add port for aix/ppc64
Fixes golang/go#31413 Change-Id: I52105280a2237f23cd91b8ec92fd89cf62564572 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/171917 Reviewed-by: Brad Fitzpatrick <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent c05e17b commit f162ad8

7 files changed

+33
-11
lines changed

Diff for: ssh/test/agent_unix_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build darwin dragonfly freebsd linux netbsd openbsd
5+
// +build aix darwin dragonfly freebsd linux netbsd openbsd
66

77
package test
88

Diff for: ssh/test/banner_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build darwin dragonfly freebsd linux netbsd openbsd
5+
// +build aix darwin dragonfly freebsd linux netbsd openbsd
66

77
package test
88

Diff for: ssh/test/cert_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build darwin dragonfly freebsd linux netbsd openbsd
5+
// +build aix darwin dragonfly freebsd linux netbsd openbsd
66

77
package test
88

Diff for: ssh/test/dial_unix_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build !windows,!solaris,!aix,!js
5+
// +build !windows,!solaris,!js
66

77
package test
88

@@ -104,8 +104,8 @@ func (x *unixDialTester) TestServerConn(t *testing.T, c net.Conn) {
104104
if c.LocalAddr().String() != x.listenAddr {
105105
t.Fatalf("expected %q, got %q", x.listenAddr, c.LocalAddr().String())
106106
}
107-
if c.RemoteAddr().String() != "@" {
108-
t.Fatalf("expected \"@\", got %q", c.RemoteAddr().String())
107+
if c.RemoteAddr().String() != "@" && c.RemoteAddr().String() != "" {
108+
t.Fatalf("expected \"@\" or \"\", got %q", c.RemoteAddr().String())
109109
}
110110
}
111111

Diff for: ssh/test/forward_unix_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build darwin dragonfly freebsd linux netbsd openbsd
5+
// +build aix darwin dragonfly freebsd linux netbsd openbsd
66

77
package test
88

Diff for: ssh/test/session_test.go

+18-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build !windows,!solaris,!aix,!js
5+
// +build !windows,!solaris,!js
66

77
package test
88

@@ -13,6 +13,7 @@ import (
1313
"errors"
1414
"fmt"
1515
"io"
16+
"runtime"
1617
"strings"
1718
"testing"
1819

@@ -217,6 +218,11 @@ func TestKeyChange(t *testing.T) {
217218
}
218219

219220
func TestInvalidTerminalMode(t *testing.T) {
221+
if runtime.GOOS == "aix" {
222+
// On AIX, sshd cannot acquire /dev/pts/* if launched as
223+
// a non-root user.
224+
t.Skipf("skipping on %s", runtime.GOOS)
225+
}
220226
server := newServer(t)
221227
defer server.Shutdown()
222228
conn := server.Dial(clientConfig())
@@ -234,6 +240,11 @@ func TestInvalidTerminalMode(t *testing.T) {
234240
}
235241

236242
func TestValidTerminalMode(t *testing.T) {
243+
if runtime.GOOS == "aix" {
244+
// On AIX, sshd cannot acquire /dev/pts/* if launched as
245+
// a non-root user.
246+
t.Skipf("skipping on %s", runtime.GOOS)
247+
}
237248
server := newServer(t)
238249
defer server.Shutdown()
239250
conn := server.Dial(clientConfig())
@@ -278,6 +289,11 @@ func TestValidTerminalMode(t *testing.T) {
278289
}
279290

280291
func TestWindowChange(t *testing.T) {
292+
if runtime.GOOS == "aix" {
293+
// On AIX, sshd cannot acquire /dev/pts/* if launched as
294+
// a non-root user.
295+
t.Skipf("skipping on %s", runtime.GOOS)
296+
}
281297
server := newServer(t)
282298
defer server.Shutdown()
283299
conn := server.Dial(clientConfig())
@@ -351,7 +367,7 @@ func testOneCipher(t *testing.T, cipher string, cipherOrder []string) {
351367
t.Fatalf("NewSession: %v", err)
352368
}
353369

354-
out, err := session.Output(fmt.Sprintf("dd if=/dev/zero of=/dev/stdout bs=%d count=1", numBytes))
370+
out, err := session.Output(fmt.Sprintf("dd if=/dev/zero bs=%d count=1", numBytes))
355371
if err != nil {
356372
t.Fatalf("Output: %v", err)
357373
}

Diff for: ssh/test/test_unix_test.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build darwin dragonfly freebsd linux netbsd openbsd plan9
5+
// +build aix darwin dragonfly freebsd linux netbsd openbsd plan9
66

77
package test
88

@@ -306,7 +306,13 @@ func newServerForConfig(t *testing.T, config string, configVars map[string]strin
306306
if err != nil {
307307
t.Fatalf("user.Current: %v", err)
308308
}
309-
if u.Name == "root" {
309+
uname := u.Name
310+
if uname == "" {
311+
// Check the value of u.Username as u.Name
312+
// can be "" on some OSes like AIX.
313+
uname = u.Username
314+
}
315+
if uname == "root" {
310316
t.Skip("skipping test because current user is root")
311317
}
312318
dir, err := ioutil.TempDir("", "sshtest")

0 commit comments

Comments
 (0)