chore: add a regression test for WASI (#4822)

Currently, we only have WASM regression tests that run without WASI.
However, rust provides a WASI specific target which enables code to
special case WASI. This PR adds a basic test to cover that case.

This is an initial addition to help land tokio-rs/tokio#4716.
This commit is contained in:
Carl Lerche
2022-07-11 12:06:40 -07:00
committed by GitHub
parent 4daeea8cad
commit ad942de2b7
4 changed files with 95 additions and 1 deletions
+35
View File
@@ -48,6 +48,7 @@ jobs:
- check-readme
- test-hyper
- wasm32-unknown-unknown
- wasm32-wasi
steps:
- run: exit 0
@@ -462,3 +463,37 @@ jobs:
- name: test tokio
run: wasm-pack test --node -- --features "macros sync"
working-directory: tokio
wasm32-wasi:
name: wasm32-wasi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust ${{ env.rust_stable }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.rust_stable }}
override: true
- uses: Swatinem/rust-cache@v1
# Install dependencies
- name: Install cargo-hack
run: cargo install cargo-hack
- name: Install wasm32-wasi target
run: rustup target add wasm32-wasi
- name: Install wasmtime
run: cargo install wasmtime-cli
- name: Install cargo-wasi
run: cargo install cargo-wasi
# TODO: Expand this when full WASI support lands.
# Currently, this is a bare bones regression test
# for features that work today with wasi.
- name: test tests-integration --features wasi-rt
# TODO: this should become: `cargo hack wasi test --each-feature`
run: cargo wasi test --test rt_yield --features wasi-rt
working-directory: tests-integration