Commit Graph

6452 Commits

Author SHA1 Message Date
bjorn3
689771caf3 Don't force enable basic-blocks feature
Fixes #1179
2019-10-30 11:22:05 +01:00
Dan Gohman
0302f1a164 Make path_get return ENOTDIR when the base isn't a directory.
Return `ENOTDIR` instead of `ENOTCAPABLE` when `*at` functions are
given a non-directory as their base. This is in accordance with POSIX:

https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html

Currently wasi-libc contains some code to detect such cases and rewrite
`ENOTCAPABLE` to `ENOTDIR`, however it's better for WASI implementations
to just do the right thing in the first place.
2019-10-30 10:20:42 +01:00
Jakub Konka
f3a5186230 Refactor poll_oneoff on *nix (#137)
* Fixes CraneStation/wasmtime#440

This commit introduces a couple of changes/fixes:
* it annotates `log::debug!` messages with "host" to differentiate
  between file descriptors stored on the WASI side (aka the wrappers)
  and those managed by the host (aka the wrapped)
* it fixes CraneStation/wasmtime#440, i.e., incorrect passing of
  file descriptor to `poll_oneoff` where currently errenously we
  pass in the wrapper instead of the wrapped value
* it adds a couple more `log::debug!` macros calls for easier future
  debugging

* Add partial refactorting to poll_oneoff

This commit lays the groundwork for more clean up to come in
subsequent commits.

* Finalise refactoring of `poll_oneoff`

* Fix compilation error on Windows

* Address majority of suggestions and refactor

Co-authored-by: Marcin Mielniczuk <marmistrz.dev@zoho.eu>

* Add poll_oneoff test case

* Leave timeout in nanoseconds in ClockEventData

Instead of converting the timeout value from nanoseconds to
milliseconds in the host-independent impl, move the conversion
to *nix-specific impl as the conversion is currently only warranted
by the POSIX `poll` syscall.

* Don't fail immediately on bad descriptor

If the user specifies an invalid descriptor inside a subscription,
don't fail immediately but rather generate an event with the thrown
WASI error code, and continue with the remaining, potentially
correct subscriptions.
2019-10-30 09:57:59 +01:00
lzutao
7e5c33a29e Use array::iter 2019-10-30 09:47:25 +01:00
Dan Gohman
aecec187d7 Check for overflow when incrementing the preopen_fd counter. (#157)
If someone somehow defines more preopens than can fit in the
`__wasi_fd_t` index space, we should detect it instead of silently
wrapping around.
2019-10-29 17:11:43 -07:00
Peter Huene
de71dbec0d Implement a helper for converting &str to CString. (#154)
This commit implements a simple helper for converting `&str` to `CString` and
mapping to the appropriate WASI error.

It also adds a `path_cstring` helper method in `PathGet` where the conversion was
used the most.

Fixes #104.
2019-10-29 16:30:22 -07:00
Dan Gohman
9a5c53b3ed Make wasi-common's Error messages prettier. (#156)
Instead of returning the debug formatting, which includes the enum
names, like `Io(...)`, just run the formatting function of the inner
error objects, which is nicer for command-line use.
2019-10-29 15:46:11 -07:00
Yury Delendik
c2ba74b118 [wasmtime-api] run examples as tests (#466)
* [wasmtime-api] run example as tests

* Update wasmtime-api/tests/examples.rs

Co-Authored-By: Nick Fitzgerald <fitzgen@gmail.com>

* disable multi example test on windows
2019-10-29 17:25:54 -05:00
Alex Crichton
bf526b62d3 Add book documentation skeleton and auto-publish from CI (#435)
This commit adds the skeleton of a new set of documentation for
`wasmtime` in the existing `docs` directory. This documentation is
organized and compiled with [mdbook] which the Rust project uses for
most of its own documentation as well. At a previous meeting we
brainstormed a rough skeleton of what the documentation in this book
would look like, and I've transcribed that here for an example of how
this is rendered and how it can be laid out. No actual documentation is
written yet.

This commit also additionally adds necessary support to auto-publish
both this book documentation and API documentation every time a commit
is pushed to the `master` branch. All HTML will be automatically pushed
to the `gh-pages` branch so long as the CI passes, and this should get
deployed to https://cranestation.github.io/wasmtime.

I've done a few dry-runs and I think this'll all work, but we'll likely
tweak a few things here and there after running this through CI to make
sure everything looks just as we'd like. My hope though is that after
this lands we can start actually filling out all the documentation and
being able to review it as well.

[mdbook]: https://crates.io/crates/mdbook
2019-10-29 15:55:51 +01:00
Josh Triplett
06e9170f30 wasmtime-py: Don't use "main.rs" for a wasm example so cargo doesn't test it (#464)
cargo test will test examples that have a "main.rs", but in this case,
the example requires manual compilation as a wasm module, and doesn't
build as a standalone program. Rename it to "demo.rs".
2019-10-29 15:47:49 +01:00
Josh Triplett
b1584aafe2 wasmtime-py: Fix formatting in README (#465) 2019-10-29 15:39:13 +01:00
Marcin Mielniczuk
2659641132 Implement clock_time_get on Windows (#119)
* Fix some Windows warnings.

* Implement clock_time_get on Windows.

Also update misc_testsuite to include latest clock_time_get test
changes.

* improve comments

* Remove a leftover import.

Co-Authored-By: Jakub Konka <kubkon@jakubkonka.com>
2019-10-29 15:05:42 +01:00
Benjamin Bouvier
e8c03fbd09 [meta] Remove unused bit-vector functionalty;
It can be resurrected if needed in the future. It was used only for the
semantics descriptions, which went away with the transition of the
meta-language to Rust.
2019-10-29 14:23:10 +01:00
Benjamin Bouvier
5889dd2c64 [meta] Add more pub(crate) definitions. 2019-10-29 14:23:10 +01:00
Benjamin Bouvier
06b1817d89 [meta] Rename Operand::is_pure_immediate into is_immediate; 2019-10-29 14:23:10 +01:00
Benjamin Bouvier
b657aa57f6 [meta] Rename Operand::is_immediate to is_immediate_or_entityref 2019-10-29 14:23:10 +01:00
Jakub Konka
bb5c879718 Fixes path_symlink_trailing_slashes on Windows
This commit:
* adds missing `ERROR_ALREADY_EXISTS => __WASI_EEXIST` mapping
* re-routes Win errors into correct WASI values in `symlink_*`
  fns when target exists and/or contains a trailing slash
* remaps `ERROR_INVALID_NAME => __WASI_ENOENT`
2019-10-29 11:04:16 +01:00
Andrew Brown
f37d1c7ecc Simplify binding of IntCC::Equals to SIMD icmp; fixes #1150 2019-10-28 11:09:37 -07:00
Josh Triplett
faee3b4bc3 wasmtime-api: reserve_exact on the correct vector (#452)
Fix what looks like a copy-paste issue in wasmtime-api/src/module.rs,
which led to calling reserve_exact on one vector before pushing that
many elements into another.
2019-10-28 12:57:51 -05:00
Jim Posen
71dd73d672 Expose some more internals publicly (#340) 2019-10-28 18:12:11 +01:00
Joshua Nelson
e045a6df27 implement Debug for Linkage
this would have been useful while debugging something in my own project
2019-10-28 11:43:15 +01:00
Josh Triplett
f27e0ad53c wasmtime-wasi-c: allow(non_snake_case) to suppress warnings on consecutive underscores (#461)
wasmtime-wasi-c contains many bindgen-generated symbols like
bindgen_test_layout___wasi_event_t___wasi_event_u___wasi_event_u_fd_readwrite_t
that contain triple-underscores in them. rustc doesn't consider those
names snake-case and generates extensive warnings about them. Suppress
those warnings with allow(non_snake_case).
2019-10-28 11:42:46 +01:00
Jakub Konka
59bbfbc0d7 Remove needs_close from FdObject
This commit removes `needs_close` field from `FdObject`, and
stores the underlying `Descriptor` without the `ManuallyDrop`
wrapper.
2019-10-25 17:39:47 +02:00
Maxim Vorobjov
6eb6e342d7 Rebuild misc tests when any of test files change (#150)
* rebuild misc tests when any of test file changes

* fix build formatting

* file change validation -> build_and_generate_tests
2019-10-25 15:48:58 +02:00
Andrew Brown
3053444b57 Add more SIMD spec tests (#388)
* Add more SIMD spec tests

Also provides a helper, extract_name, for building the names needed for the generated code

* Use `cargo test ... -- --nocapture` to see test errors in CI

* Use OS-independent paths for WAST files

* Ignore 'skip-stack-guard-page'

* Temporarily disable SIMD tests

* Re-enable SIMD spec tests and only disable on Windows temporarily
2019-10-25 06:18:41 -07:00
Pat Hickey
f9a8329424 WasiCtxBuilder: add methods to provide Files each for stdio (#147) 2019-10-25 14:23:26 +02:00
Jakub Konka
b0e896e7d0 Add Github Actions badge to README 2019-10-25 11:52:18 +02:00
Jakub Konka
1c5422e052 Remove Azure Pipelines conf 2019-10-25 11:52:18 +02:00
Jakub Konka
997d411870 Bump required rustc to 1.37 in README 2019-10-25 11:52:18 +02:00
Jakub Konka
3821ce28c8 Add beta & nightly builds 2019-10-25 11:52:18 +02:00
Jakub Konka
2ada299b95 Add docs section 2019-10-25 11:52:18 +02:00
Jakub Konka
a04aa5860d Update test configuration 2019-10-25 11:52:18 +02:00
Jakub Konka
10e0b87ebf Update MSRV to 1.37.0 2019-10-25 11:52:18 +02:00
Jakub Konka
be1f8c0325 Update ci.yml 2019-10-25 11:52:18 +02:00
Jakub Konka
b0199ef396 Enable Github Actions 2019-10-25 11:52:18 +02:00
Peter Huene
9f506692c2 Fix clippy warnings.
This commit fixes the current set of (stable) clippy warnings in the repo.
2019-10-24 17:20:12 -07:00
vms
a34439de42 optimize memory.grow 0 (#443) 2019-10-24 15:56:04 -07:00
Artur Jamro
5a10879d5b Enable assert_unlinkable check (#451) 2019-10-24 15:37:01 -07:00
yjh
1176e4f178 Fix clippy warnings (#1168) 2019-10-24 09:54:31 -06:00
Jakub Konka
8e45a14cec Fast-forward wasmtime to latest rev 2019-10-24 12:07:45 +02:00
Jakub Konka
875eea6052 Update poll_oneoff's signature
This PR updates `wasmtime_wasi` crate by adjusting `poll_oneoff`'s
signature to that introduced in `wasi_common` in
CraneStation/wasi-common#137. This change is required in order to
fix #440.
2019-10-24 11:47:35 +02:00
Jakub Konka
3a374d0016 Update poll_oneoff API
This commit updates `poll_oneoff`'s API in a potentially least
invasive way. That is, it adds unused `WasiCtx` argument to the
syscall which will be required by #137. I am hopeful that this way
 #137 can pass all tests and hence this commit should aid the review
 process.
2019-10-24 11:19:33 +02:00
Dan Gohman
a7fa6bdb31 Fix fuzz and wasi-c builds (#447)
* Fix the wasmtime-wasi-c crate build and upgrade it to Rust 2018.

* Fix the fuzz build.
2019-10-23 14:05:23 -07:00
Yury Delendik
876d5e1075 [wasmtime-api] Multi value api support (#448) 2019-10-23 14:09:27 -05:00
Dan Gohman
bd8d550ba3 Improve Cargo.toml files for publishing (#141)
* Add versions to the crates.

This is needed for publishing on crates.io.

* Add a few Cargo.toml attributes to make the crates.io page friendlier.
2019-10-23 19:17:22 +02:00
Dan Gohman
056e1d8cc0 Add more links in the fs module's documentation. 2019-10-23 19:16:18 +02:00
Jakub Konka
951456d79b Update misc_testsuite to latest master 2019-10-23 19:13:05 +02:00
Benjamin Bouvier
2b6ea31621 [wasm] Include more large tests; 2019-10-23 10:15:49 +02:00
Johnnie Birch
a3dd4b91e1 Fix lightbeam build broken when supporting ModuleTranslateState (#445) 2019-10-22 16:18:54 -07:00
Andrew Brown
8c4cbf9a55 Update SIMD spec tests to latest upstream revision (#444) 2019-10-22 16:16:51 -07:00