From 01f1b4422c0687edd98ba322b0fe9fd8390e9eab Mon Sep 17 00:00:00 2001 From: ian Date: Sat, 16 Dec 2017 01:49:54 +0000 Subject: [PATCH] os: pass -s to hostname on AIX Reviewed-on: https://go-review.googlesource.com/79375 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255738 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/go/gofrontend/MERGE | 2 +- libgo/go/os/os_test.go | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 35a2d0a38d2..b54038f82e0 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -d1f90c9b77baca5c33a398ab844fb4440c6a5ee7 +97eb3f61cf1c2cc01b9db6ed20e39bc04573c207 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/os/os_test.go b/libgo/go/os/os_test.go index 0f1617ad5d0..9033c4fcdb5 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 { -- 2.11.4.GIT