From 3fd5a3612ccd7907f26270fa92579a0f2f76f734 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 15 Apr 2019 13:43:13 +0200 Subject: [PATCH] unix: enable TestPassFD on AIX 7.2 TL >= 2 Follow CL 171339 and enable TestPassFD for AIX 7.2 TL >= 2 Change-Id: Icf781798a6f9fe99a57c23bc7f7e7c1361bdcec2 Reviewed-on: https://go-review.googlesource.com/c/sys/+/171941 Run-TryBot: Tobias Klauser TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- unix/syscall_unix_test.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/unix/syscall_unix_test.go b/unix/syscall_unix_test.go index 14d25ca7..0e6f1c7b 100644 --- a/unix/syscall_unix_test.go +++ b/unix/syscall_unix_test.go @@ -15,6 +15,7 @@ import ( "os/exec" "path/filepath" "runtime" + "strconv" "syscall" "testing" "time" @@ -167,8 +168,26 @@ func TestPassFD(t *testing.T) { if runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") { t.Skip("cannot exec subprocess on iOS, skipping test") } + if runtime.GOOS == "aix" { - t.Skip("getsockname issue on AIX 7.2 tl1, skipping test") + // Unix network isn't properly working on AIX + // 7.2 with Technical Level < 2 + out, err := exec.Command("oslevel", "-s").Output() + if err != nil { + t.Skipf("skipping on AIX because oslevel -s failed: %v", err) + } + + if len(out) < len("7200-XX-ZZ-YYMM") { // AIX 7.2, Tech Level XX, Service Pack ZZ, date YYMM + t.Skip("skipping on AIX because oslevel -s hasn't the right length") + } + aixVer := string(out[:4]) + tl, err := strconv.Atoi(string(out[5:7])) + if err != nil { + t.Skipf("skipping on AIX because oslevel -s output cannot be parsed: %v", err) + } + if aixVer < "7200" || (aixVer == "7200" && tl < 2) { + t.Skip("skipped on AIX versions previous to 7.2 TL 2") + } } if os.Getenv("GO_WANT_HELPER_PROCESS") == "1" {