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 <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Tobias Klauser
2019-04-15 13:43:13 +02:00
committed by Brad Fitzpatrick
parent 16da32be82
commit 3fd5a3612c

View File

@@ -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" {