Commit Graph

2437 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Jakub Konka
63c1f71036 Sync with latest wasmtime rev
This commit syncs tests with latest wasmtime revision.
As such, it now utilises the `wasmtime-api` crate for
runtime setup.

Closes #126, #127, #128, #129.
2019-10-22 15:27:21 +02:00
Jakub Konka
0d63cc2dbc Fix remove_directory_trailing_slashes on Windows
This commit provides a fix for `remove_directory_trailing_slashes`
test case on Windows. It adds a missing mapping between the following
WinAPI error code and WASI error:

```
ERROR_DIRECTORY => __WASI_ENOTDIR
```

where `ERROR_DIRECTORY` is thrown when the directory name is invalid.
2019-10-22 10:12:54 +02:00
Alex Crichton
e37168a88d Add back wasmtime-wast support for V128 (#442)
Accidentally left removed #434 when I meant to add it back in! Updates
the `wast` crate dependency and adds support for translating
`v128.const` instructions to a `RuntimeValue`

Closes #441
2019-10-21 15:51:59 -07:00
Alex Crichton
9947bc5209 Switch from wabt crate to wast (#434)
* Switch lightbeam from `wabt` to `wast`

Switch from a C++-based `*.wat` parser to a Rust-based parser

* Remove unneeded `wabt` dev-dependency from wasmtime-api

* Rewrite `wasmtime-wast` crate with `wast-parser`

This commit moves the `wasmtime-wast` crate off the `wabt` crate on to
the `wast-parser` crate which is a Rust implementation of a `*.wast` and
`*.wat` parser. The intention here is to continue to reduce the amount
of C++ required to build wasmtime!

* Use new `wat` and `wast` crate names
2019-10-18 13:25:48 -07:00
Dan Gohman
ef010b44b7 Fix nondeterminism in the preopen order.
We iterate over the preopens to present them to the WASI program, so
storing them in a `HashMap` means this order is nondeterministic. Switch
to a `Vec` of tuples instead. This means we don't eliminate duplicates,
but they should be rare.
2019-10-18 19:52:08 +02:00
Dan Gohman
4120d3b44f Optimize away an owned string in path_readlink. 2019-10-18 19:37:58 +02:00
Dan Gohman
14bad3cb97 Ensure that each crate has its own copy of the LICENSE file.
On crates.io, each crate is distributed separately, so ensure that each
crate has a license file.
2019-10-18 19:27:36 +02:00
Dan Gohman
ebef2c6b57 Rename "always_lightbeam" to "lightbeam" in more places. (#404) 2019-10-17 17:15:31 -07:00
Dan Gohman
877152ee5c Use the libstd instead of the errno crate in wasmtime-runtime. (#408)
Rust's standard library now has a way to read the OS errno value, so use
that instead of depending on the errno crate in wasmtime-runtime.
2019-10-17 17:14:57 -07:00
Alex Crichton
50beb21b63 Add a missing api to the wasm C API (#433)
This was used when [prototyping] but I found it wasn't implemented yet!

[prototyping]: https://github.com/dtolnay/watt/issues/2#issuecomment-543007365
2019-10-17 17:14:15 -07:00
Nick Fitzgerald
842faf5aa6 Support for multi-value wasm (#399)
* deps: bump wasmparser to 0.39.2

This has a bug fix for multi-value Wasm validation that is required for getting
the spec tests passing.

https://github.com/yurydelendik/wasmparser.rs/pull/135

* Update cranelift to 0.46.1 to get multi-value Wasm support

The `cranelift_wasm` APIs had to change a little bit to maintain state necessary
when translating multi-value Wasm blocks. The `translate_module` function now
returns a `ModuleTranslationState` that is borrowed during each function's
translation.

* Enable multi-value proposal's spec tests

This enables all the Wasm multi-value proposal's spec tests other than the ones
that rely on functions having more return values than registers available on the
target. That is not supported by cranelift yet.

* wasmtime-interface-types: always use multi-value Wasm

And remove the return pointer hacks that work around the lack of multi-value.
2019-10-17 17:12:01 -07:00
Jakub Konka
9d54f84a32 Fast-forward wasi-common to latest git rev 2019-10-17 12:02:58 +02:00
Jakub Konka
c3bf04042e Fixes path_symlink_trailing_slashes test case (#125)
* Fixes `path_symlink_trailing_slashes` test case

This commit:
* adds a couple `log::debug!` macro calls in and around `path_get`
  for easier future debugging
* changes impl of `path_symlink` hostcall to actually *require*
  the final component (matching the impl of WASI in C)
* ignores the error `__WASI_ENOTDIR` in `path_get`'s `readlinkat` call
  which is not meant to be an error at this stage (i.e., this
  potentially erroneous condition *will be* handled later, in
  one of the layers above)

* Fixes `path_symlink_trailing` slashes on BSD-nixes

This commit:
* makes `path_symlink` host-specific (Linux and BSD-like nixes
  now have their own differing implementations)
* on BSD-like nixes, when `ENOTDIR` is returned from `symlinkat`
  it checks whether the target path contains a trailing slash,
  strips it, and then checks if the target path without the trailing
  slash exists; if yes, then converts the error code to `EEXIST` to
  match Linux/POSIX spec
2019-10-17 11:33:56 +02:00
YAMAMOTO Yuji
d05561ff78 Fix deadlink to WASI API header (#431)
Fix documentation link to wasi-libc headers
2019-10-17 11:21:44 +02:00