aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2017-12-16 01:49:54 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2017-12-16 01:49:54 +0000
commitbe528ae9aa5a04611019c42f4d94fed7e4727dad (patch)
treefab1cf2de0b37122b65e594768c9975400a13a7d /libgo
parentfe6272cc446f327c8e72c0c99aebd69fe9672c21 (diff)
downloadgcc-be528ae9aa5a04611019c42f4d94fed7e4727dad.zip
gcc-be528ae9aa5a04611019c42f4d94fed7e4727dad.tar.gz
gcc-be528ae9aa5a04611019c42f4d94fed7e4727dad.tar.bz2
os: pass -s to hostname on AIX
Reviewed-on: https://go-review.googlesource.com/79375 From-SVN: r255738
Diffstat (limited to 'libgo')
-rw-r--r--libgo/go/os/os_test.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/libgo/go/os/os_test.go b/libgo/go/os/os_test.go
index 0f1617a..9033c4f 100644
--- a/libgo/go/os/os_test.go
+++ b/libgo/go/os/os_test.go
@@ -1440,7 +1440,7 @@ func TestOpenNoName(t *testing.T) {
}
}
-func runBinHostname(t *testing.T) string {
+func runBinHostname(t *testing.T, argv []string) string {
// Run /bin/hostname and collect output.
r, w, err := Pipe()
if err != nil {
@@ -1448,7 +1448,7 @@ func runBinHostname(t *testing.T) string {
}
defer r.Close()
const path = "/bin/hostname"
- p, err := StartProcess(path, []string{"hostname"}, &ProcAttr{Files: []*File{nil, w, Stderr}})
+ p, err := StartProcess(path, argv, &ProcAttr{Files: []*File{nil, w, Stderr}})
if err != nil {
if _, err := Stat(path); IsNotExist(err) {
t.Skipf("skipping test; test requires %s but it does not exist", path)
@@ -1514,7 +1514,13 @@ func TestHostname(t *testing.T) {
if err != nil {
t.Fatalf("%v", err)
}
- want := runBinHostname(t)
+
+ var want string
+ if runtime.GOOS == "aix" {
+ want = runBinHostname(t, []string{"hostname", "-s"})
+ } else {
+ want = runBinHostname(t, []string{"hostname"})
+ }
if hostname != want {
i := strings.Index(hostname, ".")
if i < 0 || hostname[0:i] != want {