Commit Graph

120 Commits

Author SHA1 Message Date
Pat Hickey
2ae1dee642 convert all errno assertions to assert_errno! 2021-01-27 18:10:38 -08:00
Pat Hickey
4f655001c0 make a macro that automates errno assertions 2021-01-27 18:10:34 -08:00
Pat Hickey
4f2696fedf more docs 2021-01-27 16:16:10 -08:00
Pat Hickey
cb171712cc various windows test notes 2021-01-27 15:32:23 -08:00
Pat Hickey
d1160cb9b5 split path rename trailing slash test into files and dirs
files fail on both platform, dirs pass on both! so, same bug!
2021-01-27 14:55:39 -08:00
Pat Hickey
b2e0597ae3 narrow the bug 2021-01-27 12:27:13 -08:00
Pat Hickey
6fcbd3f15d split path_filestat test into two, improve variable names 2021-01-27 12:18:27 -08:00
Pat Hickey
17f43d4cc3 path_link test: we no longer support symlink following
just assert that setting the symlink following lookupflag gives an
ERRNO_INVAL.
2021-01-25 17:15:32 -08:00
Pat Hickey
8f4fecacdc interesting paths: loosen up errno requirements 2021-01-25 15:28:01 -08:00
Pat Hickey
996d49c81f nofollow test: permit ACCES as well as LOOP when opening with nofollow 2021-01-25 15:20:35 -08:00
Pat Hickey
144ca2f535 add a test of symlink happy path to isolate the windows failure 2021-01-25 15:14:26 -08:00
Pat Hickey
72b207de2e path_link: some improvements required by windows
* need to close the handle to the subdirectory before its legal to
  delete it
* windows doesnt give us a way to distinguish between an ERRNO_PERM and
  an ERRNO_ACCES, so lets accept either one
2021-01-25 14:35:02 -08:00
Pat Hickey
634e911a4b tests: directory seeking is actually prohibited! but the test was wrong
* path_open of a directory without OFLAGS_DIRECTORY worked on linux,
  but fortunately not on windows!
* the errno is BADF instead of NOTCAPABLE for fd_seek on a directory
* no way for a directory to have the FD_SEEK right.
2021-01-25 12:13:02 -08:00
Pat Hickey
a46c2ad0aa split poll tests up, only one requires "real" stdio 2021-01-21 16:54:40 -08:00
Pat Hickey
21713d3468 Revert "TEMPORARY: poll_oneoff test uses CLOCKID_REALTIME instead of MONOTONIC"
This reverts commit f667263d9c.
2021-01-19 14:57:10 -08:00
Pat Hickey
b84c4d7488 poll_oneoff test: if you subscribe to a badf, the whole call fails with badf
rather than the results telling you an individual file was a badf.

why? i think the old behavior was too clever, and makes it harder to
write a scheduler.

* what should the call do when you pass it some badf and some not-badf?
i don't think anything besides exiting early is the correct answer.
* the results vector tells you something that the scheduler had to say
about the file, not about your inputs. the errno of the function
always says what the validity of the inputs was
2021-01-14 17:41:27 -08:00
Pat Hickey
f667263d9c TEMPORARY: poll_oneoff test uses CLOCKID_REALTIME instead of MONOTONIC
the scheduler does not support the monotonic clock yet, i will fix this
soon
2021-01-14 17:40:56 -08:00
Pat Hickey
7d7acc4614 poll_oneoff test: outline assertions
this makes the panic message have the line number, which
is handy
2021-01-14 17:40:04 -08:00
Pat Hickey
d56d2f0219 directory seek test: code does not agree with comment. Fix code.
the directory was opened with the seek right, and this test says that it
was asserting that the seek right was present. However, the test was
actually asserting that the seek right was *not* present.

This fixes the code of the test, because I believe the comment is
correct.
2021-01-11 17:58:32 -08:00
Pat Hickey
f084cf1fd0 failure to create trailing slash symlink to file can be EEXIST or ENOTDIR 2021-01-11 15:56:13 -08:00
Pat Hickey
09861c20db symlink-related tests: accept either ELOOP or ENOTDIR
when opening a symlink loop as directory, or nofollow opening a valid
symlink as directory.
2021-01-11 15:35:48 -08:00
Pat Hickey
222a57868e readlink: get rid of weird partial-buffer semantics carried over from posix
but follow posix in returning ERANGE when the result is too big
2021-01-04 16:41:24 -08:00
Pat Hickey
a33418c34a path_filestat: remove expectation that rights_inheriting describes subdirs
if inheriting rights are for files (not subdirs) then this is incorrect.

if inheriting rights are for subdirs too, then we need to change the
implementation.
2020-12-18 16:34:25 -08:00
Pat Hickey
f6afd4c41c test-programs: sandbox escape is an EPERM now, not an ENOTCAPABLE 2020-12-17 18:12:29 -08:00
Pat Hickey
dbe0f4f284 Revert "dangling_fd test: open with either READ or CREAT|WRITE"
fix for behavior in wasi-c2 coming in next commit

This reverts commit 789eec3827.
2020-12-16 15:54:46 -08:00
Pat Hickey
789eec3827 dangling_fd test: open with either READ or CREAT|WRITE
neither READ nor WRITE is an error
2020-12-16 15:16:14 -08:00
Dan Gohman
1d90c329b4 Remove an unused variable. 2020-12-11 10:52:54 -08:00
Dan Gohman
c3f0471ff2 Fix the return value from wasi-common's fd_readdir.
`fd_readdir` returns a "bufused" value, which indicates the number of
bytes read into the buffer. WASI libc expects this value to be equal
to the size of the buffer if the end of the directory has not yet
been scanned.

Previously, wasi-common's `fd_readdir` was writing as many complete
entries as it could fit and then stopping, but this meant it was
returning size less than the buffer size even when the directory had
more entries. This patch makes it continue writing up until the end
of the buffer, and return that number of bytes, to let WASI libc
know that there's more to be read.

Fixes #2493.
2020-12-11 10:52:54 -08:00
Joshua Warner
d947010181 Don't implicitly create empty files in VirtualDir::openat (#2235)
* Don't implicitly create empty files in VirtualDir::openat

* Add test

* Add note on how to run test-program tests to the README
2020-09-25 19:52:13 -07:00
Daiki Ueno
e70f73211d virtfs file: update cursor position on fd_read (#2070)
* virtfs file: update cursor position on fd_read

If a handle is backed by InMemoryFile, fd_read (turned into
Handle::read_vectored) doesn't update the cursor position properly and
thus prevents the caller from detecting EOF.

* virtfs file: fd_{pread,pwrite}: update offset in iovec iteration

If multiple iovec's are supplied, fd_pread and fd_pwrite previously
access data at the same offset for each iovec.
2020-07-29 14:19:17 +02:00
Alex Crichton
63d5b91930 Wasmtime 0.19.0 and Cranelift 0.66.0 (#2027)
This commit updates Wasmtime's version to 0.19.0, Cranelift's version to
0.66.0, and updates the release notes as well.
2020-07-16 12:46:21 -05:00
Peter Huene
41b4721512 Add a test case for WASI file truncation. 2020-07-10 14:28:08 -07:00
Dan Gohman
caa87048ab Wasmtime 0.18.0 and Cranelift 0.65.0. 2020-06-11 17:49:56 -07:00
Emiliano Lesende
ef4ff71dc5 fix(tagged-union): updated Cargo.lock 2020-06-03 20:00:59 -03:00
Emiliano Lesende
59ee430431 fix(tagged-union): rebase and squash
fix(tagged-union): changed test programs to use new tagged union
generated code

fix(tagged-union): changed test programs to use new tagged union generated code

fix(tagged-union): removed local dependency and changed to point to 0.9.1 version of wasi

fix(tagged-union): added newline to gitignore, changed wasi version to 0.10.0

fix(tagged-union): removed gitignore as Cargo.lock is intentional
2020-06-03 19:07:02 -03:00
Dan Gohman
a76639c6fb Wasmtime 0.17.0 and Cranelift 0.64.0. (#1805) 2020-06-02 18:51:59 -07:00
Jakub Konka
348be6f3ed Revert fstatat on *nix and test symlinks in path_filestat calls (#1725)
* Revert fstatat on *nix and test symlinks in path_filestat calls

This commit effectively reverts too eager refactoring on my part which
resulted in incorrect `path_filestat_{get, set_times}` behaviour on
*nix hosts. In the presence of symlinks, neither of the calls would
work properly.

In order to shield ourselves from similar errors in the future, I've
augmented the `path_filestat` test cases with symlink checks as well.

* Pass appropriate flags to fstatat and utimensat

* Fix formatting

* Fix Windows build

* Expand final symlinks if follow is set on Windows

* Fix formatting

* Do not follow symlinks unless specified on Windows

* Update comments and restart CI

* Skip testing volatile atim field
2020-05-20 12:02:24 -07:00
Dan Gohman
864cf98c8d Update release notes, wasmtime 0.16, cranelift 0.63. 2020-04-29 17:30:25 -07:00
Dan Gohman
fde5ddf159 Fixes for 0.15 (#1449)
* Wasmtime 0.15.0 and Cranelift 0.62.0. (#1398)

* Bump more ad-hoc versions.

* Add build.rs to wasi-common's Cargo.toml.

* Update the env var name in more places.

* Remove a redundant echo.
2020-04-03 13:13:37 -07:00
Marcin Mielniczuk
f6e3ab03a2 Implement path_link for Windows. (#1199)
Implement path_link for Windows.
2020-04-03 21:24:38 +02:00
Dan Gohman
092538cc54 Test 0.14 (#1417)
* Bump Wasmtime to 0.14.0.

* Update the publish script for the wiggle crate wiggle.

* More fixes.

* Fix lightbeam depenency version.

* cargo update

* Cargo update wasi-tests too.

And add cargo update to the version-bump scripts.
2020-03-26 21:53:42 -07:00
Dan Gohman
6fa9be7767 Wasmtime 0.13.0 and Cranelift 0.61.0. (#1398)
This also updates the publishing scripts to work with newly added
and reorganized crates.
2020-03-26 13:19:02 -07:00
Marcin Mielniczuk
c50c24e699 Path symlink follow (#1284)
* Fix the tests for correctly following symlinks.

* Correctly follow symlinks in path_link.
2020-03-20 11:59:16 -07:00
iximeow
7e0d9decbf Virtual file support (#701)
* Add support for virtual files (eg, not backed by an OS file).

Virtual files are implemented through trait objects, with a default
implementation that tries to behave like on-disk files, but entirely
backed by in-memory structures.

Co-authored-by: Dan Gohman <sunfish@mozilla.com>
2020-03-06 11:08:13 -08:00
Alex Crichton
33a39ff4f0 Bump to 0.12.0 (#997)
* Bump to 0.12.0

* Another lockfile update
2020-02-26 16:19:12 -06:00
Peter Huene
ef6e1ca2a8 Merge pull request #552 from marmistrz/poll
Minimal viable implementation of poll_oneoff for Windows
2020-01-23 09:30:21 -08:00
Marcin Mielniczuk
815576edc5 Return EINVAL in poll_oneoff with no events. (#838)
* Return EINVAL in poll_oneoff with no events.

We adhere to WebAssembly/WASI#193.

* Add a test for empty poll.
2020-01-17 13:41:37 -08:00
Marcin Mielniczuk
b2c63290dd Merge remote-tracking branch 'upstream/master' into poll 2020-01-14 16:40:23 +01:00
Alex Crichton
420dcd76fd Don't require Store in Instance constructor (#810)
* Don't require `Store` in `Instance` constructor

This can be inferred from the `Module` argument. Additionally add a
`store` accessor to an `Instance` in case it's needed to instantiate
another `Module`.

cc #708

* Update more constructors

* Fix a doctest

* Don't ignore store in `wasm_instance_new`

* Run rustfmt
2020-01-13 17:50:57 -06:00
Dan Gohman
336ee94c89 Bump version to 0.9.0 (#790) 2020-01-09 21:57:40 -08:00