diff --git a/src/debug/elf/file_test.go b/src/debug/elf/file_test.go index f591f05a2ec4ff..92f211b8959908 100644 --- a/src/debug/elf/file_test.go +++ b/src/debug/elf/file_test.go @@ -900,7 +900,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 diff --git a/src/go/types/example_test.go b/src/go/types/example_test.go index b54a142bd4f345..37b5ea4511d96c 100644 --- a/src/go/types/example_test.go +++ b/src/go/types/example_test.go @@ -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 diff --git a/src/io/ioutil/ioutil_test.go b/src/io/ioutil/ioutil_test.go index db85755bdbad88..6bff8c691c5353 100644 --- a/src/io/ioutil/ioutil_test.go +++ b/src/io/ioutil/ioutil_test.go @@ -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()) diff --git a/src/log/syslog/syslog_test.go b/src/log/syslog/syslog_test.go index de1681d6532328..c7a5bfbd7bbed3 100644 --- a/src/log/syslog/syslog_test.go +++ b/src/log/syslog/syslog_test.go @@ -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 diff --git a/src/mime/type_unix.go b/src/mime/type_unix.go index 649d9001e3be04..655c456696a02b 100644 --- a/src/mime/type_unix.go +++ b/src/mime/type_unix.go @@ -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 && wasm) package mime diff --git a/src/path/filepath/path_test.go b/src/path/filepath/path_test.go index 9adf6410137a01..5d3109aeead767 100644 --- a/src/path/filepath/path_test.go +++ b/src/path/filepath/path_test.go @@ -612,8 +612,8 @@ 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") + if runtime.GOOS == "windows" || runtime.GOOS == "wasip1" { + t.Skip("skipping on " + runtime.GOOS) } if os.Getuid() == 0 { t.Skip("skipping as root") diff --git a/src/path/filepath/path_unix.go b/src/path/filepath/path_unix.go index ab1d08d35654ac..91adaf51f1dc14 100644 --- a/src/path/filepath/path_unix.go +++ b/src/path/filepath/path_unix.go @@ -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 && wasm) package filepath diff --git a/src/testing/run_example.go b/src/testing/run_example.go index 776fbffc7ed348..b2c5c3d14ce1d2 100644 --- a/src/testing/run_example.go +++ b/src/testing/run_example.go @@ -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 diff --git a/src/testing/run_example_js.go b/src/testing/run_example_wasm.go similarity index 98% rename from src/testing/run_example_js.go rename to src/testing/run_example_wasm.go index 572c6b3e2ef1ac..b815fcdbd75a26 100644 --- a/src/testing/run_example_js.go +++ b/src/testing/run_example_wasm.go @@ -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 diff --git a/src/time/internal_test.go b/src/time/internal_test.go index 4c4a720f74e4e2..8f3457ca93a547 100644 --- a/src/time/internal_test.go +++ b/src/time/internal_test.go @@ -4,6 +4,8 @@ package time +import "runtime" + func init() { // Force US/Pacific for time zone tests. ForceUSPacificForTesting() @@ -36,6 +38,17 @@ func disablePlatformSources() (undo func()) { var Interrupt = interrupt var DaysIn = daysIn +func init() { + if runtime.GOOS == "wasip1" { + // There is no mechanism in wasi to interrupt the call to poll_oneoff + // used to implement runtime.usleep so this function does nothing, which + // somewhat defeats the purpose of TestSleep but we are still better off + // validating that time elapses when the process calls time.Sleep than + // skipping the test altogether. + Interrupt = func() {} + } +} + func empty(arg any, seq uintptr) {} // Test that a runtimeTimer with a period that would overflow when on diff --git a/src/time/sys_unix.go b/src/time/sys_unix.go index 0f06aa6ccd7dcd..7e8c8cea618b28 100644 --- a/src/time/sys_unix.go +++ b/src/time/sys_unix.go @@ -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 && wasm) package time diff --git a/src/time/zoneinfo_wasip1.go b/src/time/zoneinfo_wasip1.go new file mode 100644 index 00000000000000..b6f0352080edc4 --- /dev/null +++ b/src/time/zoneinfo_wasip1.go @@ -0,0 +1,14 @@ +// 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 && wasm + +package time + +// in wasip1 zoneinfo is managed by the runtime. +var platformZoneSources = []string{} + +func initLocal() { + localLoc.name = "Local" +} diff --git a/test/codegen/comparisons.go b/test/codegen/comparisons.go index 99589c4ce87628..adcdc7e69e10cf 100644 --- a/test/codegen/comparisons.go +++ b/test/codegen/comparisons.go @@ -268,30 +268,30 @@ func CmpToZero(a, b, d int32, e, f int64, deOptC0, deOptC1 bool) int32 { func CmpLogicalToZero(a, b, c uint32, d, e uint64) uint64 { // ppc64x:"ANDCC",-"CMPW" - // wasm:"I64Eqz",-"I32Eqz",-"I64ExtendI32U",-"I32WrapI64" + // js/wasm/:"I64Eqz",-"I32Eqz",-"I64ExtendI32U",-"I32WrapI64" if a&63 == 0 { return 1 } // ppc64x:"ANDCC",-"CMP" - // wasm:"I64Eqz",-"I32Eqz",-"I64ExtendI32U",-"I32WrapI64" + // js/wasm/:"I64Eqz",-"I32Eqz",-"I64ExtendI32U",-"I32WrapI64" if d&255 == 0 { return 1 } // ppc64x:"ANDCC",-"CMP" - // wasm:"I64Eqz",-"I32Eqz",-"I64ExtendI32U",-"I32WrapI64" + // js/wasm/:"I64Eqz",-"I32Eqz",-"I64ExtendI32U",-"I32WrapI64" if d&e == 0 { return 1 } // ppc64x:"ORCC",-"CMP" - // wasm:"I64Eqz",-"I32Eqz",-"I64ExtendI32U",-"I32WrapI64" + // js/wasm/:"I64Eqz",-"I32Eqz",-"I64ExtendI32U",-"I32WrapI64" if d|e == 0 { return 1 } // ppc64x:"XORCC",-"CMP" - // wasm:"I64Eqz","I32Eqz",-"I64ExtendI32U",-"I32WrapI64" + // js/wasm/:"I64Eqz","I32Eqz",-"I64ExtendI32U",-"I32WrapI64" if e^d == 0 { return 1 } @@ -508,19 +508,19 @@ func UintGeqOne(a uint8, b uint16, c uint32, d uint64) int { } func CmpToZeroU_ex1(a uint8, b uint16, c uint32, d uint64) int { - // wasm:"I64Eqz"-"I64LtU" + // js/wasm/:"I64Eqz"-"I64LtU" if 0 < a { return 1 } - // wasm:"I64Eqz"-"I64LtU" + // js/wasm/:"I64Eqz"-"I64LtU" if 0 < b { return 1 } - // wasm:"I64Eqz"-"I64LtU" + // js/wasm/:"I64Eqz"-"I64LtU" if 0 < c { return 1 } - // wasm:"I64Eqz"-"I64LtU" + // js/wasm/:"I64Eqz"-"I64LtU" if 0 < d { return 1 } @@ -528,19 +528,19 @@ func CmpToZeroU_ex1(a uint8, b uint16, c uint32, d uint64) int { } func CmpToZeroU_ex2(a uint8, b uint16, c uint32, d uint64) int { - // wasm:"I64Eqz"-"I64LeU" + // js/wasm/:"I64Eqz"-"I64LeU" if a <= 0 { return 1 } - // wasm:"I64Eqz"-"I64LeU" + // js/wasm/:"I64Eqz"-"I64LeU" if b <= 0 { return 1 } - // wasm:"I64Eqz"-"I64LeU" + // js/wasm/:"I64Eqz"-"I64LeU" if c <= 0 { return 1 } - // wasm:"I64Eqz"-"I64LeU" + // js/wasm/:"I64Eqz"-"I64LeU" if d <= 0 { return 1 } @@ -548,19 +548,19 @@ func CmpToZeroU_ex2(a uint8, b uint16, c uint32, d uint64) int { } func CmpToOneU_ex1(a uint8, b uint16, c uint32, d uint64) int { - // wasm:"I64Eqz"-"I64LtU" + // js/wasm/:"I64Eqz"-"I64LtU" if a < 1 { return 1 } - // wasm:"I64Eqz"-"I64LtU" + // js/wasm/:"I64Eqz"-"I64LtU" if b < 1 { return 1 } - // wasm:"I64Eqz"-"I64LtU" + // js/wasm/:"I64Eqz"-"I64LtU" if c < 1 { return 1 } - // wasm:"I64Eqz"-"I64LtU" + // js/wasm/:"I64Eqz"-"I64LtU" if d < 1 { return 1 } @@ -568,19 +568,19 @@ func CmpToOneU_ex1(a uint8, b uint16, c uint32, d uint64) int { } func CmpToOneU_ex2(a uint8, b uint16, c uint32, d uint64) int { - // wasm:"I64Eqz"-"I64LeU" + // js/wasm/:"I64Eqz"-"I64LeU" if 1 <= a { return 1 } - // wasm:"I64Eqz"-"I64LeU" + // js/wasm/:"I64Eqz"-"I64LeU" if 1 <= b { return 1 } - // wasm:"I64Eqz"-"I64LeU" + // js/wasm/:"I64Eqz"-"I64LeU" if 1 <= c { return 1 } - // wasm:"I64Eqz"-"I64LeU" + // js/wasm/:"I64Eqz"-"I64LeU" if 1 <= d { return 1 } diff --git a/test/codegen/condmove.go b/test/codegen/condmove.go index 6c08116b2c47b0..d7424a52f0da3e 100644 --- a/test/codegen/condmove.go +++ b/test/codegen/condmove.go @@ -14,7 +14,7 @@ func cmovint(c int) int { // amd64:"CMOVQLT" // arm64:"CSEL\tLT" // ppc64x:"ISEL\t[$]0" - // wasm:"Select" + // js/wasm/:"Select" return x } @@ -25,7 +25,7 @@ func cmovchan(x, y chan int) chan int { // amd64:"CMOVQNE" // arm64:"CSEL\tNE" // ppc64x:"ISEL\t[$]2" - // wasm:"Select" + // js/wasm/:"Select" return x } @@ -36,7 +36,7 @@ func cmovuintptr(x, y uintptr) uintptr { // amd64:"CMOVQ(HI|CS)" // arm64:"CSNEG\tLS" // ppc64x:"ISEL\t[$]1" - // wasm:"Select" + // js/wasm/:"Select" return x } @@ -47,7 +47,7 @@ func cmov32bit(x, y uint32) uint32 { // amd64:"CMOVL(HI|CS)" // arm64:"CSNEG\t(LS|HS)" // ppc64x:"ISEL\t[$]1" - // wasm:"Select" + // js/wasm/:"Select" return x } @@ -58,7 +58,7 @@ func cmov16bit(x, y uint16) uint16 { // amd64:"CMOVW(HI|CS)" // arm64:"CSNEG\t(LS|HS)" // ppc64x:"ISEL\t[$]0" - // wasm:"Select" + // js/wasm/:"Select" return x } @@ -72,7 +72,7 @@ func cmovfloateq(x, y float64) int { // amd64:"CMOVQNE","CMOVQPC" // arm64:"CSEL\tEQ" // ppc64x:"ISEL\t[$]2" - // wasm:"Select" + // js/wasm/:"Select" return a } @@ -84,7 +84,7 @@ func cmovfloatne(x, y float64) int { // amd64:"CMOVQNE","CMOVQPS" // arm64:"CSEL\tNE" // ppc64x:"ISEL\t[$]2" - // wasm:"Select" + // js/wasm/:"Select" return a } @@ -111,7 +111,7 @@ func cmovfloatint2(x, y float64) float64 { // amd64:"CMOVQHI" // arm64:"CSEL\tMI" // ppc64x:"ISEL\t[$]0" - // wasm:"Select" + // js/wasm/:"Select" r = r - ldexp(y, rexp-yexp) } return r @@ -126,7 +126,7 @@ func cmovloaded(x [4]int, y int) int { // amd64:"CMOVQNE" // arm64:"CSEL\tNE" // ppc64x:"ISEL\t[$]2" - // wasm:"Select" + // js/wasm/:"Select" return y } @@ -138,7 +138,7 @@ func cmovuintptr2(x, y uintptr) uintptr { // amd64:"CMOVQEQ" // arm64:"CSEL\tEQ" // ppc64x:"ISEL\t[$]2" - // wasm:"Select" + // js/wasm/:"Select" return a } @@ -151,7 +151,7 @@ func cmovfloatmove(x, y int) float64 { // amd64:-"CMOV" // arm64:-"CSEL" // ppc64x:-"ISEL" - // wasm:-"Select" + // js/wasm/:-"Select" return a } diff --git a/test/codegen/math.go b/test/codegen/math.go index f172af435d4157..f7329abbeaa7fa 100644 --- a/test/codegen/math.go +++ b/test/codegen/math.go @@ -16,7 +16,7 @@ func approx(x float64) { // s390x:"FIDBR\t[$]6" // arm64:"FRINTPD" // ppc64x:"FRIP" - // wasm:"F64Ceil" + // js/wasm/:"F64Ceil" sink64[0] = math.Ceil(x) // amd64/v2:-".*x86HasSSE41" amd64/v3:-".*x86HasSSE41" @@ -24,7 +24,7 @@ func approx(x float64) { // s390x:"FIDBR\t[$]7" // arm64:"FRINTMD" // ppc64x:"FRIM" - // wasm:"F64Floor" + // js/wasm/:"F64Floor" sink64[1] = math.Floor(x) // s390x:"FIDBR\t[$]1" @@ -37,14 +37,14 @@ func approx(x float64) { // s390x:"FIDBR\t[$]5" // arm64:"FRINTZD" // ppc64x:"FRIZ" - // wasm:"F64Trunc" + // js/wasm/:"F64Trunc" sink64[3] = math.Trunc(x) // amd64/v2:-".*x86HasSSE41" amd64/v3:-".*x86HasSSE41" // amd64:"ROUNDSD\t[$]0" // s390x:"FIDBR\t[$]4" // arm64:"FRINTND" - // wasm:"F64Nearest" + // js/wasm/:"F64Nearest" sink64[4] = math.RoundToEven(x) } @@ -55,7 +55,7 @@ func sqrt(x float64) float64 { // arm/7:"SQRTD" // mips/hardfloat:"SQRTD" mips/softfloat:-"SQRTD" // mips64/hardfloat:"SQRTD" mips64/softfloat:-"SQRTD" - // wasm:"F64Sqrt" + // js/wasm/:"F64Sqrt" // ppc64x:"FSQRT" return math.Sqrt(x) } @@ -67,7 +67,7 @@ func sqrt32(x float32) float32 { // arm/7:"SQRTF" // mips/hardfloat:"SQRTF" mips/softfloat:-"SQRTF" // mips64/hardfloat:"SQRTF" mips64/softfloat:-"SQRTF" - // wasm:"F32Sqrt" + // js/wasm/:"F32Sqrt" // ppc64x:"FSQRTS" return float32(math.Sqrt(float64(x))) } @@ -79,7 +79,7 @@ func abs(x, y float64) { // s390x:"LPDFR\t",-"MOVD\t" (no integer load/store) // ppc64x:"FABS\t" // riscv64:"FABSD\t" - // wasm:"F64Abs" + // js/wasm/:"F64Abs" // arm/6:"ABSD\t" sink64[0] = math.Abs(x) @@ -101,7 +101,7 @@ func copysign(a, b, c float64) { // s390x:"CPSDR",-"MOVD" (no integer load/store) // ppc64x:"FCPSGN" // riscv64:"FSGNJD" - // wasm:"F64Copysign" + // js/wasm/:"F64Copysign" sink64[0] = math.Copysign(a, b) // amd64:"BTSQ\t[$]63" diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go index 8c971cf760c60c..b7395abbb183ec 100644 --- a/test/codegen/mathbits.go +++ b/test/codegen/mathbits.go @@ -18,7 +18,7 @@ func LeadingZeros(n uint) int { // s390x:"FLOGR" // arm:"CLZ" arm64:"CLZ" // mips:"CLZ" - // wasm:"I64Clz" + // js/wasm/:"I64Clz" // ppc64x:"CNTLZD" return bits.LeadingZeros(n) } @@ -29,7 +29,7 @@ func LeadingZeros64(n uint64) int { // s390x:"FLOGR" // arm:"CLZ" arm64:"CLZ" // mips:"CLZ" - // wasm:"I64Clz" + // js/wasm/:"I64Clz" // ppc64x:"CNTLZD" return bits.LeadingZeros64(n) } @@ -40,7 +40,7 @@ func LeadingZeros32(n uint32) int { // s390x:"FLOGR" // arm:"CLZ" arm64:"CLZW" // mips:"CLZ" - // wasm:"I64Clz" + // js/wasm/:"I64Clz" // ppc64x:"CNTLZW" return bits.LeadingZeros32(n) } @@ -51,7 +51,7 @@ func LeadingZeros16(n uint16) int { // s390x:"FLOGR" // arm:"CLZ" arm64:"CLZ" // mips:"CLZ" - // wasm:"I64Clz" + // js/wasm/:"I64Clz" // ppc64x:"CNTLZD" return bits.LeadingZeros16(n) } @@ -62,7 +62,7 @@ func LeadingZeros8(n uint8) int { // s390x:"FLOGR" // arm:"CLZ" arm64:"CLZ" // mips:"CLZ" - // wasm:"I64Clz" + // js/wasm/:"I64Clz" // ppc64x:"CNTLZD" return bits.LeadingZeros8(n) } @@ -77,7 +77,7 @@ func Len(n uint) int { // s390x:"FLOGR" // arm:"CLZ" arm64:"CLZ" // mips:"CLZ" - // wasm:"I64Clz" + // js/wasm/:"I64Clz" // ppc64x:"SUBC","CNTLZD" return bits.Len(n) } @@ -88,7 +88,7 @@ func Len64(n uint64) int { // s390x:"FLOGR" // arm:"CLZ" arm64:"CLZ" // mips:"CLZ" - // wasm:"I64Clz" + // js/wasm/:"I64Clz" // ppc64x:"SUBC","CNTLZD" return bits.Len64(n) } @@ -104,7 +104,7 @@ func Len32(n uint32) int { // s390x:"FLOGR" // arm:"CLZ" arm64:"CLZ" // mips:"CLZ" - // wasm:"I64Clz" + // js/wasm/:"I64Clz" // ppc64x: "CNTLZW" return bits.Len32(n) } @@ -115,7 +115,7 @@ func Len16(n uint16) int { // s390x:"FLOGR" // arm:"CLZ" arm64:"CLZ" // mips:"CLZ" - // wasm:"I64Clz" + // js/wasm/:"I64Clz" // ppc64x:"SUBC","CNTLZD" return bits.Len16(n) } @@ -126,7 +126,7 @@ func Len8(n uint8) int { // s390x:"FLOGR" // arm:"CLZ" arm64:"CLZ" // mips:"CLZ" - // wasm:"I64Clz" + // js/wasm/:"I64Clz" // ppc64x:"SUBC","CNTLZD" return bits.Len8(n) } @@ -142,7 +142,7 @@ func OnesCount(n uint) int { // arm64:"VCNT","VUADDLV" // s390x:"POPCNT" // ppc64x:"POPCNTD" - // wasm:"I64Popcnt" + // js/wasm/:"I64Popcnt" return bits.OnesCount(n) } @@ -152,7 +152,7 @@ func OnesCount64(n uint64) int { // arm64:"VCNT","VUADDLV" // s390x:"POPCNT" // ppc64x:"POPCNTD" - // wasm:"I64Popcnt" + // js/wasm/:"I64Popcnt" return bits.OnesCount64(n) } @@ -162,7 +162,7 @@ func OnesCount32(n uint32) int { // arm64:"VCNT","VUADDLV" // s390x:"POPCNT" // ppc64x:"POPCNTW" - // wasm:"I64Popcnt" + // js/wasm/:"I64Popcnt" return bits.OnesCount32(n) } @@ -172,14 +172,14 @@ func OnesCount16(n uint16) int { // arm64:"VCNT","VUADDLV" // s390x:"POPCNT" // ppc64x:"POPCNTW" - // wasm:"I64Popcnt" + // js/wasm/:"I64Popcnt" return bits.OnesCount16(n) } func OnesCount8(n uint8) int { // s390x:"POPCNT" // ppc64x:"POPCNTB" - // wasm:"I64Popcnt" + // js/wasm/:"I64Popcnt" return bits.OnesCount8(n) } @@ -232,7 +232,7 @@ func RotateLeft64(n uint64) uint64 { // arm64:"ROR" // ppc64x:"ROTL" // s390x:"RISBGZ\t[$]0, [$]63, [$]37, " - // wasm:"I64Rotl" + // js/wasm/:"I64Rotl" return bits.RotateLeft64(n, 37) } @@ -242,7 +242,7 @@ func RotateLeft32(n uint32) uint32 { // arm64:"RORW" // ppc64x:"ROTLW" // s390x:"RLL" - // wasm:"I32Rotl" + // js/wasm/:"I32Rotl" return bits.RotateLeft32(n, 9) } @@ -263,7 +263,7 @@ func RotateLeftVariable(n uint, m int) uint { // arm64:"ROR" // ppc64x:"ROTL" // s390x:"RLLG" - // wasm:"I64Rotl" + // js/wasm/:"I64Rotl" return bits.RotateLeft(n, m) } @@ -272,7 +272,7 @@ func RotateLeftVariable64(n uint64, m int) uint64 { // arm64:"ROR" // ppc64x:"ROTL" // s390x:"RLLG" - // wasm:"I64Rotl" + // js/wasm/:"I64Rotl" return bits.RotateLeft64(n, m) } @@ -282,7 +282,7 @@ func RotateLeftVariable32(n uint32, m int) uint32 { // arm64:"RORW" // ppc64x:"ROTLW" // s390x:"RLL" - // wasm:"I32Rotl" + // js/wasm/:"I32Rotl" return bits.RotateLeft32(n, m) } @@ -299,7 +299,7 @@ func TrailingZeros(n uint) int { // s390x:"FLOGR" // ppc64x/power8:"ANDN","POPCNTD" // ppc64x/power9: "CNTTZD" - // wasm:"I64Ctz" + // js/wasm/:"I64Ctz" return bits.TrailingZeros(n) } @@ -311,7 +311,7 @@ func TrailingZeros64(n uint64) int { // s390x:"FLOGR" // ppc64x/power8:"ANDN","POPCNTD" // ppc64x/power9: "CNTTZD" - // wasm:"I64Ctz" + // js/wasm/:"I64Ctz" return bits.TrailingZeros64(n) } @@ -330,7 +330,7 @@ func TrailingZeros32(n uint32) int { // s390x:"FLOGR","MOVWZ" // ppc64x/power8:"ANDN","POPCNTW" // ppc64x/power9: "CNTTZW" - // wasm:"I64Ctz" + // js/wasm/:"I64Ctz" return bits.TrailingZeros32(n) } @@ -342,7 +342,7 @@ func TrailingZeros16(n uint16) int { // s390x:"FLOGR","OR\t\\$65536" // ppc64x/power8:"POPCNTD","OR\\t\\$65536" // ppc64x/power9:"CNTTZD","OR\\t\\$65536" - // wasm:"I64Ctz" + // js/wasm/:"I64Ctz" return bits.TrailingZeros16(n) } @@ -352,7 +352,7 @@ func TrailingZeros8(n uint8) int { // arm:"ORR\t\\$256","CLZ",-"MOVBU\tR" // arm64:"ORR\t\\$256","RBITW","CLZW",-"MOVBU\tR",-"RBIT\t",-"CLZ\t" // s390x:"FLOGR","OR\t\\$256" - // wasm:"I64Ctz" + // js/wasm/:"I64Ctz" return bits.TrailingZeros8(n) } diff --git a/test/codegen/shift.go b/test/codegen/shift.go index d34ff9b428dede..22eaf511a62d41 100644 --- a/test/codegen/shift.go +++ b/test/codegen/shift.go @@ -197,7 +197,7 @@ func lshGuarded64(v int64, s uint) int64 { if s < 64 { // riscv64:"SLL",-"AND",-"SLTIU" // s390x:-"RISBGZ",-"AND",-"LOCGR" - // wasm:-"Select",-".*LtU" + // js/wasm/:-"Select",-".*LtU" // arm64:"LSL",-"CSEL" return v << s } @@ -208,7 +208,7 @@ func rshGuarded64U(v uint64, s uint) uint64 { if s < 64 { // riscv64:"SRL",-"AND",-"SLTIU" // s390x:-"RISBGZ",-"AND",-"LOCGR" - // wasm:-"Select",-".*LtU" + // js/wasm/:-"Select",-".*LtU" // arm64:"LSR",-"CSEL" return v >> s } @@ -219,7 +219,7 @@ func rshGuarded64(v int64, s uint) int64 { if s < 64 { // riscv64:"SRA",-"OR",-"SLTIU" // s390x:-"RISBGZ",-"AND",-"LOCGR" - // wasm:-"Select",-".*LtU" + // js/wasm/:-"Select",-".*LtU" // arm64:"ASR",-"CSEL" return v >> s } diff --git a/test/codegen/strings.go b/test/codegen/strings.go index a2c2fc0a629b0c..1b05bb1164e6e9 100644 --- a/test/codegen/strings.go +++ b/test/codegen/strings.go @@ -25,28 +25,28 @@ func ToByteSlice() []byte { // Issue #24698 func ConstantLoad() { // 12592 = 0x3130 // 50 = 0x32 - // amd64:`MOVW\t\$12592, \(`,`MOVB\t\$50, 2\(` - // 386:`MOVW\t\$12592, \(`,`MOVB\t\$50, 2\(` - // arm:`MOVW\t\$48`,`MOVW\t\$49`,`MOVW\t\$50` - // arm64:`MOVD\t\$12592`,`MOVD\t\$50` - // wasm:`I64Const\t\$12592`,`I64Store16\t\$0`,`I64Const\t\$50`,`I64Store8\t\$2` - // mips64:`MOVV\t\$48`,`MOVV\t\$49`,`MOVV\t\$50` + // amd64:`MOVW\t\$12592, \(`,`MOVB\t\$50, 2\(` + // 386:`MOVW\t\$12592, \(`,`MOVB\t\$50, 2\(` + // arm:`MOVW\t\$48`,`MOVW\t\$49`,`MOVW\t\$50` + // arm64:`MOVD\t\$12592`,`MOVD\t\$50` + // js/wasm/:`I64Const\t\$12592`,`I64Store16\t\$0`,`I64Const\t\$50`,`I64Store8\t\$2` + // mips64:`MOVV\t\$48`,`MOVV\t\$49`,`MOVV\t\$50` bsink = []byte("012") // 858927408 = 0x33323130 // 13620 = 0x3534 - // amd64:`MOVL\t\$858927408`,`MOVW\t\$13620, 4\(` - // 386:`MOVL\t\$858927408`,`MOVW\t\$13620, 4\(` - // arm64:`MOVD\t\$858927408`,`MOVD\t\$13620` - // wasm:`I64Const\t\$858927408`,`I64Store32\t\$0`,`I64Const\t\$13620`,`I64Store16\t\$4` + // amd64:`MOVL\t\$858927408`,`MOVW\t\$13620, 4\(` + // 386:`MOVL\t\$858927408`,`MOVW\t\$13620, 4\(` + // arm64:`MOVD\t\$858927408`,`MOVD\t\$13620` + // js/wasm/:`I64Const\t\$858927408`,`I64Store32\t\$0`,`I64Const\t\$13620`,`I64Store16\t\$4` bsink = []byte("012345") // 3978425819141910832 = 0x3736353433323130 // 7306073769690871863 = 0x6564636261393837 - // amd64:`MOVQ\t\$3978425819141910832`,`MOVQ\t\$7306073769690871863` - // 386:`MOVL\t\$858927408, \(`,`DUFFCOPY` - // arm64:`MOVD\t\$3978425819141910832`,`MOVD\t\$7306073769690871863`,`MOVD\t\$15` - // wasm:`I64Const\t\$3978425819141910832`,`I64Store\t\$0`,`I64Const\t\$7306073769690871863`,`I64Store\t\$7` + // amd64:`MOVQ\t\$3978425819141910832`,`MOVQ\t\$7306073769690871863` + // 386:`MOVL\t\$858927408, \(`,`DUFFCOPY` + // arm64:`MOVD\t\$3978425819141910832`,`MOVD\t\$7306073769690871863`,`MOVD\t\$15` + // js/wasm/:`I64Const\t\$3978425819141910832`,`I64Store\t\$0`,`I64Const\t\$7306073769690871863`,`I64Store\t\$7` bsink = []byte("0123456789abcde") // 56 = 0x38 diff --git a/test/fixedbugs/issue21317.go b/test/fixedbugs/issue21317.go index 81379dcc335dfd..75d871cbae52a3 100644 --- a/test/fixedbugs/issue21317.go +++ b/test/fixedbugs/issue21317.go @@ -1,4 +1,4 @@ -// +build !js,gc +// +build !js,!wasip1,gc // run // Copyright 2017 The Go Authors. All rights reserved. diff --git a/test/fixedbugs/issue22662b.go b/test/fixedbugs/issue22662b.go index df4f28429c7a12..c7a1e0558b5016 100644 --- a/test/fixedbugs/issue22662b.go +++ b/test/fixedbugs/issue22662b.go @@ -1,4 +1,4 @@ -// +build !js,gc +// +build !js,!wasip1,gc // run // Copyright 2018 The Go Authors. All rights reserved. diff --git a/test/fixedbugs/issue46234.go b/test/fixedbugs/issue46234.go index ed1c05cfbf4b81..ae280190ebc598 100644 --- a/test/fixedbugs/issue46234.go +++ b/test/fixedbugs/issue46234.go @@ -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 diff --git a/test/linkmain_run.go b/test/linkmain_run.go index f4f6c4320e9cd9..579fe837cb34be 100644 --- a/test/linkmain_run.go +++ b/test/linkmain_run.go @@ -1,4 +1,4 @@ -// +build !nacl,!js +// +build !nacl,!js,!wasip1 // run // Copyright 2014 The Go Authors. All rights reserved. @@ -61,15 +61,15 @@ func main() { return filepath.Join(tmpDir, name) } - importcfg, err := exec.Command("go", "list", "-export", "-f", "{{if .Export}}packagefile {{.ImportPath}}={{.Export}}{{end}}", "std").Output() - if err != nil { - fmt.Println(err) - os.Exit(1) - } - os.WriteFile(tmp("importcfg"), importcfg, 0644) + importcfg, err := exec.Command("go", "list", "-export", "-f", "{{if .Export}}packagefile {{.ImportPath}}={{.Export}}{{end}}", "std").Output() + if err != nil { + fmt.Println(err) + os.Exit(1) + } + os.WriteFile(tmp("importcfg"), importcfg, 0644) // helloworld.go is package main - run("go tool compile -p=main -importcfg", tmp("importcfg"), "-o", tmp("linkmain.o"), "helloworld.go") + run("go tool compile -p=main -importcfg", tmp("importcfg"), "-o", tmp("linkmain.o"), "helloworld.go") run("go tool compile -p=main -importcfg", tmp("importcfg"), " -pack -o", tmp("linkmain.a"), "helloworld.go") run("go tool link -importcfg", tmp("importcfg"), "-o", tmp("linkmain.exe"), tmp("linkmain.o")) run("go tool link -importcfg", tmp("importcfg"), "-o", tmp("linkmain.exe"), tmp("linkmain.a")) diff --git a/test/linkobj.go b/test/linkobj.go index 35ff63ba6722b9..fcf3f88919d710 100644 --- a/test/linkobj.go +++ b/test/linkobj.go @@ -1,4 +1,4 @@ -// +build !nacl,!js,gc +// +build !nacl,!js,gc,!wasip1 // run // Copyright 2016 The Go Authors. All rights reserved. diff --git a/test/live_uintptrkeepalive.go b/test/live_uintptrkeepalive.go index e39e31f77faf93..566734e5051c7b 100644 --- a/test/live_uintptrkeepalive.go +++ b/test/live_uintptrkeepalive.go @@ -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