ci: run integration tests against the optimizing compiler (linux/arm64) (#1875)

Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
Co-authored-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
This commit is contained in:
Edoardo Vacchi
2023-12-15 18:24:07 +01:00
committed by GitHub
parent a6fea913e8
commit ebaa5a0ebf
2 changed files with 133 additions and 27 deletions

View File

@@ -75,12 +75,18 @@ jobs:
zig: zig:
needs: build_zig_test_binary needs: build_zig_test_binary
name: Zig (${{ matrix.os }}) name: Zig (${{ matrix.os }}, ${{ matrix.arch }}, ${{ matrix.compiler }}-compiler)
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false # don't fail fast as sometimes failures are arch/OS specific fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
matrix: matrix:
os: [ubuntu-22.04, macos-12, windows-2022] os: [ubuntu-22.04, macos-12, windows-2022]
compiler: [baseline]
arch: [amd64]
include:
- os: ubuntu-22.04
compiler: optimizing
arch: "arm64"
steps: steps:
- name: Checkout wazero - name: Checkout wazero
@@ -101,15 +107,41 @@ jobs:
with: with:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
- name: Install wazero - name: Build wazero
run: go install ./cmd/wazero run: go build -o ./wazerocli ./cmd/wazero
env:
GOARCH: ${{ matrix.arch }}
# This runs the previously compiled Zig tests with wazero. If you need - name: Set up QEMU
# to troubleshoot one, you can add "-hostlogging=filesystem" after if: ${{ matrix.compiler == 'optimizing' && matrix.arch == 'arm64' }}
# adding filter argument to the "Build Stdlib test binary" step. uses: docker/setup-qemu-action@v2
with: # Avoid docker.io rate-limits; built with internal-images.yml
image: ghcr.io/tetratelabs/wazero/internal-binfmt
platforms: ${{ matrix.arch }}
- name: Build scratch container
if: ${{ matrix.compiler == 'optimizing' }}
run: |
echo 'FROM scratch' >> Dockerfile
echo 'CMD ["/test"]' >> Dockerfile
docker buildx build -t wazero:test --platform linux/${{ matrix.arch }} .
# The following two steps run the previously compiled Zig tests with wazero.
# If you need to troubleshoot any of the test, you can add "-hostlogging=filesystem" after
# adding filter argument either to step "Run built test binaries" or
# "Run built test binaries (container)".
# e.g. --test-filter "Dir.Iterator but dir is deleted during iteration" # e.g. --test-filter "Dir.Iterator but dir is deleted during iteration"
- name: Run the test binary with wazero CLI
run: wazero run -mount=:/ ./zigbin/test.wasm - name: Run built test binaries (container)
if: ${{ matrix.compiler == 'optimizing' }}
run: |
docker run --platform linux/${{ matrix.arch }} -v $(pwd)/zigbin:/test -v $(pwd)/wazerocli:/wazero -e WAZEROCLI=/wazero --tmpfs /tmp --rm -t wazero:test \
/wazero run -optimizing-compiler -mount=:/ ./test/test.wasm
- name: Run built test binaries
if: ${{ matrix.compiler != 'optimizing' }}
run: ./wazerocli run -mount=:/ ./zigbin/test.wasm
build_tinygo_test_binary: build_tinygo_test_binary:
name: Build TinyGo test binary name: Build TinyGo test binary
@@ -194,12 +226,18 @@ jobs:
tinygo: tinygo:
needs: build_tinygo_test_binary needs: build_tinygo_test_binary
name: TinyGo (${{ matrix.os }}) name: TinyGo (${{ matrix.os }}, ${{ matrix.arch }}, ${{ matrix.compiler }}-compiler)
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false # don't fail fast as sometimes failures are arch/OS specific fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
matrix: matrix:
os: [ubuntu-22.04, macos-12, windows-2022] os: [ubuntu-22.04, macos-12, windows-2022]
compiler: [baseline]
arch: [amd64]
include:
- os: ubuntu-22.04
compiler: optimizing
arch: "arm64"
steps: steps:
- name: Checkout wazero - name: Checkout wazero
@@ -220,19 +258,48 @@ jobs:
with: with:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
- name: Install wazero - name: Build wazero
run: go install ./cmd/wazero run: go build -o ~/wazerocli ./cmd/wazero
env:
GOARCH: ${{ matrix.arch }}
# This runs the previously compiled TinyGo tests with wazero. If you need - name: Set up QEMU
if: ${{ matrix.compiler == 'optimizing' && matrix.arch == 'arm64' }}
uses: docker/setup-qemu-action@v2
with: # Avoid docker.io rate-limits; built with internal-images.yml
image: ghcr.io/tetratelabs/wazero/internal-binfmt
platforms: ${{ matrix.arch }}
- name: Build scratch container
if: ${{ matrix.compiler == 'optimizing' }}
run: |
echo 'FROM scratch' >> Dockerfile
echo 'CMD ["/test"]' >> Dockerfile
docker buildx build -t wazero:test --platform linux/${{ matrix.arch }} .
# The following steps run the previously compiled TinyGo tests with wazero. If you need
# to troubleshoot one, you can add "-hostlogging=filesystem" and also a # to troubleshoot one, you can add "-hostlogging=filesystem" and also a
# trailing argument narrowing which test to execute. # trailing argument narrowing which test to execute.
# e.g. "-test.run '^TestStatBadDir$'" # e.g. "-test.run '^TestStatBadDir$'"
- name: Run standard library tests
- name: Run test binaries (container)
if: ${{ matrix.compiler == 'optimizing' }}
# This runs all tests compiled above in sequence. Note: This mounts /tmp to allow t.TempDir() in tests.
run: | run: |
cd ./tinygobin cd ./tinygobin
for bin in *.test; do for bin in *.test; do
echo $bin echo $bin
wazero run -mount=:/ -mount=:/tmp $bin -- -test.v docker run --platform linux/${{ matrix.arch }} -v $(pwd):/test -v ~/wazerocli:/wazero -e WAZEROCLI=/wazero --tmpfs /tmp --rm -t wazero:test \
/wazero run -optimizing-compiler -mount=:/ /test/$bin -- -test.v
done
- name: Run test binaries
if: ${{ matrix.compiler != 'optimizing' }}
run: |
cd ./tinygobin
for bin in *.test; do
echo $bin
~/wazerocli run -mount=:/ -mount=:/tmp $bin -- -test.v
done done
wasi-testsuite: wasi-testsuite:
@@ -325,15 +392,21 @@ jobs:
go_tests: go_tests:
# Due to the embedding of the GOROOT of the building env(https://github.com/golang/go/blob/3c59639b902fada0a2e5a6a35bafd10fc9183b89/src/os/os_test.go#L112), # Due to the embedding of the GOROOT of the building env(https://github.com/golang/go/blob/3c59639b902fada0a2e5a6a35bafd10fc9183b89/src/os/os_test.go#L112),
# we have to build and cache on each OS unlike others in this file. # we have to build and cache on each OS unlike others in this file.
name: Go (${{ matrix.os }}, Go-${{ matrix.go-version }}) name: Go (${{ matrix.os }}, Go-${{ matrix.go-version }}, ${{ matrix.arch }}, ${{ matrix.compiler }}-compiler)
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false # don't fail fast as sometimes failures are arch/OS specific fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
matrix: matrix:
os: [ubuntu-22.04, macos-12, windows-2022] os: [ubuntu-22.04, macos-12, windows-2022]
compiler: [baseline]
arch: [amd64]
go-version: go-version:
- "1.21" # Current Go version && The only version that supports wasip1. - "1.21" # Current Go version && The only version that supports wasip1.
include:
- os: ubuntu-22.04
compiler: optimizing
arch: "arm64"
go-version: "1.21"
steps: steps:
- id: setup-go - id: setup-go
uses: actions/setup-go@v4 uses: actions/setup-go@v4
@@ -425,11 +498,44 @@ jobs:
- name: Checkout wazero - name: Checkout wazero
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Install wazero - name: Build wazero
run: go install ./cmd/wazero run: go build -o ~/wazerocli ./cmd/wazero
env:
GOARCH: ${{ matrix.arch }}
- if: ${{ runner.os != 'Windows' }} - name: Set up QEMU
name: Run standard library tests if: ${{ matrix.compiler == 'optimizing' && matrix.arch == 'arm64' }}
uses: docker/setup-qemu-action@v2
with: # Avoid docker.io rate-limits; built with internal-images.yml
image: ghcr.io/tetratelabs/wazero/internal-binfmt
platforms: ${{ matrix.arch }}
- name: Build scratch container
if: ${{ matrix.compiler == 'optimizing' }}
run: |
echo 'FROM scratch' >> Dockerfile
echo 'CMD ["/test"]' >> Dockerfile
docker buildx build -t wazero:test --platform linux/${{ matrix.arch }} .
- if: ${{ matrix.compiler == 'optimizing' }}
name: Run test binaries (container)
run: |
echo "Running $(find ~/tests -name *.test | wc -l) test binaries"
# Skip tests that are hideously slow (mostly compilation time) for running inside QEMU.
skip_targets="src_encoding_json|src_runtime|src_os_exec|src_math_big|src_encoding_gob|src_time|src_archive_tar|src_math_rand|src_expvar|src_testing|src_os"
# Go tests often look for files relative to the source. Change to the corresponding directory.
for bin in $(find ~/tests -name "*.test" | grep -vE "$skip_targets"); do
dir=$(basename $bin); dir=${dir%.test}; dir=${dir//_/\/}
pushd $(go env GOROOT)/$dir
# Mount / as /ROOT in docker and then remount /ROOT as / in wazero; $bin is now in /ROOT/$bin.
docker run --platform linux/arm64 -v /:/ROOT -v ~/wazerocli:/wazero -e WAZEROCLI=/wazero --tmpfs /tmp --rm -t wazero:test \
/wazero run -optimizing-compiler -mount=/ROOT:/ -mount=/tmp:/tmp -env PWD=$PWD /ROOT/$bin -- -test.short -test.v
popd
done
- if: ${{ matrix.compiler != 'optimizing' && runner.os != 'Windows' }}
name: Run test binaries
run: | run: |
echo "Running $(find ~/tests -name *.test | wc -l) test binaries" echo "Running $(find ~/tests -name *.test | wc -l) test binaries"
@@ -437,12 +543,12 @@ jobs:
for bin in ~/tests/*.test; do for bin in ~/tests/*.test; do
dir=$(basename $bin); dir=${dir%.test}; dir=${dir//_/\/} dir=$(basename $bin); dir=${dir%.test}; dir=${dir//_/\/}
pushd $(go env GOROOT)/$dir pushd $(go env GOROOT)/$dir
wazero run -mount=/:/ -env PWD=$PWD $bin -- -test.short -test.v ~/wazerocli run -mount=/:/ -env PWD=$PWD $bin -- -test.short -test.v
popd popd
done done
- if: ${{ runner.os == 'Windows' }} - if: ${{ runner.os == 'Windows' }}
name: Run standard library tests name: Run test binaries (Windows)
# Ack failures on Windows. https://github.com/tetratelabs/wazero/issues/1410 # Ack failures on Windows. https://github.com/tetratelabs/wazero/issues/1410
continue-on-error: true continue-on-error: true
run: | run: |
@@ -471,7 +577,7 @@ jobs:
# Create a script with all the tests (do not run yet). # Create a script with all the tests (do not run yet).
echo ${MOUNT} ${IN_WASM_PWD} $GOROOT/$dir echo ${MOUNT} ${IN_WASM_PWD} $GOROOT/$dir
COMMAND="wazero run -mount=${MOUNT} ${EXTRAPARAMS} -hostlogging=filesystem -env PWD=${IN_WASM_PWD} -env GOROOT=${GOROOT} -env GOOS=wasip1 $bin -- -test.short -test.v" COMMAND="~/wazerocli run -mount=${MOUNT} ${EXTRAPARAMS} -hostlogging=filesystem -env PWD=${IN_WASM_PWD} -env GOROOT=${GOROOT} -env GOOS=wasip1 $bin -- -test.short -test.v"
echo $COMMAND >> $SCRIPT echo $COMMAND >> $SCRIPT
# Uncomment the following line for early exit on error on Windows. # Uncomment the following line for early exit on error on Windows.
# Otherwise the tests will report are successful evne on failure. # Otherwise the tests will report are successful evne on failure.

View File

@@ -395,7 +395,7 @@ func opaqueViewFromPtr(ptr uintptr) []byte {
return opaque return opaque
} }
const callStackCeiling = uintptr(5000000) // in uint64 (8 bytes) == 40000000 bytes in total == 40mb. const callStackCeiling = uintptr(50000000) // in uint64 (8 bytes) == 400000000 bytes in total == 400mb.
func (c *callEngine) growStackWithGuarded() (newSP uintptr, err error) { func (c *callEngine) growStackWithGuarded() (newSP uintptr, err error) {
if wazevoapi.StackGuardCheckEnabled { if wazevoapi.StackGuardCheckEnabled {