ci: update TinyGo to 0.27 (#1120)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
2
.github/workflows/examples.yaml
vendored
2
.github/workflows/examples.yaml
vendored
@@ -17,7 +17,7 @@ on:
|
||||
|
||||
env:
|
||||
EMSDK_VERSION: "3.1.24"
|
||||
TINYGO_VERSION: "0.26.0"
|
||||
TINYGO_VERSION: "0.27.0"
|
||||
ZIG_VERSION: "0.11.0-dev.1499+23b7d2889"
|
||||
|
||||
concurrency:
|
||||
|
||||
4
.github/workflows/integration.yaml
vendored
4
.github/workflows/integration.yaml
vendored
@@ -20,7 +20,7 @@ defaults:
|
||||
env: # Update this prior to requiring a higher minor version in go.mod
|
||||
GO_VERSION: "1.19" # 1.xx == latest patch of 1.xx
|
||||
ZIG_VERSION: "0.11.0-dev.1499+23b7d2889"
|
||||
TINYGO_VERSION: "0.26.0"
|
||||
TINYGO_VERSION: "0.27.0"
|
||||
|
||||
concurrency:
|
||||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
||||
@@ -146,7 +146,7 @@ jobs:
|
||||
- name: Build Test Binaries
|
||||
if: steps.check-exist.outputs.exist == 'false'
|
||||
# The following list of packages is derived from:
|
||||
# https://github.com/tinygo-org/tinygo/blob/v0.26.0/Makefile#L271-L319
|
||||
# https://github.com/tinygo-org/tinygo/blob/v0.27.0/Makefile#L277-L324
|
||||
# Note:
|
||||
# - index/suffixarray is extremely slow, so skip it.
|
||||
# - compress/zlib is skipped as it depends on the local files https://github.com/golang/go/blob/go1.20/src/compress/zlib/writer_test.go#L16-L30
|
||||
|
||||
2
Makefile
2
Makefile
@@ -69,8 +69,6 @@ build.examples.tinygo: $(tinygo_sources)
|
||||
@for f in $^; do \
|
||||
tinygo build -o $$(echo $$f | sed -e 's/\.go/\.wasm/') -scheduler=none --no-debug --target=wasi $$f; \
|
||||
done
|
||||
# Need DWARF sections.
|
||||
tinygo build -o internal/testing/dwarftestdata/testdata/tinygo/main.wasm -scheduler=none --target=wasi internal/testing/dwarftestdata/testdata/tinygo/main.go
|
||||
|
||||
# We use zig to build C as it is easy to install and embeds a copy of zig-cc.
|
||||
c_sources := imports/wasi_snapshot_preview1/example/testdata/zig-cc/cat.c imports/wasi_snapshot_preview1/testdata/zig-cc/wasi.c
|
||||
|
||||
@@ -45,27 +45,6 @@ func TestWithDebugInfo(t *testing.T) {
|
||||
bin []byte
|
||||
exp string
|
||||
}{
|
||||
{
|
||||
name: "tinygo",
|
||||
bin: dwarftestdata.TinyGoWasm,
|
||||
exp: `module[] function[_start] failed: wasm error: unreachable
|
||||
wasm stack trace:
|
||||
.runtime._panic(i32)
|
||||
0x16e2: /runtime_tinygowasm.go:73:6 (inlined)
|
||||
/panic.go:52:7
|
||||
.c()
|
||||
0x1911: /main.go:19:7
|
||||
.b()
|
||||
0x1901: /main.go:14:3
|
||||
.a()
|
||||
0x18f7: /main.go:9:3
|
||||
.main.main()
|
||||
0x18ed: /main.go:4:3
|
||||
.runtime.run()
|
||||
0x18cc: /scheduler_none.go:26:10
|
||||
._start()
|
||||
0x18b6: /runtime_wasm_wasi.go:22:5`,
|
||||
},
|
||||
{
|
||||
name: "zig",
|
||||
bin: dwarftestdata.ZigWasm,
|
||||
|
||||
BIN
examples/allocation/tinygo/testdata/greet.wasm
vendored
BIN
examples/allocation/tinygo/testdata/greet.wasm
vendored
Binary file not shown.
BIN
examples/basic/testdata/add.wasm
vendored
BIN
examples/basic/testdata/add.wasm
vendored
Binary file not shown.
BIN
examples/cli/testdata/cli.wasm
vendored
BIN
examples/cli/testdata/cli.wasm
vendored
Binary file not shown.
Binary file not shown.
@@ -13,9 +13,6 @@ import (
|
||||
// line number, source code file, etc, can change. Therefore,
|
||||
// even though these binaries are huge, we check them in to the repositories.
|
||||
|
||||
//go:embed testdata/tinygo/main.wasm
|
||||
var TinyGoWasm []byte
|
||||
|
||||
//go:embed testdata/zig/main.wasm
|
||||
var ZigWasm []byte
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
a()
|
||||
}
|
||||
|
||||
//export a
|
||||
func a() {
|
||||
b()
|
||||
}
|
||||
|
||||
//export b
|
||||
func b() {
|
||||
c()
|
||||
}
|
||||
|
||||
//export c
|
||||
func c() {
|
||||
panic("NOOOOOOOOOOOOOOO")
|
||||
}
|
||||
Binary file not shown.
@@ -158,13 +158,13 @@ func TestDecodeModule(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("DWARF enabled", func(t *testing.T) {
|
||||
m, err := DecodeModule(dwarftestdata.TinyGoWasm, api.CoreFeaturesV2, wasm.MemoryLimitPages, false, true, true)
|
||||
m, err := DecodeModule(dwarftestdata.ZigWasm, api.CoreFeaturesV2, wasm.MemoryLimitPages, false, true, true)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, m.DWARFLines)
|
||||
})
|
||||
|
||||
t.Run("DWARF disabled", func(t *testing.T) {
|
||||
m, err := DecodeModule(dwarftestdata.TinyGoWasm, api.CoreFeaturesV2, wasm.MemoryLimitPages, false, false, true)
|
||||
m, err := DecodeModule(dwarftestdata.ZigWasm, api.CoreFeaturesV2, wasm.MemoryLimitPages, false, false, true)
|
||||
require.NoError(t, err)
|
||||
require.Nil(t, m.DWARFLines)
|
||||
})
|
||||
|
||||
@@ -2,71 +2,16 @@ package wasmdebug_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/tetratelabs/wazero/api"
|
||||
"github.com/tetratelabs/wazero/internal/testing/dwarftestdata"
|
||||
"github.com/tetratelabs/wazero/internal/testing/hammer"
|
||||
"github.com/tetratelabs/wazero/internal/testing/require"
|
||||
"github.com/tetratelabs/wazero/internal/wasm"
|
||||
"github.com/tetratelabs/wazero/internal/wasm/binary"
|
||||
)
|
||||
|
||||
func TestDWARFLines_Line_TinyGo(t *testing.T) {
|
||||
mod, err := binary.DecodeModule(dwarftestdata.TinyGoWasm, api.CoreFeaturesV2, wasm.MemoryLimitPages, false, true, false)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, mod.DWARFLines)
|
||||
|
||||
// Get the offsets of functions named "a", "b" and "c" in dwarftestdata.TinyGoWasm.
|
||||
var a, b, c uint64
|
||||
for _, exp := range mod.ExportSection {
|
||||
switch exp.Name {
|
||||
case "a":
|
||||
a = mod.CodeSection[exp.Index-mod.ImportFuncCount()].BodyOffsetInCodeSection
|
||||
case "b":
|
||||
b = mod.CodeSection[exp.Index-mod.ImportFuncCount()].BodyOffsetInCodeSection
|
||||
case "c":
|
||||
c = mod.CodeSection[exp.Index-mod.ImportFuncCount()].BodyOffsetInCodeSection
|
||||
}
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
offset uint64
|
||||
exp []string
|
||||
}{
|
||||
// Unknown offset returns empty string.
|
||||
{offset: math.MaxUint64},
|
||||
// The first instruction should point to the first line of each function in internal/testing/dwarftestdata/testdata/tinygo/main.go
|
||||
{offset: a, exp: []string{"wazero/internal/testing/dwarftestdata/testdata/tinygo/main.go:9:3"}},
|
||||
{offset: b, exp: []string{"wazero/internal/testing/dwarftestdata/testdata/tinygo/main.go:14:3"}},
|
||||
{offset: c, exp: []string{"wazero/internal/testing/dwarftestdata/testdata/tinygo/main.go:19:7"}},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
// Ensures that DWARFLines.Line is goroutine-safe.
|
||||
const concurrent = 100
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(concurrent)
|
||||
|
||||
for i := 0; i < concurrent; i++ {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
actual := mod.DWARFLines.Line(tc.offset)
|
||||
|
||||
require.Equal(t, len(tc.exp), len(actual))
|
||||
for i := range tc.exp {
|
||||
require.Contains(t, actual[i], tc.exp[i])
|
||||
}
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestDWARFLines_Line_Zig(t *testing.T) {
|
||||
mod, err := binary.DecodeModule(dwarftestdata.ZigWasm, api.CoreFeaturesV2, wasm.MemoryLimitPages, false, true, false)
|
||||
require.NoError(t, err)
|
||||
@@ -112,14 +57,14 @@ func TestDWARFLines_Line_Zig(t *testing.T) {
|
||||
} {
|
||||
tc := tc
|
||||
t.Run(fmt.Sprintf("%#x/%s", tc.offset, tc.exp), func(t *testing.T) {
|
||||
actual := mod.DWARFLines.Line(tc.offset)
|
||||
|
||||
t.Log(actual)
|
||||
|
||||
require.Equal(t, len(tc.exp), len(actual))
|
||||
for i := range tc.exp {
|
||||
require.Contains(t, actual[i], tc.exp[i])
|
||||
}
|
||||
// Ensures that DWARFLines.Line is goroutine-safe.
|
||||
hammer.NewHammer(t, 100, 5).Run(func(name string) {
|
||||
actual := mod.DWARFLines.Line(tc.offset)
|
||||
require.Equal(t, len(tc.exp), len(actual))
|
||||
for i := range tc.exp {
|
||||
require.Contains(t, actual[i], tc.exp[i])
|
||||
}
|
||||
}, nil)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user