Skip to content

Commit b267916

Browse files
authored
Run wasm tests on Windows (#466)
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.
1 parent 883170d commit b267916

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,6 @@ jobs:
5959
6060
- artifact: x86_64-windows
6161
os: windows-latest
62-
env:
63-
# TODO: tests are pretty close to passing on Windows but need some
64-
# final tweaks, namely testing the exit code doesn't work since
65-
# exit codes are different on Windows and the `mmap.c` tests seems
66-
# to have issues probably with line endings. Needs someone with a
67-
# Windows checkout tot test further.
68-
WASI_SDK_CI_SKIP_TESTS: 1
6962

7063
env: ${{ matrix.env || fromJSON('{}') }}
7164
steps:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This input is read at runtime during testing so ensure that the same input is
2+
# read on unix and windows by forcing just-a-newline for line endings.
3+
*.txt text eol=lf

tests/testcase.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ exit_status=0
5353
|| exit_status=$?
5454
echo $exit_status > "$exit_status_observed"
5555

56+
# On Windows Wasmtime will exit with error code 3 for aborts. On Unix Wasmtime
57+
# will exit with status 134. Paper over this difference by pretending to be Unix
58+
# on Windows and converting exit code 3 into 134 for the purposes of asserting
59+
# test output.
60+
if [ "$OSTYPE" = "msys" ] && [ "$exit_status" = "3" ]; then
61+
echo 134 > "$exit_status_observed"
62+
fi
63+
5664
# Determine the reference files to compare with.
5765
if [ -e "$input.stdout.expected" ]; then
5866
stdout_expected="$input.stdout.expected"

0 commit comments

Comments
 (0)