]> Cypherpunks repositories - gostls13.git/commitdiff
all: add wasip1 support
authorJohan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Sun, 26 Mar 2023 00:01:38 +0000 (17:01 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 11 Apr 2023 20:56:32 +0000 (20:56 +0000)
Fixes #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: I49b66946acc90fdf09ed9223096bfec9a1e5b923
Reviewed-on: https://go-review.googlesource.com/c/go/+/479627
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Bypass: Ian Lance Taylor <iant@golang.org>

34 files changed:
src/debug/elf/file_test.go
src/go/types/example_test.go
src/io/ioutil/ioutil_test.go
src/log/syslog/syslog_test.go
src/mime/type_unix.go
src/path/filepath/path_test.go
src/path/filepath/path_unix.go
src/testing/run_example.go
src/testing/run_example_wasm.go [moved from src/testing/run_example_js.go with 98% similarity]
test/const7.go
test/fixedbugs/bug369.go
test/fixedbugs/issue11771.go
test/fixedbugs/issue14636.go
test/fixedbugs/issue16037_run.go
test/fixedbugs/issue19182.go
test/fixedbugs/issue19658.go
test/fixedbugs/issue21317.go
test/fixedbugs/issue21576.go
test/fixedbugs/issue22660.go
test/fixedbugs/issue22662b.go
test/fixedbugs/issue26411.go
test/fixedbugs/issue33275_run.go
test/fixedbugs/issue33555.go
test/fixedbugs/issue36437.go
test/fixedbugs/issue46234.go
test/fixedbugs/issue52127.go
test/fixedbugs/issue9355.go
test/fixedbugs/issue9862_run.go
test/linkmain_run.go
test/linkobj.go
test/linkx_run.go
test/live_uintptrkeepalive.go
test/nosplit.go
test/sigchld.go

index 7d5895b650dba47c8680ceb29e5cb62ffeb7dbbc..51a3634db9245973c83be39ffd3e0c49f71fa444 100644 (file)
@@ -902,7 +902,7 @@ func TestCompressedSection(t *testing.T) {
 func TestNoSectionOverlaps(t *testing.T) {
        // Ensure cmd/link outputs sections without overlaps.
        switch runtime.GOOS {
-       case "aix", "android", "darwin", "ios", "js", "plan9", "windows":
+       case "aix", "android", "darwin", "ios", "js", "plan9", "windows", "wasip1":
                t.Skipf("cmd/link doesn't produce ELF binaries on %s", runtime.GOOS)
        }
        _ = net.ResolveIPAddr // force dynamic linkage
index b54a142bd4f3455cecabec7e04bddd62d3800d4e..37b5ea4511d96ca41672615126cd1b096996a51a 100644 (file)
@@ -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 types_test
 
index db85755bdbad882f07fa36527fe639aafd9d08b5..6bff8c691c53530af83cd981e97e12dde385ddd1 100644 (file)
@@ -9,6 +9,7 @@ import (
        . "io/ioutil"
        "os"
        "path/filepath"
+       "runtime"
        "testing"
 )
 
@@ -70,6 +71,9 @@ func TestReadOnlyWriteFile(t *testing.T) {
        if os.Getuid() == 0 {
                t.Skipf("Root can write to read-only files anyway, so skip the read-only test.")
        }
+       if runtime.GOOS == "wasip1" {
+               t.Skip("file permissions are not supported by wasip1")
+       }
 
        // We don't want to use TempFile directly, since that opens a file for us as 0600.
        tempDir, err := TempDir("", t.Name())
index de1681d6532328649c81332f339d94ec36283f05..c7a5bfbd7bbed3c1a8fde4036bfa4c59bbf54ee4 100644 (file)
@@ -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 !windows && !plan9 && !js
+//go:build !windows && !plan9 && !js && !wasip1
 
 package syslog
 
index 649d9001e3be04eb3622e68eb1d3ad8b48a87c56..90414c1a18d06fa745be402f66b731a61923e4a1 100644 (file)
@@ -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 && wasm)
+//go:build unix || (js && wasm) || wasip1
 
 package mime
 
index 9adf6410137a01ddbebeab06c51c85f30772a697..cfc5cad863abfc1a37a15d85ec202ac6e5cbab76 100644 (file)
@@ -612,8 +612,9 @@ func testWalk(t *testing.T, walk func(string, fs.WalkDirFunc) error, errVisit in
                // Test permission errors. Only possible if we're not root
                // and only on some file systems (AFS, FAT).  To avoid errors during
                // all.bash on those file systems, skip during go test -short.
-               if runtime.GOOS == "windows" {
-                       t.Skip("skipping on Windows")
+               // Chmod is not supported on wasip1.
+               if runtime.GOOS == "windows" || runtime.GOOS == "wasip1" {
+                       t.Skip("skipping on " + runtime.GOOS)
                }
                if os.Getuid() == 0 {
                        t.Skip("skipping as root")
index ab1d08d35654ac0fd0d434956e9a5c0d32ef63d5..57e621743434c7191bde550f083c0a8e989eaf13 100644 (file)
@@ -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 && wasm)
+//go:build unix || (js && wasm) || wasip1
 
 package filepath
 
index 776fbffc7ed348223711ba56b4b8f7d5dd4d269c..b2c5c3d14ce1d271a22a163dd1d505260195f4bc 100644 (file)
@@ -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
+//go:build !js && !wasip1
 
 // TODO(@musiol, @odeke-em): re-unify this entire file back into
 // example.go when js/wasm gets an os.Pipe implementation
similarity index 98%
rename from src/testing/run_example_js.go
rename to src/testing/run_example_wasm.go
index 572c6b3e2ef1aca2b378bf99a12153eeef61e47b..b815fcdbd75a26fe9cce99756a952592ffb5447e 100644 (file)
@@ -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
+//go:build js || wasip1
 
 package testing
 
index 8b252a24cf81d4e3f31c80e1f945da7000e89ffe..a229fcc096dbb098db2894fe218298eca3908d72 100644 (file)
@@ -59,7 +59,7 @@ func testProg(dir, name string, length int, msg string) {
 }
 
 func main() {
-       if runtime.GOOS == "js" || runtime.Compiler != "gc" {
+       if runtime.GOOS == "js" || runtime.GOOS == "wasip1" || runtime.Compiler != "gc" {
                return
        }
 
index 65dd9adc73b43b4ce0de23b0fc23a9f21775461d..47258fe3fe9feb8bfdb5f766688d563da4c64d24 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js,gc
+// +build !nacl,!js,!wasip1,gc
 // run
 
 // Copyright 2011 The Go Authors. All rights reserved.
index e5bed186bbd820e21ec896b4363a38870934055e..657e1b0519bcfe94a5af49efcb9991d1a5988940 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js,gc
+// +build !nacl,!js,!wasip1,gc
 // run
 
 // Copyright 2015 The Go Authors. All rights reserved.
index 06fd193dae0ba1d8c60085f7511b618887248646..770fb4adc9162d76eadbcdc875426fdd26e03a7b 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js,!android,gc
+// +build !nacl,!js,!wasip1,!android,gc
 // run
 
 // Copyright 2016 The Go Authors. All rights reserved.
index 68104a9000795d835154d476a840c5dc95429220..610fd2d395684ddbd359270013b4fdd7c51e088c 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js,!android,!gccgo
+// +build !nacl,!js,!wasip1,!android,!gccgo
 // run
 
 // Copyright 2016 The Go Authors. All rights reserved.
index e1f3ffb4749f4dbb4c2204c4a0f484aea91b4771..f5e44e98c2fe26dbe780f78e65d5adc126b2581a 100644 (file)
@@ -1,5 +1,5 @@
 // run
-// +build !js
+// +build !js,!wasip1
 
 // Copyright 2017 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
index 70fa3a65c39ce6a79a8cc88cde293e5cc73222d4..1e13573b72bc971d75e4a524674035cbf493149f 100644 (file)
@@ -1,5 +1,5 @@
 // run
-//go:build !nacl && !js && !gccgo
+//go:build !nacl && !js && !wasip1 && !gccgo
 
 // Copyright 2017 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
index 81379dcc335dfdd67daf1e8db77a108f099d7369..75d871cbae52a3eba84609ebfa3a59df144399a4 100644 (file)
@@ -1,4 +1,4 @@
-// +build !js,gc
+// +build !js,!wasip1,gc
 // run
 
 // Copyright 2017 The Go Authors. All rights reserved.
index 3f9b1ba008af4cfee4cd502d844925101ec04764..8e1e3ad495ebd853364c7347b647dc346c5c512a 100644 (file)
@@ -1,6 +1,6 @@
 // run
 
-// +build !nacl,!js,!gccgo
+// +build !nacl,!js,!wasip1,!gccgo
 
 // Copyright 2019 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
index 7f542c5153437fa173bdb3a1ffbe2d96e18bb4d2..150de174af97c083dabd87c6e5c14a3490bdbad9 100644 (file)
@@ -1,4 +1,4 @@
-// +build !js,gc
+// +build !js,!wasip1,gc
 // run
 
 // Copyright 2017 The Go Authors. All rights reserved.
index df4f28429c7a126590a5490606a04ce1fffd64af..c7a1e0558b50168605d26283db153b9b59e64bf2 100644 (file)
@@ -1,4 +1,4 @@
-// +build !js,gc
+// +build !js,!wasip1,gc
 // run
 
 // Copyright 2018 The Go Authors. All rights reserved.
index eb17960c47670d41dcedb7968883d17ab4dc5eb6..3ae9e03936135b0bf189931607352048f0959c03 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,!wasip1
 // run
 
 // Copyright 2018 The Go Authors. All rights reserved.
index ed03dccf4c8086bb8253ae1e4f029d9fd7dc57b6..f2818b0f512a81f971c863d8a69305470916d2fb 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js,!gccgo
+// +build !nacl,!js,!wasip1,!gccgo
 // run
 
 // Copyright 2019 The Go Authors. All rights reserved.
index c1fcd2a79b387a8b23020bc42c2cf666471bee6d..e7fe41e4516096fae377d317b0f66f860fd047f3 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js,!gccgo
+// +build !nacl,!js,!wasip1,!gccgo
 // run
 
 // Copyright 2019 The Go Authors. All rights reserved.
index c7a11d27a8934985d1bc975d7a60f4e96d793746..c16e7ef48f752865829a56c657d2fb72f9ead0de 100644 (file)
@@ -1,6 +1,6 @@
 // run
 
-// +build !nacl,!js,gc
+// +build !nacl,!js,!wasip1,gc
 
 // Copyright 2020 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
index ed1c05cfbf4b811874ecc780b4099fa69b00dee0..ae280190ebc5985372a88fc9ce29ec782e9c7c23 100644 (file)
@@ -1,7 +1,7 @@
 // buildrun -t 45
 
-//go:build !js
-// +build !js
+//go:build !js && !wasip1
+// +build !js,!wasip1
 
 // Copyright 2021 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
index 7738c3fabf72841c131d6347b185da4d38121734..68abe3fdbb76f4b2d30bae7415e17c43af3ee6b8 100644 (file)
@@ -1,6 +1,6 @@
 // run
-//go:build !js
-// +build !js
+//go:build !js && !wasip1
+// +build !js,!wasip1
 
 // Copyright 2022 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
index 1c3999c67c6b0db58b8f9e6d101355fe48a83cdc..2670f15574731c68306a04e62178226d1d39bb54 100644 (file)
@@ -1,4 +1,4 @@
-// +build !js,gc
+// +build !js,!wasip1,gc
 // run
 
 // Copyright 2014 The Go Authors. All rights reserved.
index c956c7f7bd50f3aa0445ea1f5f994421dfc28b24..edf8dfaf32a9acdb6ba6a0c2b358e0c8ec8703d9 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js,gc
+// +build !nacl,!js,!wasip1,gc
 // run
 
 // Copyright 2015 The Go Authors. All rights reserved.
index f4f6c4320e9cd9ff0d8cf08dae398371c66dc2f6..f2ab681c0d27b73012ad142929a7408b92b45084 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js
+// +build !nacl,!js,!wasip1
 // run
 
 // Copyright 2014 The Go Authors. All rights reserved.
index 35ff63ba6722b9e96f3453c15b0f8237ce2fa28c..fcf3f88919d710dcb37d6b9dd40021737a759a96 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js,gc
+// +build !nacl,!js,gc,!wasip1
 // run
 
 // Copyright 2016 The Go Authors. All rights reserved.
index ccfc3a93dff14e0ea52872ac9f684ba981bee1f9..b7b1ea87f0b03de87c52876aa61ec8b91b62f7fb 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js,gc
+// +build !nacl,!js,!wasip1,gc
 // run
 
 // Copyright 2014 The Go Authors. All rights reserved.
index e39e31f77faf934f022c987828cb2b61f35872c7..566734e5051c7bba0dbcd080b535ca1621877037 100644 (file)
@@ -1,6 +1,6 @@
 // errorcheck -0 -m -live -std
 
-// +build !windows,!js
+// +build !windows,!js,!wasip1
 
 // Copyright 2015 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
index 218eb73727affe9739bd1a9830d3f479eb425315..a695654eaf131f0228c4630123a4fa3570959f6e 100644 (file)
@@ -1,4 +1,4 @@
-// +build !nacl,!js,!aix,!gcflags_noopt,gc
+// +build !nacl,!js,!aix,!wasip1,!gcflags_noopt,gc
 // run
 
 // Copyright 2014 The Go Authors. All rights reserved.
index 3b4960640914f2a67eda4fa6f48692377cf03f35..fc6cf91b5790fcdf78735f3d08d3824bbe3c1c69 100644 (file)
@@ -1,4 +1,4 @@
-// +build !plan9,!windows
+// +build !plan9,!windows,!wasip1
 // run
 
 // Copyright 2009 The Go Authors. All rights reserved.