Merge branch 'master' into command/jq

This commit is contained in:
Jesús Leganés-Combarro 'piranna 2019-07-15 13:14:26 +02:00
commit 6fa61b508c
1128 changed files with 5185 additions and 1849 deletions

View File

@ -50,7 +50,6 @@ install:
build_script:
- cargo build --release --verbose
# Now we build wapm
- git submodule init
- git submodule update
# Cache wapm cli target in dir above to prevent breaking git submodule on windows
@ -61,9 +60,8 @@ build_script:
- cd ..
- cargo build --release --manifest-path wapm-cli/Cargo.toml --features telemetry
- cd wapm-cli
- rename target wapm-cli-target
- cd ..
- move wapm-cli\wapm-cli-target wapm-cli-target
- xcopy wapm-cli\target wapm-cli-target\ /i /y
- cargo build --release --manifest-path lib/runtime-c-api/Cargo.toml
test_script:

View File

@ -27,6 +27,10 @@ jobs:
<<: *run_with_build_env_vars
steps:
- checkout
- run:
name: "Pull Submodules"
command: |
git submodule update --init
- restore_cache:
keys:
- v8-lint-{{ arch }}-{{ checksum "Cargo.lock" }}
@ -35,13 +39,14 @@ jobs:
name: Install lint deps
command: |
git config --global --unset url."ssh://git@github.com".insteadOf || true
rustup toolchain install nightly-2019-05-20
# rustup toolchain install nightly-2019-06-10
# rustup default nightly-2019-06-10
rustup component add rustfmt
rustup component add clippy --toolchain=nightly-2019-05-20 || cargo +nightly-2019-05-20 install --git https://github.com/rust-lang/rust-clippy/ --force clippy
rustup component add clippy || cargo install --git https://github.com/rust-lang/rust-clippy/ --force clippy
- run:
name: Execute lints
command: |
make lint
cargo fmt --all -- --check
- save_cache:
paths:
- /usr/local/cargo/registry
@ -50,43 +55,92 @@ jobs:
- target/debug/deps
key: v8-lint-{{ arch }}-{{ checksum "Cargo.lock" }}
test:
test-stable:
docker:
- image: circleci/rust:latest
<<: *run_with_build_env_vars
steps:
- checkout
- run:
name: "Pull Submodules"
command: |
git submodule update --init
- restore_cache:
keys:
- v8-test-cargo-cache-linux-stable-{{ arch }}-{{ checksum "Cargo.lock" }}
- <<: *run_install_dependencies
- run:
name: Tests
command: make test
- run:
name: Emscripten Tests
name: Test everything (except singlepass)
command: |
make test-emscripten-clif
make test-emscripten-llvm
make cranelift
make llvm
make test-rest
- run:
name: Release
command: make release-fast
- run:
name: Integration Tests
command: make integration-tests
- save_cache:
paths:
- /usr/local/cargo/registry
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
- target/release/.fingerprint
- target/release/build
- target/release/deps
key: v8-test-cargo-cache-linux-stable-{{ arch }}-{{ checksum "Cargo.lock" }}
test:
docker:
- image: circleci/rust:latest
<<: *run_with_build_env_vars
steps:
- checkout
- run:
name: "Pull Submodules"
command: |
git submodule update --init
- restore_cache:
keys:
- v8-test-cargo-cache-linux-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
- <<: *run_install_dependencies
- run: rustup default nightly-2019-06-10
- run:
name: Tests
command: make test
- run:
name: Debug flag checked
command: |
cargo check --features "debug" --release
- run:
name: Check
command: |
make check
- run:
name: Release
command: make release-fast
- run:
name: Integration Tests
command: make integration-tests
- save_cache:
paths:
- /usr/local/cargo/registry
- target/release/.fingerprint
- target/release/build
- target/release/deps
key: v8-test-cargo-cache-linux-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
test-macos:
macos:
xcode: "9.0"
steps:
- checkout
- run:
name: "Pull Submodules"
command: |
git submodule update --init
- restore_cache:
keys:
- v8-cargo-cache-darwin-stable-{{ arch }}-{{ checksum "Cargo.lock" }}
- v8-cargo-cache-darwin-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
- run:
name: Install crate dependencies
command: |
@ -100,7 +154,7 @@ jobs:
- run:
name: Install Rust
command: |
curl -sSf https://sh.rustup.rs | sh -s -- -y
curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly-2019-06-10
export PATH="$HOME/.cargo/bin:$PATH"
cargo --version
- run:
@ -114,16 +168,15 @@ jobs:
sudo sysctl -w kern.maxfiles=655360 kern.maxfilesperproc=327680
make test
- run:
name: Emscripten Tests
name: Check
command: |
export PATH="$HOME/.cargo/bin:$PATH"
export PATH="`pwd`/cmake-3.4.1-Darwin-x86_64/CMake.app/Contents/bin:$PATH"
export LLVM_SYS_70_PREFIX="`pwd`/clang+llvm-7.0.0-x86_64-apple-darwin/"
# We increase the ulimit for fixing cargo unclosed files in mac
ulimit -n 8000
sudo sysctl -w kern.maxfiles=655360 kern.maxfilesperproc=327680
make test-emscripten-clif
make test-emscripten-llvm
make check
- run:
name: Release
command: |
export PATH="$HOME/.cargo/bin:$PATH"
make release-fast
- run:
name: Integration Tests
command: |
@ -134,19 +187,20 @@ jobs:
- save_cache:
paths:
- ~/.cargo/registry/
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
- target/release/.fingerprint
- target/release/build
- target/release/deps
key: v8-cargo-cache-darwin-stable-{{ arch }}-{{ checksum "Cargo.lock" }}
key: v8-cargo-cache-darwin-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
test-and-build:
docker:
- image: circleci/rust:latest
steps:
- checkout
- run:
name: "Pull Submodules"
command: |
git submodule update --init
- run:
name: "Pull dependencies"
command: |
@ -161,28 +215,17 @@ jobs:
sudo apt-get install -y cmake
curl -O https://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
tar xf clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
# Use rust nightly (for singlepass, for now)
- run: rustup default nightly-2019-04-11
- run: rustup default nightly-2019-06-10
- run:
name: Tests
command: |
export LLVM_SYS_70_PREFIX="`pwd`/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/"
make test
- run:
name: Emscripten Tests
command: |
export LLVM_SYS_70_PREFIX="`pwd`/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/"
make test-emscripten-clif
make test-emscripten-llvm
- run:
name: Debug flag checked
command: |
cargo check --features "debug"
- run:
name: Release Build
command: |
export LLVM_SYS_70_PREFIX="`pwd`/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/"
make production-release
make release
cargo build --release --manifest-path wapm-cli/Cargo.toml --features telemetry
mkdir -p artifacts
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
@ -203,9 +246,6 @@ jobs:
- save_cache:
paths:
- /usr/local/cargo/registry
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
- target/release/.fingerprint
- target/release/build
- target/release/deps
@ -240,15 +280,9 @@ jobs:
- run:
name: Install Rust
command: |
curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly-2019-06-10
export PATH="$HOME/.cargo/bin:$PATH"
cargo --version
# Use rust nightly (for singlepass, for now)
# - run:
# name: Install Rust nightly
# command: |
# export PATH="$HOME/.rustup/bin:$PATH"
# rustup default nightly-2019-04-11
- run:
name: Tests
command: |
@ -258,25 +292,15 @@ jobs:
# We increase the ulimit for fixing cargo unclosed files in mac
ulimit -n 8000
sudo sysctl -w kern.maxfiles=655360 kern.maxfilesperproc=327680
make test
- run:
name: Emscripten Tests
command: |
export PATH="`pwd`/cmake-3.4.1-Darwin-x86_64/CMake.app/Contents/bin:$PATH"
export PATH="$HOME/.cargo/bin:$PATH"
export LLVM_SYS_70_PREFIX="`pwd`/clang+llvm-7.0.0-x86_64-apple-darwin/"
# We increase the ulimit for fixing cargo unclosed files in mac
ulimit -n 8000
sudo sysctl -w kern.maxfiles=655360 kern.maxfilesperproc=327680
make test-emscripten-clif
make test-emscripten-singlepass
- run:
name: Release Build
command: |
export PATH="`pwd`/cmake-3.4.1-Darwin-x86_64/CMake.app/Contents/bin:$PATH"
export PATH="$HOME/.cargo/bin:$PATH"
export LLVM_SYS_70_PREFIX="`pwd`/clang+llvm-7.0.0-x86_64-apple-darwin/"
make production-release
make release
cargo build --release --manifest-path wapm-cli/Cargo.toml --features telemetry
mkdir -p artifacts
make build-install
@ -297,51 +321,13 @@ jobs:
- save_cache:
paths:
- ~/.cargo/registry/
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
- target/release/.fingerprint
- target/release/build
- target/release/deps
- wapm-cli/target/release/.fingerprint
- wapm-cli/target/release/build
- wapm-cli/target/release/deps
key: v8-cargo-cache-darwin-nightly-{ arch }}-{{ checksum "Cargo.lock" }}
test-rust-nightly:
docker:
- image: circleci/rust:latest
steps:
- checkout
- restore_cache:
keys:
- v8-cargo-cache-linux-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
- run:
name: Install dependencies
command: |
sudo apt-get install -y cmake
curl -O https://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
tar xf clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
rustup toolchain install nightly
rustup target add wasm32-wasi --toolchain nightly
- run: |
rustup default nightly
make test-wasi-singlepass
make test-wasi-clif
- run: rustup default nightly-2019-04-11
- run: |
export LLVM_SYS_70_PREFIX="`pwd`/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/"
make test
make test-singlepass
make test-emscripten-clif
make test-emscripten-singlepass
- save_cache:
paths:
- /usr/local/cargo/registry
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
key: v8-cargo-cache-linux-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}-nightly
key: v8-cargo-cache-darwin-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
publish-github-release:
docker:
@ -412,7 +398,7 @@ workflows:
branches:
only:
- master
- test-rust-nightly:
- test-stable:
filters:
branches:
only:

View File

@ -5,6 +5,23 @@ All PRs to the Wasmer repository must add to this file.
Blocks of changes will separated by version increments.
## **[Unreleased]**
- [#554](https://github.com/wasmerio/wasmer/pull/554) Finish implementation of `wasi::fd_seek`, fix bug in filestat
## 0.5.5
- [#541](https://github.com/wasmerio/wasmer/pull/541) Fix dependency graph by making separate test crates; ABI implementations should not depend on compilers. Add Cranelift fork as git submodule of clif-backend
- [#537](https://github.com/wasmerio/wasmer/pull/537) Add hidden flag (`--cache-key`) to use prehashed key into the compiled wasm cache and change compiler backend-specific caching to use directories
- [#536](https://github.com/wasmerio/wasmer/pull/536) ~Update cache to use compiler backend name in cache key~
## 0.5.4
- [#529](https://github.com/wasmerio/wasmer/pull/529) Updates the Wasm Interface library, which is used by wapm, with bug fixes and error message improvements
## 0.5.3
- [#523](https://github.com/wasmerio/wasmer/pull/523) Update wapm version to fix bug related to signed packages in the global namespace and locally-stored public keys
## 0.5.2 - 2019-07-02
- [#521](https://github.com/wasmerio/wasmer/pull/521) Update Wapm-cli, bump version numbers
- [#518](https://github.com/wasmerio/wasmer/pull/518) Update Cranelift and WasmParser
- [#514](https://github.com/wasmerio/wasmer/pull/514) [#519](https://github.com/wasmerio/wasmer/pull/519) Improved Emscripten network related calls, added a null check to `WasmPtr`
- [#515](https://github.com/wasmerio/wasmer/pull/515) Improved Emscripten dyncalls
- [#513](https://github.com/wasmerio/wasmer/pull/513) Fix emscripten lseek implementation.
- [#510](https://github.com/wasmerio/wasmer/pull/510) Simplify construction of floating point constants in LLVM backend. Fix LLVM assertion failure due to definition of %ctx.

575
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer"
version = "0.5.1"
version = "0.5.5"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
edition = "2018"
repository = "https://github.com/wasmerio/wasmer"
@ -35,6 +35,8 @@ wasmer-llvm-backend = { path = "lib/llvm-backend", optional = true }
wasmer-wasi = { path = "lib/wasi", optional = true }
wasmer-kernel-loader = { path = "lib/kernel-loader", optional = true }
wasmer-dev-utils = { path = "lib/dev-utils", optional = true }
wasmer-wasi-tests = { path = "lib/wasi-tests", optional = true }
wasmer-emscripten-tests = { path = "lib/emscripten-tests", optional = true }
[workspace]
members = [
@ -53,6 +55,8 @@ members = [
"lib/kernel-loader",
"lib/kernel-net",
"lib/dev-utils",
"lib/wasi-tests",
"lib/emscripten-tests",
"examples/plugin-for-example"
]
@ -63,14 +67,14 @@ rustc_version = "0.2.3"
[features]
default = ["fast-tests", "wasi"]
"loader:kernel" = ["wasmer-kernel-loader"]
"loader-kernel" = ["wasmer-kernel-loader"]
debug = ["wasmer-runtime-core/debug"]
trace = ["wasmer-runtime-core/trace"]
extra-debug = ["wasmer-clif-backend/debug", "wasmer-runtime-core/debug"]
# This feature will allow cargo test to run much faster
fast-tests = []
"backend:llvm" = ["wasmer-llvm-backend"]
"backend:singlepass" = ["wasmer-singlepass-backend"]
"backend-llvm" = ["wasmer-llvm-backend", "wasmer-runtime-core/backend-llvm"]
"backend-singlepass" = ["wasmer-singlepass-backend", "wasmer-runtime-core/backend-singlepass"]
wasi = ["wasmer-wasi"]
# vfs = ["wasmer-runtime-abi"]

202
Makefile
View File

@ -1,41 +1,145 @@
ifeq (test, $(firstword $(MAKECMDGOALS)))
runargs := $(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))
$(eval $(runargs):;@true)
endif
.PHONY: spectests emtests clean build install lint precommit
# This will re-generate the Rust test files based on spectests/*.wast
spectests:
WASMER_RUNTIME_GENERATE_SPECTESTS=1 cargo build -p wasmer-runtime-core
# Generate files
generate-spectests:
WASMER_RUNTIME_GENERATE_SPECTESTS=1 cargo build -p wasmer-runtime-core --release
emtests:
WASM_EMSCRIPTEN_GENERATE_EMTESTS=1 cargo build -p wasmer-emscripten
generate-emtests:
WASM_EMSCRIPTEN_GENERATE_EMTESTS=1 cargo build -p wasmer-emscripten-tests --release
wasitests:
WASM_WASI_GENERATE_WASITESTS=1 cargo build -p wasmer-wasi
generate-wasitests:
WASM_WASI_GENERATE_WASITESTS=1 cargo build -p wasmer-wasi-tests --release
# clean:
# rm -rf artifacts
generate: generate-spectests generate-emtests generate-wasitests
build:
cargo build --features debug
install:
cargo install --path .
# Spectests
spectests-singlepass:
cargo test --manifest-path lib/spectests/Cargo.toml --release --features singlepass
integration-tests: release
spectests-cranelift:
cargo test --manifest-path lib/spectests/Cargo.toml --release --features clif
spectests-llvm:
cargo test --manifest-path lib/spectests/Cargo.toml --release --features llvm
spectests: spectests-singlepass spectests-cranelift spectests-llvm
# Emscripten tests
emtests-singlepass:
cargo test --manifest-path lib/emscripten-tests/Cargo.toml --release --features singlepass -- --test-threads=1
emtests-cranelift:
cargo test --manifest-path lib/emscripten-tests/Cargo.toml --release --features clif -- --test-threads=1
emtests-llvm:
cargo test --manifest-path lib/emscripten-tests/Cargo.toml --release --features llvm -- --test-threads=1
emtests-unit:
cargo test --manifest-path lib/emscripten/Cargo.toml --release
emtests: emtests-unit emtests-singlepass emtests-cranelift emtests-llvm
# Middleware tests
middleware-singlepass:
cargo test --manifest-path lib/middleware-common/Cargo.toml --release --features singlepass
middleware-cranelift:
cargo test --manifest-path lib/middleware-common/Cargo.toml --release --features clif
middleware-llvm:
cargo test --manifest-path lib/middleware-common/Cargo.toml --release --features llvm
middleware: middleware-singlepass middleware-cranelift middleware-llvm
# Wasitests
wasitests-singlepass:
cargo test --manifest-path lib/wasi-tests/Cargo.toml --release --features singlepass -- --test-threads=1
wasitests-cranelift:
cargo test --manifest-path lib/wasi-tests/Cargo.toml --release --features clif -- --test-threads=1
wasitests-llvm:
cargo test --manifest-path lib/wasi-tests/Cargo.toml --release --features llvm -- --test-threads=1
wasitests-unit:
cargo test --manifest-path lib/wasi/Cargo.toml --release
wasitests: wasitests-unit wasitests-singlepass wasitests-cranelift wasitests-llvm
# Backends
singlepass: spectests-singlepass emtests-singlepass middleware-singlepass wasitests-singlepass
cargo test -p wasmer-singlepass-backend --release
cranelift: spectests-cranelift emtests-cranelift middleware-cranelift wasitests-cranelift
cargo test -p wasmer-clif-backend --release
llvm: spectests-llvm emtests-llvm middleware-llvm wasitests-llvm
cargo test -p wasmer-llvm-backend --release
# All tests
capi:
cargo build --release
cargo build -p wasmer-runtime-c-api --release
cargo test -p wasmer-runtime-c-api --release
test-rest: capi
cargo test --release --all --exclude wasmer-runtime-c-api --exclude wasmer-emscripten --exclude wasmer-spectests --exclude wasmer-wasi --exclude wasmer-middleware-common --exclude wasmer-singlepass-backend --exclude wasmer-clif-backend --exclude wasmer-llvm-backend --exclude wasmer-wasi-tests --exclude wasmer-emscripten-tests
circleci-clean:
@if [ ! -z "${CIRCLE_JOB}" ]; then rm -f /home/circleci/project/target/debug/deps/libcranelift_wasm* && rm -f /Users/distiller/project/target/debug/deps/libcranelift_wasm*; fi;
test: spectests emtests middleware wasitests circleci-clean test-rest
# Integration tests
integration-tests: release-fast
echo "Running Integration Tests"
./integration_tests/lua/test.sh
./integration_tests/nginx/test.sh
./integration_tests/cowsay/test.sh
# Utils
lint:
cargo fmt --all -- --check
cargo +nightly-2019-05-20 clippy --all
precommit: lint test
debug:
cargo build --release --features backend-singlepass,debug,trace
install:
cargo install --path .
check:
cargo check --release --features backend-singlepass,backend-llvm,loader-kernel
release:
cargo build --release --features backend-singlepass,backend-llvm,loader-kernel
# Only one backend (cranelift)
release-fast:
# If you are in OS-X, you will need mingw-w64 for cross compiling to windows
# brew install mingw-w64
cargo build --release
release-singlepass:
cargo build --release --features backend-singlepass
release-llvm:
cargo build --release --features backend-llvm
bench:
cargo bench --all
# Build utils
build-install:
mkdir -p ./install/bin
cp ./wapm-cli/target/release/wapm ./install/bin/
@ -46,66 +150,10 @@ build-install:
do-install:
tar -C ~/.wasmer -zxvf wasmer.tar.gz
test:
# We use one thread so the emscripten stdouts doesn't collide
cargo test --all --exclude wasmer-runtime-c-api --exclude wasmer-emscripten --exclude wasmer-spectests --exclude wasmer-singlepass-backend --exclude wasmer-wasi --exclude wasmer-middleware-common -- $(runargs)
# cargo test --all --exclude wasmer-emscripten -- --test-threads=1 $(runargs)
cargo test --manifest-path lib/spectests/Cargo.toml --features clif
cargo test --manifest-path lib/middleware-common/Cargo.toml --features clif
@if [ ! -z "${CIRCLE_JOB}" ]; then rm -f /home/circleci/project/target/debug/deps/libcranelift_wasm* && rm -f /Users/distiller/project/target/debug/deps/libcranelift_wasm*; fi;
cargo test --manifest-path lib/spectests/Cargo.toml --features llvm
cargo test --manifest-path lib/runtime/Cargo.toml --features llvm
cargo test --manifest-path lib/middleware-common/Cargo.toml --features llvm
cargo build -p wasmer-runtime-c-api
cargo test -p wasmer-runtime-c-api -- --nocapture
test-singlepass:
cargo test --manifest-path lib/spectests/Cargo.toml --features singlepass
cargo test --manifest-path lib/runtime/Cargo.toml --features singlepass
cargo test --manifest-path lib/middleware-common/Cargo.toml --features singlepass
test-emscripten-llvm:
cargo test --manifest-path lib/emscripten/Cargo.toml --features llvm -- --test-threads=1 $(runargs)
test-emscripten-clif:
cargo test --manifest-path lib/emscripten/Cargo.toml --features clif -- --test-threads=1 $(runargs)
test-emscripten-singlepass:
cargo test --manifest-path lib/emscripten/Cargo.toml --features singlepass -- --test-threads=1 $(runargs)
test-wasi-clif:
cargo test --manifest-path lib/wasi/Cargo.toml --features "clif" -- --test-threads=1 $(runargs)
test-wasi-singlepass:
cargo test --manifest-path lib/wasi/Cargo.toml --features "singlepass" -- --test-threads=1 $(runargs)
singlepass-debug-release:
cargo +nightly build --features backend:singlepass,debug --release
singlepass-release:
cargo +nightly build --features backend:singlepass --release
singlepass-build:
cargo +nightly build --features backend:singlepass,debug
release:
# If you are in OS-X, you will need mingw-w64 for cross compiling to windows
# brew install mingw-w64
cargo build --release
production-release:
cargo build --release --features backend:singlepass,backend:llvm,loader:kernel
debug-release:
cargo build --release --features debug
extra-debug-release:
cargo build --release --features extra-debug
publish-release:
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ./artifacts/
# cargo install cargo-deps
# must install graphviz for `dot`
dep-graph:
cargo deps --optional-deps --filter wasmer-wasi wasmer-kernel-loader wasmer-dev-utils wasmer-llvm-backend wasmer-emscripten wasmer-runtime-core wasmer-runtime wasmer-middleware-common wasmer-singlepass-backend wasmer-clif-backend wasmer --manifest-path Cargo.toml | dot -Tpng > wasmer_depgraph.png
cargo deps --optional-deps --filter wasmer-wasi wasmer-wasi-tests wasmer-kernel-loader wasmer-dev-utils wasmer-llvm-backend wasmer-emscripten wasmer-emscripten-tests wasmer-runtime-core wasmer-runtime wasmer-middleware-common wasmer-singlepass-backend wasmer-clif-backend wasmer --manifest-path Cargo.toml | dot -Tpng > wasmer_depgraph.png

View File

@ -153,6 +153,12 @@ nginx and Lua do not work on Windows. See [this issue](https://github.com/wasmer
Wasmer is built with [Cargo](https://crates.io/), the Rust package manager.
Set Rust Nightly:
```
rustup default nightly
```
And install Wasmer
```sh
# checkout code
git clone https://github.com/wasmerio/wasmer.git
@ -160,38 +166,45 @@ cd wasmer
# install tools
# make sure that `python` is accessible.
cargo install --path .
make install
```
## Testing
Thanks to [spec tests](https://github.com/wasmerio/wasmer/tree/master/lib/spectests/spectests) we can ensure 100% compatibility with the WebAssembly spec test suite.
Tests can be run with:
You can run all the tests with:
```sh
rustup default nightly
make test
```
If you need to regenerate the Rust tests from the spec tests
you can run:
### Testing backends
```sh
make spectests
```
Each backend can be tested separately:
You can also run integration tests with:
* Singlepass: `make singlepass`
* Cranelift: `make cranelift`
* LLVM: `make llvm`
### Testing integrations
Each integration can be tested separately:
* Spec tests: `make spectests`
* Emscripten: `make emtests`
* WASI: `make wasi`
* Middleware: `make middleware`
* C API: `make capi`
```sh
make integration-tests
```
## Benchmarking
Benchmarks can be run with:
```sh
cargo bench --all
make bench
```
## Roadmap

View File

@ -2,7 +2,7 @@ status = [
"ci/circleci: lint",
"ci/circleci: test",
"ci/circleci: test-macos",
"ci/circleci: test-rust-nightly",
"ci/circleci: test-stable",
"continuous-integration/appveyor/branch"
]
required_approvals = 1

74
examples/iterative_hash/Cargo.lock generated Normal file
View File

@ -0,0 +1,74 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "blake2"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "byte-tools"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "crypto-mac"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
"subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "digest"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "generic-array"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "iterative_hash"
version = "0.1.0"
dependencies = [
"blake2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "opaque-debug"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "subtle"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "typenum"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum blake2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91721a6330935673395a0607df4d49a9cb90ae12d259f1b3e0a3f6e1d486872e"
"checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
"checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5"
"checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c"
"checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
"checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409"
"checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee"
"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"

View File

@ -0,0 +1,12 @@
[package]
name = "iterative_hash"
version = "0.1.0"
authors = ["losfair <zhy20000919@hotmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[workspace]
[dependencies]
blake2 = "0.8"

View File

@ -0,0 +1,16 @@
use blake2::{Blake2b, Digest};
fn main() {
let mut data: Vec<u8> = b"test".to_vec();
for i in 0.. {
let mut hasher = Blake2b::new();
hasher.input(&data);
let out = hasher.result();
data = out.to_vec();
if i % 1000000 == 0 {
println!("Round {}: {:?}", i, data);
}
}
}

View File

@ -0,0 +1,67 @@
#[link(wasm_import_module = "wasmer_suspend")]
extern "C" {
fn suspend();
}
use std::collections::BTreeMap;
#[derive(Default)]
struct Node {
count: usize,
children: BTreeMap<char, Node>,
}
impl Node {
fn insert(&mut self, mut s: impl Iterator<Item = char>) {
match s.next() {
Some(x) => {
self.children.entry(x).or_default().insert(s);
}
None => {
self.count += 1;
}
}
}
fn for_each_dyn(&self, cb: &dyn Fn(&str, usize), prefix: &mut String) {
if self.count > 0 {
cb(&prefix, self.count);
}
for (k, v) in self.children.iter() {
prefix.push(*k);
v.for_each_dyn(cb, prefix);
prefix.pop().unwrap();
}
}
}
fn main() {
let mut root = Node::default();
root.insert("Ava".chars());
root.insert("Alexander".chars());
root.insert("Aiden".chars());
root.insert("Bella".chars());
root.insert("Brianna".chars());
root.insert("Brielle".chars());
root.insert("Charlotte".chars());
root.insert("Chloe".chars());
root.insert("Camila".chars());
println!("Tree ready, suspending.");
unsafe {
suspend();
}
root.for_each_dyn(
&|seq, count| {
println!("{}: {}", seq, count);
unsafe {
suspend();
}
},
&mut "".into(),
);
println!("[END]");
}

4
fuzz/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
target
corpus
artifacts

21
fuzz/Cargo.toml Normal file
View File

@ -0,0 +1,21 @@
[package]
name = "wasmer-fuzz"
version = "0.0.1"
authors = ["Automatically generated"]
publish = false
[package.metadata]
cargo-fuzz = true
[dependencies]
wasmer-runtime = { path = "../lib/runtime" }
libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" }
# Prevent this from interfering with workspaces
[workspace]
members = ["."]
[[bin]]
name = "simple_instantiate"
path = "fuzz_targets/simple_instantiate.rs"

38
fuzz/README.md Normal file
View File

@ -0,0 +1,38 @@
This directory contains the fuzz tests for wasmer. To fuzz, we use the `cargo-fuzz` package.
## Installation
You may need to install the `cargo-fuzz` package to get the `cargo fuzz` subcommand. Use
```sh
$ cargo install cargo-fuzz
```
`cargo-fuzz` is documented in the [Rust Fuzz Book](https://rust-fuzz.github.io/book/cargo-fuzz.html).
## Running a fuzzer
Once `cargo-fuzz` is installed, you can run the `simple_instantiate` fuzzer with
```sh
cargo fuzz run simple_instantiate
```
You should see output that looks something like this:
```
INFO: Seed: 3276026494
INFO: 8 files found in wasmer/fuzz/corpus/simple_instantiate
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
INFO: seed corpus: files: 8 min: 1b max: 1b total: 8b rss: 133Mb
#9 INITED ft: 3 corp: 3/3b lim: 4 exec/s: 0 rss: 142Mb
#23 NEW ft: 4 corp: 4/5b lim: 4 exec/s: 0 rss: 142Mb L: 2/2 MS: 4 ChangeByte-InsertByte-ShuffleBytes-ChangeBit-
#25 NEW ft: 5 corp: 5/6b lim: 4 exec/s: 0 rss: 142Mb L: 1/2 MS: 2 ChangeBinInt-ChangeBit-
#27 NEW ft: 6 corp: 6/9b lim: 4 exec/s: 0 rss: 142Mb L: 3/3 MS: 2 InsertByte-ChangeByte-
#190 REDUCE ft: 6 corp: 6/7b lim: 4 exec/s: 0 rss: 142Mb L: 1/2 MS: 3 ChangeBit-EraseBytes-CrossOver-
#205 REDUCE ft: 7 corp: 7/11b lim: 4 exec/s: 0 rss: 142Mb L: 4/4 MS: 5 ShuffleBytes-CrossOver-InsertByte-ChangeBinInt-CrossOver-
```
It will continue to generate random inputs forever, until it finds a bug or is terminated. The testcases for bugs it finds go into `fuzz/artifacts/simple_instantiate` and you can rerun the fuzzer on a single input by passing it on the command line `cargo fuzz run simple_instantiate my_testcase.wasm`.
## Trophy case
- [x] https://github.com/wasmerio/wasmer/issues/558

View File

@ -0,0 +1,13 @@
#![no_main]
#[macro_use] extern crate libfuzzer_sys;
extern crate wasmer_runtime;
use wasmer_runtime::{
instantiate,
imports,
};
fuzz_target!(|data: &[u8]| {
let import_object = imports! {};
instantiate(data, &import_object);
});

View File

@ -365,10 +365,14 @@ wasmer_download() {
# determine install directory if required
if [ -z "$INSTALL_DIRECTORY" ]; then
# findWasmerBinDirectory INSTALL_DIRECTORY
INSTALL_DIRECTORY="$HOME/.wasmer"
if [ -z "$WASMER_DIR" ]; then
# If WASMER_DIR is not present
INSTALL_DIRECTORY="$HOME/.wasmer"
else
# If WASMER_DIR is present
INSTALL_DIRECTORY="${WASMER_DIR}"
fi
fi
WASMER=INSTALL_DIRECTORY
# assemble expected release artifact name
BINARY="wasmer-${OS}-${ARCH}.tar.gz"

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-clif-backend"
version = "0.5.1"
version = "0.5.5"
description = "Wasmer runtime Cranelift compiler backend"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -8,17 +8,17 @@ repository = "https://github.com/wasmerio/wasmer"
edition = "2018"
[dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.5.1" }
cranelift-native = { git = "https://github.com/wasmerio/cranelift.git", rev = "84ec31b0fdfc10db491ef950815ee2961db057cb" }
cranelift-codegen = { git = "https://github.com/wasmerio/cranelift.git", rev = "84ec31b0fdfc10db491ef950815ee2961db057cb" }
cranelift-entity = { git = "https://github.com/wasmerio/cranelift.git", rev = "84ec31b0fdfc10db491ef950815ee2961db057cb" }
cranelift-frontend = { git = "https://github.com/wasmerio/cranelift.git", rev = "84ec31b0fdfc10db491ef950815ee2961db057cb" }
cranelift-wasm = { git = "https://github.com/wasmerio/cranelift.git", rev = "84ec31b0fdfc10db491ef950815ee2961db057cb" }
wasmer-runtime-core = { path = "../runtime-core", version = "0.5.5" }
cranelift-native = { version = "0.31" }
cranelift-codegen = { version = "0.31" }
cranelift-entity = { version = "0.31" }
cranelift-frontend = { package = "wasmer-clif-fork-frontend", version = "0.31" }
cranelift-wasm = { package = "wasmer-clif-fork-wasm", version = "0.31" }
hashbrown = "0.1"
target-lexicon = "0.4.0"
wasmparser = "0.29.2"
wasmparser = "0.32.1"
byteorder = "1"
nix = "0.13.0"
nix = "0.14.0"
libc = "0.2.49"
rayon = "1.0"
@ -34,7 +34,7 @@ version = "0.0.7"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["errhandlingapi", "minwindef", "minwinbase", "winnt"] }
wasmer-win-exception-handler = { path = "../win-exception-handler", version = "0.5.1" }
wasmer-win-exception-handler = { path = "../win-exception-handler", version = "0.5.5" }
[features]
debug = ["wasmer-runtime-core/debug"]

View File

@ -25,6 +25,7 @@ fn get_isa() -> Box<isa::TargetIsa> {
let flags = {
let mut builder = settings::builder();
builder.set("opt_level", "best").unwrap();
builder.set("jump_tables_enabled", "false").unwrap();
if cfg!(not(test)) {
builder.set("enable_verifier", "false").unwrap();

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-dev-utils"
version = "0.5.1"
version = "0.5.5"
description = "Wasmer runtime core library"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]

View File

@ -0,0 +1,28 @@
[package]
name = "wasmer-emscripten-tests"
version = "0.5.5"
description = "Tests for our Emscripten implementation"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
edition = "2018"
publish = false
build = "build/mod.rs"
[dependencies]
wasmer-emscripten = { path = "../emscripten", version = "0.5.5" }
wasmer-runtime-core = { path = "../runtime-core", version = "0.5.5" }
wasmer-clif-backend = { path = "../clif-backend", version = "0.5.5" }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.5.5", optional = true }
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.5.5", optional = true }
[dev-dependencies]
wabt = "0.7.2"
wasmer-dev-utils = { path = "../dev-utils", version = "0.5.5"}
[build-dependencies]
glob = "0.2.11"
[features]
clif = []
llvm = ["wasmer-llvm-backend"]
singlepass = ["wasmer-singlepass-backend"]

Some files were not shown because too many files have changed in this diff Show More