Skip to content

Commit

Permalink
all: add new GOOS=illumos, split out of GOOS=solaris
Browse files Browse the repository at this point in the history
Like GOOS=android which implies the "linux" build tag, GOOS=illumos
implies the "solaris" build tag. This lets the existing ecosystem of
packages still work on illumos, but still permits packages to start
differentiating between solaris and illumos.

Fixes golang#20603

Change-Id: I8f4eabf1a66060538dca15d7658c1fbc6c826622
  • Loading branch information
Joshua M. Clulow committed Apr 29, 2019
1 parent 2b8cbc3 commit 9ee73d2
Show file tree
Hide file tree
Showing 56 changed files with 142 additions and 66 deletions.
2 changes: 1 addition & 1 deletion misc/cgo/test/sigaltstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import (

func testSigaltstack(t *testing.T) {
switch {
case runtime.GOOS == "solaris", runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64"):
case runtime.GOOS == "solaris", runtime.GOOS == "illumos", runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64"):
t.Skipf("switching signal stack not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
case runtime.GOOS == "darwin" && runtime.GOARCH == "386":
t.Skipf("sigaltstack fails on darwin/386")
Expand Down
2 changes: 1 addition & 1 deletion misc/cgo/testcarchive/carchive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func testMain(m *testing.M) int {
if GOARCH == "arm" || GOARCH == "arm64" {
libbase += "_shared"
}
case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris":
case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris", "illumos":
libbase += "_shared"
}
}
Expand Down
2 changes: 1 addition & 1 deletion misc/cgo/testcshared/cshared_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func testMain(m *testing.M) int {
if GOARCH == "arm" || GOARCH == "arm64" {
libgodir += "_shared"
}
case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris":
case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris", "illumos":
libgodir += "_shared"
}
cc = append(cc, "-I", filepath.Join("pkg", libgodir))
Expand Down
6 changes: 4 additions & 2 deletions src/cmd/dist/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ var okgoarch = []string{
var okgoos = []string{
"darwin",
"dragonfly",
"illumos",
"js",
"linux",
"android",
Expand Down Expand Up @@ -936,7 +937,7 @@ func matchtag(tag string) bool {
}
return !matchtag(tag[1:])
}
return tag == "gc" || tag == goos || tag == goarch || tag == "cmd_go_bootstrap" || tag == "go1.1" || (goos == "android" && tag == "linux")
return tag == "gc" || tag == goos || tag == goarch || tag == "cmd_go_bootstrap" || tag == "go1.1" || (goos == "android" && tag == "linux") || (goos == "illumos" && tag == "solaris")
}

// shouldbuild reports whether we should build this file.
Expand All @@ -950,7 +951,7 @@ func shouldbuild(file, dir string) bool {
name := filepath.Base(file)
excluded := func(list []string, ok string) bool {
for _, x := range list {
if x == ok || ok == "android" && x == "linux" {
if x == ok || (ok == "android" && x == "linux") || (ok == "illumos" && x == "solaris") {
continue
}
i := strings.Index(name, x)
Expand Down Expand Up @@ -1486,6 +1487,7 @@ var cgoEnabled = map[string]bool{
"freebsd/386": true,
"freebsd/amd64": true,
"freebsd/arm": true,
"illumos/amd64": true,
"linux/386": true,
"linux/amd64": true,
"linux/arm": true,
Expand Down
7 changes: 5 additions & 2 deletions src/cmd/dist/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ func main() {
if gohostarch == "" {
fatalf("$objtype is unset")
}
case "solaris":
// Even on 64-bit platform, solaris uname -m prints i86pc.
case "solaris", "illumos":
// Solaris and illumos systems have multi-arch userlands, and
// "uname -m" reports the machine hardware name; e.g.,
// "i86pc" on both 32- and 64-bit x86 systems. Check for the
// native (widest) instruction set on the running kernel:
out := run("", CheckExit, "isainfo", "-n")
if strings.Contains(out, "amd64") {
gohostarch = "amd64"
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/go/go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4133,7 +4133,7 @@ func TestCgoConsistentResults(t *testing.T) {
t.Skip("skipping because cgo not enabled")
}
switch runtime.GOOS {
case "solaris":
case "solaris", "illumos":
testenv.SkipFlaky(t, 13247)
}

Expand Down
4 changes: 3 additions & 1 deletion src/cmd/go/internal/bug/bug.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ func printOSDetails(w io.Writer) {
printGlibcVersion(w)
case "openbsd", "netbsd", "freebsd", "dragonfly":
printCmdOut(w, "uname -v: ", "uname", "-v")
case "solaris":
case "illumos", "solaris":
// Be sure to use the OS-supplied uname, in "/usr/bin":
printCmdOut(w, "uname -srv: ", "/usr/bin/uname", "-srv")
out, err := ioutil.ReadFile("/etc/release")
if err == nil {
fmt.Fprintf(w, "/etc/release: %s\n", out)
Expand Down
1 change: 1 addition & 0 deletions src/cmd/go/internal/imports/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ var KnownOS = map[string]bool{
"dragonfly": true,
"freebsd": true,
"hurd": true,
"illumos": true,
"js": true,
"linux": true,
"nacl": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,24 +159,27 @@ func TestRLockExcludesOnlyLock(t *testing.T) {
f2 := mustOpen(t, f.Name())
defer f2.Close()

if runtime.GOOS == "solaris" || runtime.GOOS == "aix" {
doUnlockTF := false
switch runtime.GOOS {
case "aix", "illumos", "solaris":
// When using POSIX locks (as on Solaris), we can't safely read-lock the
// same inode through two different descriptors at the same time: when the
// first descriptor is closed, the second descriptor would still be open but
// silently unlocked. So a second RLock must block instead of proceeding.
lockF2 := mustBlock(t, "RLock", f2)
unlock(t, f)
lockF2(t)
} else {
default:
rLock(t, f2)
doUnlockTF = true
}

other := mustOpen(t, f.Name())
defer other.Close()
lockOther := mustBlock(t, "Lock", other)

unlock(t, f2)
if runtime.GOOS != "solaris" && runtime.GOOS != "aix" {
if doUnlockTF {
unlock(t, f)
}
lockOther(t)
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/go/internal/work/buildid.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func (b *Builder) gccgoBuildIDFile(a *Action) (string, error) {
var buf bytes.Buffer
if cfg.Goos == "aix" {
fmt.Fprintf(&buf, "\t.csect .go.buildid[XO]\n")
} else if cfg.Goos != "solaris" || assemblerIsGas() {
} else if (cfg.Goos != "solaris" && cfg.Goos != "illumos") || assemblerIsGas() {
fmt.Fprintf(&buf, "\t"+`.section .go.buildid,"e"`+"\n")
} else if cfg.Goarch == "sparc" || cfg.Goarch == "sparc64" {
fmt.Fprintf(&buf, "\t"+`.section ".go.buildid",#exclude`+"\n")
Expand All @@ -345,7 +345,7 @@ func (b *Builder) gccgoBuildIDFile(a *Action) (string, error) {
fmt.Fprintf(&buf, "%#02x", a.buildID[i])
}
fmt.Fprintf(&buf, "\n")
if cfg.Goos != "solaris" && cfg.Goos != "aix" {
if cfg.Goos != "solaris" && cfg.Goos != "illumos" && cfg.Goos != "aix" {
secType := "@progbits"
if cfg.Goarch == "arm" {
secType = "%progbits"
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/go/internal/work/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ func (b *Builder) build(a *Action) (err error) {
// This is read by readGccgoArchive in cmd/internal/buildid/buildid.go.
if a.buildID != "" && cfg.BuildToolchainName == "gccgo" {
switch cfg.Goos {
case "aix", "android", "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris":
case "aix", "android", "dragonfly", "freebsd", "illumos", "linux", "netbsd", "openbsd", "solaris":
asmfile, err := b.gccgoBuildIDFile(a)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/go/internal/work/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func buildModeInit() {
codegenArg = "-shared"
default:
switch cfg.Goos {
case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris":
case "dragonfly", "freebsd", "illumos", "linux", "netbsd", "openbsd", "solaris":
if platform == "linux/ppc64" {
base.Fatalf("-buildmode=c-archive not supported on %s\n", platform)
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/internal/objabi/head.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (h *HeadType) Set(s string) error {
*h = Hopenbsd
case "plan9":
*h = Hplan9
case "solaris":
case "illumos", "solaris":
*h = Hsolaris
case "windows":
*h = Hwindows
Expand Down
16 changes: 8 additions & 8 deletions src/cmd/link/internal/ld/dwarf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,8 @@ func TestInlinedRoutineRecords(t *testing.T) {
if runtime.GOOS == "plan9" {
t.Skip("skipping on plan9; no DWARF symbol table in executables")
}
if runtime.GOOS == "solaris" || runtime.GOOS == "darwin" {
t.Skip("skipping on solaris and darwin, pending resolution of issue #23168")
if runtime.GOOS == "solaris" || runtime.GOOS == "illumos" || runtime.GOOS == "darwin" {
t.Skip("skipping on solaris, illumos, and darwin, pending resolution of issue #23168")
}

t.Parallel()
Expand Down Expand Up @@ -801,8 +801,8 @@ func TestAbstractOriginSanity(t *testing.T) {
if runtime.GOOS == "plan9" {
t.Skip("skipping on plan9; no DWARF symbol table in executables")
}
if runtime.GOOS == "solaris" || runtime.GOOS == "darwin" {
t.Skip("skipping on solaris and darwin, pending resolution of issue #23168")
if runtime.GOOS == "solaris" || runtime.GOOS == "illumos" || runtime.GOOS == "darwin" {
t.Skip("skipping on solaris, illumos, and darwin, pending resolution of issue #23168")
}

if wd, err := os.Getwd(); err == nil {
Expand All @@ -819,8 +819,8 @@ func TestAbstractOriginSanityIssue25459(t *testing.T) {
if runtime.GOOS == "plan9" {
t.Skip("skipping on plan9; no DWARF symbol table in executables")
}
if runtime.GOOS == "solaris" || runtime.GOOS == "darwin" {
t.Skip("skipping on solaris and darwin, pending resolution of issue #23168")
if runtime.GOOS == "solaris" || runtime.GOOS == "illumos" || runtime.GOOS == "darwin" {
t.Skip("skipping on solaris, illumos, and darwin, pending resolution of issue #23168")
}
if runtime.GOARCH != "amd64" && runtime.GOARCH != "x86" {
t.Skip("skipping on not-amd64 not-x86; location lists not supported")
Expand All @@ -840,8 +840,8 @@ func TestAbstractOriginSanityIssue26237(t *testing.T) {
if runtime.GOOS == "plan9" {
t.Skip("skipping on plan9; no DWARF symbol table in executables")
}
if runtime.GOOS == "solaris" || runtime.GOOS == "darwin" {
t.Skip("skipping on solaris and darwin, pending resolution of issue #23168")
if runtime.GOOS == "solaris" || runtime.GOOS == "illumos" || runtime.GOOS == "darwin" {
t.Skip("skipping on solaris, illumos, and darwin, pending resolution of issue #23168")
}
if wd, err := os.Getwd(); err == nil {
gopathdir := filepath.Join(wd, "testdata", "issue26237")
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/vendor/golang.org/x/sys/unix/sockcmsg_unix.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/debug/gosym/pclntab_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func endtest() {
// These tests open and examine the test binary, and use elf.Open to do so.
func skipIfNotELF(t *testing.T) {
switch runtime.GOOS {
case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris":
case "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris", "illumos":
// OK.
default:
t.Skipf("skipping on non-ELF system %s", runtime.GOOS)
Expand Down
3 changes: 3 additions & 0 deletions src/go/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,9 @@ func (ctxt *Context) match(name string, allTags map[string]bool) bool {
if ctxt.GOOS == "android" && name == "linux" {
return true
}
if ctxt.GOOS == "illumos" && name == "solaris" {
return true
}

// other tags
for _, tag := range ctxt.BuildTags {
Expand Down
3 changes: 3 additions & 0 deletions src/go/build/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@
// Using GOOS=android matches build tags and files as for GOOS=linux
// in addition to android tags and files.
//
// Using GOOS=illumos matches build tags and files as for GOOS=solaris
// in addition to illumos tags and files.
//
// Binary-Only Packages
//
// In Go 1.12 and earlier, it was possible to distribute packages in binary
Expand Down
2 changes: 1 addition & 1 deletion src/go/build/syslist.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

package build

const goosList = "aix android darwin dragonfly freebsd hurd js linux nacl netbsd openbsd plan9 solaris windows zos "
const goosList = "aix android darwin dragonfly freebsd hurd illumos js linux nacl netbsd openbsd plan9 solaris windows zos "
const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc riscv riscv64 s390 s390x sparc sparc64 wasm "
2 changes: 1 addition & 1 deletion src/net/error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func TestDialError(t *testing.T) {

func TestProtocolDialError(t *testing.T) {
switch runtime.GOOS {
case "nacl", "solaris":
case "nacl", "solaris", "illumos":
t.Skipf("not supported on %s", runtime.GOOS)
}

Expand Down
12 changes: 6 additions & 6 deletions src/net/fd_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ func (fd *netFD) connect(ctx context.Context, la, ra syscall.Sockaddr) (rsa sysc
runtime.KeepAlive(fd)
return nil, nil
case syscall.EINVAL:
// On Solaris we can see EINVAL if the socket has
// already been accepted and closed by the server.
// Treat this as a successful connection--writes to
// the socket will see EOF. For details and a test
// case in C see https://golang.org/issue/6828.
if runtime.GOOS == "solaris" {
// On Solaris and illumos we can see EINVAL if the socket has
// already been accepted and closed by the server. Treat this
// as a successful connection--writes to the socket will see
// EOF. For details and a test case in C see
// https://golang.org/issue/6828.
if runtime.GOOS == "solaris" || runtime.GOOS == "illumos" {
return nil, nil
}
fallthrough
Expand Down
4 changes: 2 additions & 2 deletions src/net/interface_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestInterfaces(t *testing.T) {
t.Fatal(err)
}
switch runtime.GOOS {
case "solaris":
case "solaris", "illumos":
if ifxi.Index != ifi.Index {
t.Errorf("got %v; want %v", ifxi, ifi)
}
Expand Down Expand Up @@ -278,7 +278,7 @@ func checkUnicastStats(ifStats *ifStats, uniStats *routeStats) error {

func checkMulticastStats(ifStats *ifStats, uniStats, multiStats *routeStats) error {
switch runtime.GOOS {
case "aix", "dragonfly", "nacl", "netbsd", "openbsd", "plan9", "solaris":
case "aix", "dragonfly", "nacl", "netbsd", "openbsd", "plan9", "solaris", "illumos":
default:
// Test the existence of connected multicast route
// clones for IPv4. Unlike IPv6, IPv4 multicast
Expand Down
10 changes: 5 additions & 5 deletions src/net/listen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,8 @@ func TestIPv4MulticastListener(t *testing.T) {
switch runtime.GOOS {
case "android", "nacl", "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
case "solaris":
t.Skipf("not supported on solaris, see golang.org/issue/7399")
case "solaris", "illumos":
t.Skipf("not supported on solaris or illumos, see golang.org/issue/7399")
}
if !supportsIPv4() {
t.Skip("IPv4 is not supported")
Expand Down Expand Up @@ -609,8 +609,8 @@ func TestIPv6MulticastListener(t *testing.T) {
switch runtime.GOOS {
case "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
case "solaris":
t.Skipf("not supported on solaris, see issue 7399")
case "solaris", "illumos":
t.Skipf("not supported on solaris or illumos, see issue 7399")
}
if !supportsIPv6() {
t.Skip("IPv6 is not supported")
Expand Down Expand Up @@ -674,7 +674,7 @@ func checkMulticastListener(c *UDPConn, ip IP) error {

func multicastRIBContains(ip IP) (bool, error) {
switch runtime.GOOS {
case "aix", "dragonfly", "netbsd", "openbsd", "plan9", "solaris", "windows":
case "aix", "dragonfly", "netbsd", "openbsd", "plan9", "solaris", "illumos", "windows":
return true, nil // not implemented yet
case "linux":
if runtime.GOARCH == "arm" || runtime.GOARCH == "alpha" {
Expand Down
2 changes: 1 addition & 1 deletion src/net/tcpsock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ func TestTCPSelfConnect(t *testing.T) {
n = 1000
}
switch runtime.GOOS {
case "darwin", "dragonfly", "freebsd", "netbsd", "openbsd", "plan9", "solaris", "windows":
case "darwin", "dragonfly", "freebsd", "netbsd", "openbsd", "plan9", "illumos", "solaris", "windows":
// Non-Linux systems take a long time to figure
// out that there is nothing listening on localhost.
n = 100
Expand Down
2 changes: 1 addition & 1 deletion src/os/exec/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ func TestHelperProcess(*testing.T) {
// the cloned file descriptors that result from opening
// /dev/urandom.
// https://golang.org/issue/3955
case "solaris":
case "illumos", "solaris":
// TODO(aram): This fails on Solaris because libc opens
// its own files, as it sees fit. Darwin does the same,
// see: https://golang.org/issue/2603
Expand Down
4 changes: 2 additions & 2 deletions src/os/os_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2226,8 +2226,8 @@ func TestPipeThreads(t *testing.T) {
switch runtime.GOOS {
case "freebsd":
t.Skip("skipping on FreeBSD; issue 19093")
case "solaris":
t.Skip("skipping on Solaris; issue 19111")
case "illumos", "solaris":
t.Skip("skipping on Solaris and illumos; issue 19111")
case "windows":
t.Skip("skipping on Windows; issue 19098")
case "plan9":
Expand Down
2 changes: 1 addition & 1 deletion src/os/removeall_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func TestRemoveAllLarge(t *testing.T) {

func TestRemoveAllLongPath(t *testing.T) {
switch runtime.GOOS {
case "aix", "darwin", "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "solaris":
case "aix", "darwin", "dragonfly", "freebsd", "linux", "netbsd", "openbsd", "illumos", "solaris":
break
default:
t.Skip("skipping for not implemented platforms")
Expand Down
2 changes: 1 addition & 1 deletion src/os/user/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func TestGroupIds(t *testing.T) {
if runtime.GOOS == "aix" {
t.Skip("skipping GroupIds, see golang.org/issue/30563")
}
if runtime.GOOS == "solaris" {
if runtime.GOOS == "solaris" || runtime.GOOS == "illumos" {
t.Skip("skipping GroupIds, see golang.org/issue/14709")
}
user, err := Current()
Expand Down
Loading

0 comments on commit 9ee73d2

Please sign in to comment.