diff --git a/.github/wasi_testsuite_skip.json b/.github/wasi_testsuite_skip.json new file mode 100644 index 0000000000..2b4032822f --- /dev/null +++ b/.github/wasi_testsuite_skip.json @@ -0,0 +1,5 @@ +{ + "WASI Rust tests": { + "interesting_paths": "config is broken, and after fixing it forbids leading slash with EPERM" + } +} diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index d8375d58f9..6d4501294b 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -304,6 +304,7 @@ jobs: -t ./tests/assemblyscript/testsuite/ \ ./tests/c/testsuite/ \ ./tests/rust/testsuite/ \ + -f ../.github/wasi_testsuite_skip.json \ -r ../.github/wasi_testsuite_adapter.py build_gojs_test_binaries: diff --git a/imports/wasi_snapshot_preview1/fs_test.go b/imports/wasi_snapshot_preview1/fs_test.go index e956db5c8b..fb4003929b 100644 --- a/imports/wasi_snapshot_preview1/fs_test.go +++ b/imports/wasi_snapshot_preview1/fs_test.go @@ -164,11 +164,11 @@ func Test_fdClose(t *testing.T) { `, "\n"+log.String()) }) log.Reset() - t.Run("ErrnoNotsup for a preopen", func(t *testing.T) { - requireErrnoResult(t, ErrnoNotsup, mod, FdCloseName, uint64(sys.FdPreopen)) + t.Run("Can close a pre-open", func(t *testing.T) { + requireErrnoResult(t, ErrnoSuccess, mod, FdCloseName, uint64(sys.FdPreopen)) require.Equal(t, ` ==> wasi_snapshot_preview1.fd_close(fd=3) -<== errno=ENOTSUP +<== errno=ESUCCESS `, "\n"+log.String()) }) } diff --git a/internal/sys/fs.go b/internal/sys/fs.go index 5f87d783f2..f59ecd1ca9 100644 --- a/internal/sys/fs.go +++ b/internal/sys/fs.go @@ -447,10 +447,6 @@ func (c *FSContext) CloseFile(fd uint32) error { f, ok := c.openedFiles.Lookup(fd) if !ok { return syscall.EBADF - } else if f.IsPreopen { - // WASI is the only user of pre-opens and wasi-testsuite disallows this - // See https://github.com/WebAssembly/wasi-testsuite/issues/50 - return syscall.ENOTSUP } c.openedFiles.Delete(fd) return f.File.Close() diff --git a/internal/sys/fs_test.go b/internal/sys/fs_test.go index b35de3bfbc..8f22ea9ffd 100644 --- a/internal/sys/fs_test.go +++ b/internal/sys/fs_test.go @@ -125,8 +125,8 @@ func TestFSContext_CloseFile(t *testing.T) { t.Run("EBADF for an invalid FD", func(t *testing.T) { require.Equal(t, syscall.EBADF, fsc.CloseFile(42)) // 42 is an arbitrary invalid FD }) - t.Run("ENOTSUP for a preopen", func(t *testing.T) { - require.Equal(t, syscall.ENOTSUP, fsc.CloseFile(FdPreopen)) // 42 is an arbitrary invalid FD + t.Run("Can close a pre-open", func(t *testing.T) { + require.NoError(t, fsc.CloseFile(FdPreopen)) }) }