]> Cypherpunks repositories - gostls13.git/commitdiff
all: fix tests for older versions of AIX 7.2
authorClément Chigot <clement.chigot@atos.net>
Fri, 2 Nov 2018 09:55:12 +0000 (10:55 +0100)
committerIan Lance Taylor <iant@golang.org>
Fri, 2 Nov 2018 13:44:27 +0000 (13:44 +0000)
This commit fixes tests which fail on some versions of AIX 7.2 due
to internal bugs.

getsockname isn't working properly with unix networks.

Timezone files aren't returning a correct output.

Change-Id: I4ff15683912be62ab86dfbeeb63b73513404d086
Reviewed-on: https://go-review.googlesource.com/c/146940
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/net/platform_test.go
src/time/zoneinfo_read.go

index 01c579bd8ebeb9c94d33aec336bb290f6edb2c2a..7e9ad70d19b28943d81952d289caa06f09c62daa 100644 (file)
@@ -7,7 +7,9 @@ package net
 import (
        "internal/testenv"
        "os"
+       "os/exec"
        "runtime"
+       "strconv"
        "strings"
        "testing"
 )
@@ -35,6 +37,16 @@ func testableNetwork(network string) bool {
                switch runtime.GOOS {
                case "android", "nacl", "plan9", "windows":
                        return false
+               case "aix":
+                       // Unix network isn't properly working on AIX 7.2 with Technical Level < 2
+                       out, err := exec.Command("oslevel", "-s").Output()
+                       if err != nil {
+                               return false
+                       }
+                       if tl, err := strconv.Atoi(string(out[5:7])); err != nil || tl < 2 {
+                               return false
+                       }
+                       return true
                }
                // iOS does not support unix, unixgram.
                if runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
index 15d6aab1dee2f696919f2018b2311bcb7ab40c6b..b495217c0686fdab7c466c26ca7063e0133ffba2 100644 (file)
@@ -11,6 +11,7 @@ package time
 
 import (
        "errors"
+       "runtime"
        "syscall"
 )
 
@@ -172,6 +173,14 @@ func LoadLocationFromTZData(name string, data []byte) (*Location, error) {
                        return nil, badData
                }
                zone[i].name = byteString(abbrev[b:])
+               if runtime.GOOS == "aix" && len(name) > 8 && (name[:8] == "Etc/GMT+" || name[:8] == "Etc/GMT-") {
+                       // There is a bug with AIX 7.2 TL 0 with files in Etc,
+                       // GMT+1 will return GMT-1 instead of GMT+1 or -01.
+                       if name != "Etc/GMT+0" {
+                               // GMT+0 is OK
+                               zone[i].name = name[4:]
+                       }
+               }
        }
 
        // Now the transition time info.