Skip to content

Commit

Permalink
Run wasm tests on Windows
Browse files Browse the repository at this point in the history
This commit fixes running the test suite on Windows for CI at least by
fixing up a few minor edge cases to ensure that everything runs
consistently.
  • Loading branch information
alexcrichton committed Jul 31, 2024
1 parent 0de1b48 commit 35af423
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- 'wasi-sdk-*'
branches:
- main
- test-on-windows

pull_request:
workflow_dispatch:
Expand Down Expand Up @@ -59,13 +60,6 @@ jobs:
- artifact: x86_64-windows
os: windows-latest
env:
# TODO: tests are pretty close to passing on Windows but need some
# final tweaks, namely testing the exit code doesn't work since
# exit codes are different on Windows and the `mmap.c` tests seems
# to have issues probably with line endings. Needs someone with a
# Windows checkout tot test further.
WASI_SDK_CI_SKIP_TESTS: 1

env: ${{ matrix.env || fromJSON('{}') }}
steps:
Expand Down
3 changes: 3 additions & 0 deletions tests/general/mmap.c.dir/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This input is read at runtime during testing so ensure that the same input is
# read on unix and windows by forcing just-a-newline for line endings.
*.txt text eol=lf
8 changes: 8 additions & 0 deletions tests/testcase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ exit_status=0
|| exit_status=$?
echo $exit_status > "$exit_status_observed"

# On Windows Wasmtime will exit with error code 3 for aborts. On Unix Wasmtime
# will exit with status 134. Paper over this difference by pretending to be Unix
# on Windows and converting exit code 3 into 134 for the purposes of asserting
# test output.
if [ "$OSTYPE" = "msys" ] && [ "$exit_status" = "3" ]; then
echo 134 > "$exit_status_observed"
fi

# Determine the reference files to compare with.
if [ -e "$input.stdout.expected" ]; then
stdout_expected="$input.stdout.expected"
Expand Down

0 comments on commit 35af423

Please sign in to comment.