mirror of https://github.com/golang/go.git
cmd: add wasip1 support
For #58141 Co-authored-by: Richard Musiol <neelance@gmail.com> Co-authored-by: Achille Roussel <achille.roussel@gmail.com> Co-authored-by: Julien Fabre <ju.pryz@gmail.com> Co-authored-by: Evan Phoenix <evan@phx.io> Change-Id: I530ea78a3cd142f3a745f650b21c30e7f10ce981 Reviewed-on: https://go-review.googlesource.com/c/go/+/479621 Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
1777031528
commit
7f5af094f8
|
|
@ -5,7 +5,7 @@
|
|||
// Only run where builders (build.golang.org) have
|
||||
// access to compiled packages for import.
|
||||
//
|
||||
//go:build !android && !ios && !js
|
||||
//go:build !android && !ios && !js && !wasip1
|
||||
|
||||
package types2_test
|
||||
|
||||
|
|
|
|||
|
|
@ -675,7 +675,7 @@ func (t *tester) registerTests() {
|
|||
}
|
||||
|
||||
// Runtime CPU tests.
|
||||
if !t.compileOnly && goos != "js" { // js can't handle -cpu != 1
|
||||
if !t.compileOnly && t.hasParallelism() {
|
||||
t.registerTest("runtime:cpu124", "GOMAXPROCS=2 runtime -cpu=1,2,4 -quick",
|
||||
&goTest{
|
||||
timeout: 300 * time.Second,
|
||||
|
|
@ -737,9 +737,9 @@ func (t *tester) registerTests() {
|
|||
// On the builders only, test that a moved GOROOT still works.
|
||||
// Fails on iOS because CC_FOR_TARGET refers to clangwrap.sh
|
||||
// in the unmoved GOROOT.
|
||||
// Fails on Android and js/wasm with an exec format error.
|
||||
// Fails on Android, js/wasm and wasip1/wasm with an exec format error.
|
||||
// Fails on plan9 with "cannot find GOROOT" (issue #21016).
|
||||
if os.Getenv("GO_BUILDER_NAME") != "" && goos != "android" && !t.iOS() && goos != "plan9" && goos != "js" {
|
||||
if os.Getenv("GO_BUILDER_NAME") != "" && goos != "android" && !t.iOS() && goos != "plan9" && goos != "js" && goos != "wasip1" {
|
||||
t.tests = append(t.tests, distTest{
|
||||
name: "moved_goroot",
|
||||
heading: "moved GOROOT",
|
||||
|
|
@ -835,7 +835,7 @@ func (t *tester) registerTests() {
|
|||
}
|
||||
|
||||
// sync tests
|
||||
if goos != "js" { // js doesn't support -cpu=10
|
||||
if t.hasParallelism() {
|
||||
t.registerTest("sync_cpu", "sync -cpu=10",
|
||||
&goTest{
|
||||
timeout: 120 * time.Second,
|
||||
|
|
@ -1476,6 +1476,14 @@ func (t *tester) hasSwig() bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func (t *tester) hasParallelism() bool {
|
||||
switch goos {
|
||||
case "js", "wasip1":
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (t *tester) raceDetectorSupported() bool {
|
||||
if gohostos != goos {
|
||||
return false
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build unix || js
|
||||
//go:build unix || js || wasip1
|
||||
|
||||
package base
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"internal/testenv"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
|
@ -152,8 +151,8 @@ func dummyID(x int) [HashSize]byte {
|
|||
}
|
||||
|
||||
func TestCacheTrim(t *testing.T) {
|
||||
if runtime.GOOS == "js" {
|
||||
testenv.SkipFlaky(t, 35220)
|
||||
if runtime.GOOS == "js" || runtime.GOOS == "wasip1" {
|
||||
t.Skip("file lock is unsupported on +" + runtime.GOOS)
|
||||
}
|
||||
|
||||
dir, err := os.MkdirTemp("", "cachetest-")
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !js && !plan9
|
||||
//go:build !js && !plan9 && !wasip1
|
||||
|
||||
package filelock_test
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// js does not support inter-process file locking.
|
||||
// js and wasip1 do not support inter-process file locking.
|
||||
//
|
||||
//go:build !js
|
||||
//go:build !js && !wasip1
|
||||
|
||||
package lockedfile_test
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// js does not support inter-process file locking.
|
||||
// js and wasip1 do not support inter-process file locking.
|
||||
//
|
||||
//go:build !js
|
||||
//go:build !js && !wasip1
|
||||
|
||||
package lockedfile_test
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build (js && wasm) || plan9
|
||||
//go:build (js && wasm) || wasip1 || plan9
|
||||
|
||||
package mmap
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ package work
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"internal/testenv"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
|
@ -221,13 +222,6 @@ func pkgImportPath(pkgpath string) *load.Package {
|
|||
// directory.
|
||||
// See https://golang.org/issue/18878.
|
||||
func TestRespectSetgidDir(t *testing.T) {
|
||||
switch runtime.GOOS {
|
||||
case "ios":
|
||||
t.Skip("can't set SetGID bit with chmod on iOS")
|
||||
case "windows", "plan9":
|
||||
t.Skip("chown/chmod setgid are not supported on Windows or Plan 9")
|
||||
}
|
||||
|
||||
var b Builder
|
||||
|
||||
// Check that `cp` is called instead of `mv` by looking at the output
|
||||
|
|
@ -250,13 +244,24 @@ func TestRespectSetgidDir(t *testing.T) {
|
|||
// the new temporary directory.
|
||||
err = os.Chown(setgiddir, os.Getuid(), os.Getgid())
|
||||
if err != nil {
|
||||
if testenv.SyscallIsNotSupported(err) {
|
||||
t.Skip("skipping: chown is not supported on " + runtime.GOOS)
|
||||
}
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Change setgiddir's permissions to include the SetGID bit.
|
||||
if err := os.Chmod(setgiddir, 0755|fs.ModeSetgid); err != nil {
|
||||
if testenv.SyscallIsNotSupported(err) {
|
||||
t.Skip("skipping: chmod is not supported on " + runtime.GOOS)
|
||||
}
|
||||
t.Fatal(err)
|
||||
}
|
||||
if fi, err := os.Stat(setgiddir); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if fi.Mode()&fs.ModeSetgid == 0 {
|
||||
t.Skip("skipping: Chmod ignored ModeSetgid on " + runtime.GOOS)
|
||||
}
|
||||
|
||||
pkgfile, err := os.CreateTemp("", "pkgfile")
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2023 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build wasip1
|
||||
|
||||
package osinfo
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Version returns the OS version name/number.
|
||||
func Version() (string, error) {
|
||||
return "", fmt.Errorf("unable to determine OS version: %w", errors.ErrUnsupported)
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build unix || js
|
||||
//go:build unix || js || wasip1
|
||||
|
||||
package main
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue