Skip to content

WASI std lib tests fail when the host is Windows (mostly fs-related) #13157

@squeek502

Description

@squeek502

Zig Version

0.10.0-dev.4281+ebeadf9d9

Steps to Reproduce

These tests pass when the host is Linux, but fail when the host is Windows. 6 tests are failing within std/fs/test.zig and 10 are failing across the entire std lib test suite. Not sure exactly what the other 4 are. I'm testing with wasmtime-v1.0.1-x86_64-windows.

Worth noting especially that Dir.deleteTree and Dir.deleteTreeMinStackSize are consistently failing with error.AccessDenied, so all the fs tests that use testing.TmpDir are failing to clean up their directories too.

It's unclear to me exactly where solutions should happen here: are these Zig bugs, wasmtime bugs, or problems with the WASI spec?

Expected Behavior

All tests pass

Actual Behavior

When running just std/fs/test.zig:

>zig test lib/std/fs/test.zig --zig-lib-dir lib --main-pkg-path lib/std --test-cmd wasmtime --test-cmd --dir=. --test-cmd --allow-unknown-exports --test-cmd-bin -target wasm32-wasi
expected error.IsDir, found error.AccessDenied
expected error.PathAlreadyExists, found error.AccessDenied
expected error.IsDir, found error.AccessDenied
23 passed; 17 skipped; 6 failed.
test failureError: failed to run main module `C:\Users\Ryan\Programming\Zig\zig\zig-cache\o\b745ba0bfad688b8844d343fe774832d\test.wasm`

Caused by:
    0: failed to invoke command default
    1: wasm trap: wasm `unreachable` instruction executed
       wasm backtrace:
           0: 0xc725 - os.abort
                           at lib/lib\std/os.zig:500:9
           1: 0x1314 - builtin.default_panic
                           at lib/lib\std/builtin.zig:784:25
           2: 0x3c6b5 - test_runner.main
                           at lib/lib/test_runner.zig:13:30
           3: 0x3c639 - start.callMain
                           at lib/lib\std/start.zig:568:22
                     - _start
                           at lib/lib\std/start.zig:241:42

error: the following test command failed with exit code 3:
wasmtime --dir=. --allow-unknown-exports C:\Users\Ryan\Programming\Zig\zig\zig-cache\o\b745ba0bfad688b8844d343fe774832d\test.wasm

When running all std lib tests:

>zig test lib/std/std.zig --zig-lib-dir lib --main-pkg-path lib/std --test-cmd wasmtime --test-cmd --dir=. --test-cmd --allow-unknown-exports --test-cmd-bin -target wasm32-wasi
expected error.IsDir, found error.AccessDenied
expected error.IsDir, found error.AccessDenied
expected error.IsDir, found error.AccessDenied
expected error.PathAlreadyExists, found error.AccessDenied
expected error.IsDir, found error.AccessDenied
2062 passed; 142 skipped; 10 failed.
test failureError: failed to run main module `C:\Users\Ryan\Programming\Zig\zig\zig-cache\o\888da39961c5da85532636b351c586fb\test.wasm`

Caused by:
    0: failed to invoke command default
    1: wasm trap: wasm `unreachable` instruction executed
       wasm backtrace:
           0: 0x900f - os.abort
                           at lib/lib\std/os.zig:500:9
           1: 0x7bd7 - builtin.default_panic
                           at lib/lib\std/builtin.zig:784:25
           2: 0x7234 - test_runner.main
                           at lib/lib/test_runner.zig:13:30
           3: 0x71b8 - start.callMain
                           at lib/lib\std/start.zig:568:22
                     - _start
                           at lib/lib\std/start.zig:241:42

error: the following test command failed with exit code 3:
wasmtime --dir=. --allow-unknown-exports C:\Users\Ryan\Programming\Zig\zig\zig-cache\o\888da39961c5da85532636b351c586fb\test.wasm

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavioros-wasiWebAssembly System Interfaceos-windowsMicrosoft Windowsstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions