Merge remote-tracking branch 'origin/master' into feature/llvm-osr
@ -1,78 +0,0 @@
|
|||||||
version: "{build} ~ {branch}"
|
|
||||||
|
|
||||||
os: Visual Studio 2017
|
|
||||||
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- staging
|
|
||||||
- trying
|
|
||||||
- master
|
|
||||||
|
|
||||||
environment:
|
|
||||||
matrix:
|
|
||||||
- CHANNEL: stable
|
|
||||||
ARCH: x86_64
|
|
||||||
ABI: msvc
|
|
||||||
TARGET: x86_64-pc-windows-msvc
|
|
||||||
|
|
||||||
cache:
|
|
||||||
- 'C:\Users\appveyor\.cargo'
|
|
||||||
- target
|
|
||||||
|
|
||||||
install:
|
|
||||||
# Install LLVM
|
|
||||||
- mkdir C:\projects\deps
|
|
||||||
- cd C:\projects\deps
|
|
||||||
- appveyor DownloadFile https://github.com/wasmerio/windows-llvm-build/releases/download/v8.0.0/llvm-8.0.0-install.zip -FileName llvm-8.0.0-install.zip
|
|
||||||
- 7z x llvm-8.0.0-install.zip
|
|
||||||
- C:\projects\deps\llvm-8.0.0-install\bin\llvm-config.exe --version
|
|
||||||
- set "LLVM_SYS_80_PREFIX=C:\projects\deps\llvm-8.0.0-install"
|
|
||||||
- cd "%APPVEYOR_BUILD_FOLDER%"
|
|
||||||
|
|
||||||
# Install Rust
|
|
||||||
# uncomment these lines if the cache is cleared, or if we must re-install rust for some reason
|
|
||||||
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
|
||||||
- rustup-init.exe -yv --default-host %target%
|
|
||||||
- set PATH=%PATH%;%USERPROFILE%\.cargo\bin
|
|
||||||
- rustup default stable-%target%
|
|
||||||
- rustup update
|
|
||||||
- rustc -vV
|
|
||||||
- cargo -vV
|
|
||||||
|
|
||||||
# Install InnoSetup
|
|
||||||
- appveyor-retry appveyor DownloadFile https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/2017-08-22-is.exe
|
|
||||||
- 2017-08-22-is.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-
|
|
||||||
- set PATH="C:\Program Files (x86)\Inno Setup 5";%PATH%
|
|
||||||
# uncomment to RDP to appveyor
|
|
||||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
|
||||||
|
|
||||||
build_script:
|
|
||||||
- cargo build --release --verbose --features backend-llvm
|
|
||||||
- cargo build --release --manifest-path lib/runtime-c-api/Cargo.toml
|
|
||||||
|
|
||||||
test_script:
|
|
||||||
- cargo test --manifest-path lib/spectests/Cargo.toml --release --features clif -- --nocapture
|
|
||||||
|
|
||||||
before_deploy:
|
|
||||||
- appveyor PushArtifact target\release\wasmer_runtime_c_api.dll
|
|
||||||
- git submodule init
|
|
||||||
- git submodule update
|
|
||||||
- cargo build --release --manifest-path wapm-cli/Cargo.toml --features "telemetry update-notifications"
|
|
||||||
- cd ./src/installer
|
|
||||||
- iscc wasmer.iss
|
|
||||||
- copy /y .\WasmerInstaller.exe ..\..\WasmerInstaller-%APPVEYOR_REPO_TAG_NAME%.exe
|
|
||||||
- appveyor PushArtifact ..\..\WasmerInstaller-%APPVEYOR_REPO_TAG_NAME%.exe
|
|
||||||
- cd ..\..\
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
fast_finish: true
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
description: 'WasmerInstaller'
|
|
||||||
artifact: /.*\.exe/
|
|
||||||
auth_token:
|
|
||||||
secure: BbreGNDJy20922za7OhJG5TERzfX+dJSBQwttNTJkLvszbqMov6hhAtRb3P45hpf
|
|
||||||
provider: GitHub
|
|
||||||
on:
|
|
||||||
branch: master
|
|
||||||
appveyor_repo_tag: true
|
|
43
.azure/install-cmake.yml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# This template installs CMake (if doesn't exist in the systems)
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- bash: |
|
||||||
|
set -ex
|
||||||
|
if [ -x "`command -v cmake`" ]; then
|
||||||
|
echo `command -v cmake` `cmake --version` installed
|
||||||
|
else
|
||||||
|
curl -O https://cmake.org/files/v3.4/cmake-3.4.1-Darwin-x86_64.tar.gz
|
||||||
|
tar xf cmake-3.4.1-Darwin-x86_64.tar.gz
|
||||||
|
export CMAKE_BIN_PATH="`pwd`/cmake-3.4.1-Darwin-x86_64/CMake.app/Contents/bin"
|
||||||
|
echo "##vso[task.prependpath]$CMAKE_BIN_PATH"
|
||||||
|
fi
|
||||||
|
displayName: "Install CMake (macOS)"
|
||||||
|
condition: eq(variables['Agent.OS'], 'Darwin')
|
||||||
|
|
||||||
|
- bash: |
|
||||||
|
set -ex
|
||||||
|
if [ -x "`command -v cmake`" ]; then
|
||||||
|
echo `command -v cmake` `cmake --version` installed
|
||||||
|
else
|
||||||
|
curl -O https://cmake.org/files/v3.4/cmake-3.4.1-Linux-x86_64.tar.gz
|
||||||
|
tar xf cmake-3.4.1-Linux-x86_64.tar.gz
|
||||||
|
export CMAKE_BIN_PATH="`pwd`/cmake-3.4.1-Linux-x86_64/CMake.app/Contents/bin"
|
||||||
|
echo "##vso[task.prependpath]$CMAKE_BIN_PATH"
|
||||||
|
fi
|
||||||
|
displayName: "Install CMake (Linux)"
|
||||||
|
condition: eq(variables['Agent.OS'], 'Linux')
|
||||||
|
|
||||||
|
- bash: |
|
||||||
|
set -ex
|
||||||
|
if [ -x "`command -v cmake`" ]; then
|
||||||
|
echo `command -v cmake` `cmake --version` installed
|
||||||
|
else
|
||||||
|
chocolatey install cmake --installargs 'ADD_CMAKE_TO_PATH=System'
|
||||||
|
fi
|
||||||
|
displayName: "Install CMake (Windows)"
|
||||||
|
condition: eq(variables['Agent.OS'], 'Windows_NT')
|
||||||
|
|
||||||
|
- bash: |
|
||||||
|
set -ex
|
||||||
|
cmake --version
|
||||||
|
displayName: CMake version
|
18
.azure/install-innosetup.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# This template installs InnoSetup
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- bash: |
|
||||||
|
set -ex
|
||||||
|
if [ -x "`command -v iscc`" ]; then
|
||||||
|
echo `command -v iscc` `iscc -?` installed
|
||||||
|
else
|
||||||
|
choco install innosetup -y
|
||||||
|
fi
|
||||||
|
displayName: Install InnoSetup - Windows
|
||||||
|
condition: eq(variables['Agent.OS'], 'Windows_NT')
|
||||||
|
|
||||||
|
# - bash: |
|
||||||
|
# set -ex
|
||||||
|
# iscc
|
||||||
|
# displayName: InnoSetup
|
||||||
|
# condition: eq(variables['Agent.OS'], 'Windows_NT')
|
52
.azure/install-llvm.yml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# This template installs LLVM (if doesn't exist in the systems)
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- bash: |
|
||||||
|
set -ex
|
||||||
|
if [ -x "`command -v llvm-config`" ]; then
|
||||||
|
echo `command -v llvm-config` `llvm-config --version` installed
|
||||||
|
else
|
||||||
|
curl -O https://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz
|
||||||
|
tar xf clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz
|
||||||
|
export LLVM_PATH="`pwd`/clang+llvm-8.0.0-x86_64-apple-darwin/"
|
||||||
|
echo "##vso[task.prependpath]$LLVM_PATH/bin"
|
||||||
|
echo "##vso[task.setvariable variable=LLVM_SYS_80_PREFIX]$LLVM_PATH"
|
||||||
|
fi
|
||||||
|
displayName: "Install LLVM (macOS)"
|
||||||
|
condition: eq(variables['Agent.OS'], 'Darwin')
|
||||||
|
|
||||||
|
- bash: |
|
||||||
|
set -ex
|
||||||
|
if [ -x "`command -v llvm-config`" ]; then
|
||||||
|
echo `command -v llvm-config` `llvm-config --version` installed
|
||||||
|
else
|
||||||
|
curl -O https://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
|
||||||
|
tar xf clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
|
||||||
|
export LLVM_PATH="`pwd`/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04/"
|
||||||
|
echo "##vso[task.prependpath]$LLVM_PATH/bin"
|
||||||
|
echo "##vso[task.setvariable variable=LLVM_SYS_80_PREFIX]$LLVM_PATH"
|
||||||
|
fi
|
||||||
|
displayName: "Install LLVM (Linux)"
|
||||||
|
condition: eq(variables['Agent.OS'], 'Linux')
|
||||||
|
|
||||||
|
- bash: |
|
||||||
|
set -ex
|
||||||
|
if [ -x "`command -v llvm-config`" ]; then
|
||||||
|
echo `command -v cmake` `llvm-config --version` installed
|
||||||
|
else
|
||||||
|
curl -OL https://github.com/wasmerio/windows-llvm-build/releases/download/v8.0.0/llvm-8.0.0-install.zip
|
||||||
|
7z x llvm-8.0.0-install.zip
|
||||||
|
LLVM_PATH=`pwd`/llvm-8.0.0-install
|
||||||
|
LLVM_PATH_WIN=$SYSTEM_DEFAULTWORKINGDIRECTORY\\llvm-8.0.0-install
|
||||||
|
echo "##vso[task.prependpath]$LLVM_PATH/bin"
|
||||||
|
echo "##vso[task.setvariable variable=LLVM_SYS_80_PREFIX]$LLVM_PATH_WIN"
|
||||||
|
# chocolatey install cmake --installargs 'ADD_CMAKE_TO_PATH=System'
|
||||||
|
fi
|
||||||
|
displayName: "Install LLVM (Windows)"
|
||||||
|
condition: eq(variables['Agent.OS'], 'Windows_NT')
|
||||||
|
|
||||||
|
- bash: |
|
||||||
|
set -ex
|
||||||
|
env
|
||||||
|
llvm-config --version
|
||||||
|
displayName: LLVM version
|
43
.azure/install-rust.yml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# This template installs Rust (if doesn't exist in the systems)
|
||||||
|
# Also installs the desired Rust toolchain
|
||||||
|
|
||||||
|
# Template inspired by Tokio and wasm-bindgen templates
|
||||||
|
# Tokio template: https://github.com/tokio-rs/tokio/blob/master/ci/azure-install-rust.yml
|
||||||
|
# Wasm-bindgen template: https://github.com/rustwasm/wasm-bindgen/blob/master/ci/azure-install-rust.yml
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- bash: |
|
||||||
|
set -ex
|
||||||
|
if [ -x "`command -v rustup`" ]; then
|
||||||
|
echo `command -v rustup` `rustup -V` installed
|
||||||
|
else
|
||||||
|
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUST_TOOLCHAIN
|
||||||
|
echo "##vso[task.prependpath]$HOME/.cargo/bin"
|
||||||
|
fi
|
||||||
|
displayName: "Install Rust (Linux, macOS)"
|
||||||
|
condition: not(eq(variables['Agent.OS'], 'Windows_NT'))
|
||||||
|
|
||||||
|
- bash: |
|
||||||
|
set -ex
|
||||||
|
if [ -x "`command -v rustup`" ]; then
|
||||||
|
echo `command -v rustup` `rustup -V` installed
|
||||||
|
else
|
||||||
|
choco install rust -y
|
||||||
|
# curl -sSf -o rustup-init.exe https://win.rustup.rs
|
||||||
|
# ./rustup-init.exe -y --default-toolchain $RUST_TOOLCHAIN
|
||||||
|
# echo "##vso[task.prependpath]$USERPROFILE/.cargo/bin"
|
||||||
|
fi
|
||||||
|
displayName: "Install Rust (Windows)"
|
||||||
|
condition: eq(variables['Agent.OS'], 'Windows_NT')
|
||||||
|
|
||||||
|
- bash: |
|
||||||
|
set -ex
|
||||||
|
rustup update $RUST_TOOLCHAIN
|
||||||
|
rustup default $RUST_TOOLCHAIN
|
||||||
|
|
||||||
|
rustc -Vv
|
||||||
|
cargo -V
|
||||||
|
displayName: Install Rust
|
||||||
|
|
||||||
|
- bash: echo "##vso[task.setvariable variable=RUSTC_VERSION;]`rustc --version`"
|
||||||
|
displayName: Set rustc version in env var
|
37
.azure/install-sccache.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# This template installs sccache (Shared Compilation Cache)
|
||||||
|
# More info: https://github.com/mozilla/sccache
|
||||||
|
|
||||||
|
# Template originally from wasm-bindgen
|
||||||
|
# https://github.com/rustwasm/wasm-bindgen/blob/master/ci/azure-install-sccache.yml
|
||||||
|
steps:
|
||||||
|
- bash: |
|
||||||
|
set -ex
|
||||||
|
curl -L https://github.com/mozilla/sccache/releases/download/0.2.10/sccache-0.2.10-x86_64-unknown-linux-musl.tar.gz | tar xzf -
|
||||||
|
sccache=`pwd`/sccache-0.2.10-x86_64-unknown-linux-musl/sccache
|
||||||
|
echo "##vso[task.setvariable variable=RUSTC_WRAPPER;]$sccache"
|
||||||
|
displayName: Install sccache - Linux
|
||||||
|
condition: eq( variables['Agent.OS'], 'Linux' )
|
||||||
|
- bash: |
|
||||||
|
set -ex
|
||||||
|
brew install openssl@1.1
|
||||||
|
curl -L https://github.com/mozilla/sccache/releases/download/0.2.10/sccache-0.2.10-x86_64-apple-darwin.tar.gz | tar xzf -
|
||||||
|
sccache=`pwd`/sccache-0.2.10-x86_64-apple-darwin/sccache
|
||||||
|
echo "##vso[task.setvariable variable=RUSTC_WRAPPER;]$sccache"
|
||||||
|
displayName: Install sccache - Darwin
|
||||||
|
condition: eq( variables['Agent.OS'], 'Darwin' )
|
||||||
|
- powershell: |
|
||||||
|
Invoke-WebRequest https://github.com/mozilla/sccache/releases/download/0.2.10/sccache-0.2.10-x86_64-pc-windows-msvc.tar.gz -OutFile sccache.tar.gz
|
||||||
|
tar xzf sccache.tar.gz
|
||||||
|
Write-Host "##vso[task.setvariable variable=RUSTC_WRAPPER;]$pwd/sccache-0.2.10-x86_64-pc-windows-msvc/sccache.exe"
|
||||||
|
displayName: Install sccache - Windows
|
||||||
|
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
||||||
|
- bash: |
|
||||||
|
set -ex
|
||||||
|
env
|
||||||
|
SCCACHE_ERROR_LOG=`pwd`/sccache.log RUST_LOG=debug $RUSTC_WRAPPER --start-server
|
||||||
|
$RUSTC_WRAPPER -s
|
||||||
|
cat sccache.log
|
||||||
|
displayName: "start sccache"
|
||||||
|
env:
|
||||||
|
SCCACHE_AZURE_CONNECTION_STRING: $(SCCACHE_AZURE_CONNECTION_STRING)
|
||||||
|
SCCACHE_AZURE_BLOB_CONTAINER: $(SCCACHE_AZURE_BLOB_CONTAINER)
|
@ -1,442 +0,0 @@
|
|||||||
run_with_build_env_vars: &run_with_build_env_vars
|
|
||||||
environment:
|
|
||||||
LLVM_SYS_80_PREFIX: /home/circleci/project/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04/
|
|
||||||
|
|
||||||
run_install_dependencies: &run_install_dependencies
|
|
||||||
run:
|
|
||||||
name: install dependencies
|
|
||||||
command: |
|
|
||||||
sudo apt-get install -y cmake
|
|
||||||
curl -O https://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
|
|
||||||
tar xf clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
|
|
||||||
|
|
||||||
version: 2
|
|
||||||
jobs:
|
|
||||||
changelog:
|
|
||||||
docker:
|
|
||||||
- image: docker:stable-git
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- run:
|
|
||||||
command: ! git diff --exit-code CHANGELOG.md
|
|
||||||
|
|
||||||
# Job used for testing
|
|
||||||
lint:
|
|
||||||
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-lint-{{ arch }}-{{ checksum "Cargo.lock" }}
|
|
||||||
- <<: *run_install_dependencies
|
|
||||||
- run:
|
|
||||||
name: Install lint deps
|
|
||||||
command: |
|
|
||||||
git config --global --unset url."ssh://git@github.com".insteadOf || true
|
|
||||||
# rustup toolchain install nightly-2019-06-10
|
|
||||||
# rustup default nightly-2019-06-10
|
|
||||||
rustup component add rustfmt
|
|
||||||
rustup component add clippy || cargo install --git https://github.com/rust-lang/rust-clippy/ --force clippy
|
|
||||||
- run:
|
|
||||||
name: Execute lints
|
|
||||||
command: |
|
|
||||||
cargo fmt --all -- --check
|
|
||||||
- save_cache:
|
|
||||||
paths:
|
|
||||||
- /usr/local/cargo/registry
|
|
||||||
- target/debug/.fingerprint
|
|
||||||
- target/debug/build
|
|
||||||
- target/debug/deps
|
|
||||||
key: v8-lint-{{ arch }}-{{ checksum "Cargo.lock" }}
|
|
||||||
|
|
||||||
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: Test everything (except singlepass)
|
|
||||||
command: |
|
|
||||||
make cranelift
|
|
||||||
make llvm
|
|
||||||
make test-rest
|
|
||||||
- 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-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
|
|
||||||
make compile-bench-singlepass
|
|
||||||
make compile-bench-llvm
|
|
||||||
# TODO: add compile-bench-clif when it works
|
|
||||||
- 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-rust-example:
|
|
||||||
docker:
|
|
||||||
- image: circleci/rust:latest
|
|
||||||
<<: *run_with_build_env_vars
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- run:
|
|
||||||
name: "Check Wasmer Rust example"
|
|
||||||
command: |
|
|
||||||
git clone https://github.com/wasmerio/wasmer-rust-example
|
|
||||||
rustup default stable
|
|
||||||
rustup target add wasm32-unknown-unknown
|
|
||||||
cd wasmer-rust-example
|
|
||||||
cd wasm-sample-app
|
|
||||||
cargo build --release
|
|
||||||
cd ..
|
|
||||||
sed -i 's/wasmer-runtime.*/wasmer-runtime = \{ path = "..\/lib\/runtime" \}/g' Cargo.toml
|
|
||||||
cargo run
|
|
||||||
cargo test
|
|
||||||
|
|
||||||
test-macos:
|
|
||||||
macos:
|
|
||||||
xcode: "9.0"
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- run:
|
|
||||||
name: "Pull Submodules"
|
|
||||||
command: |
|
|
||||||
git submodule update --init
|
|
||||||
- restore_cache:
|
|
||||||
keys:
|
|
||||||
- v8-cargo-cache-darwin-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
|
|
||||||
- run:
|
|
||||||
name: Install crate dependencies
|
|
||||||
command: |
|
|
||||||
# Installing cmake outside of brew to improve speed
|
|
||||||
curl -O https://cmake.org/files/v3.4/cmake-3.4.1-Darwin-x86_64.tar.gz
|
|
||||||
tar xf cmake-3.4.1-Darwin-x86_64.tar.gz
|
|
||||||
export PATH="`pwd`/cmake-3.4.1-Darwin-x86_64/CMake.app/Contents/bin:$PATH"
|
|
||||||
# Installing LLVM outside of brew
|
|
||||||
curl -O https://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz
|
|
||||||
tar xf clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz
|
|
||||||
- run:
|
|
||||||
name: Install Rust
|
|
||||||
command: |
|
|
||||||
curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly-2019-06-10
|
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
|
||||||
cargo --version
|
|
||||||
- run:
|
|
||||||
name: Tests
|
|
||||||
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_80_PREFIX="`pwd`/clang+llvm-8.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
|
|
||||||
- run:
|
|
||||||
name: Check
|
|
||||||
command: |
|
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
|
||||||
export LLVM_SYS_80_PREFIX="`pwd`/clang+llvm-8.0.0-x86_64-apple-darwin/"
|
|
||||||
make check
|
|
||||||
- run:
|
|
||||||
name: Integration Tests
|
|
||||||
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_80_PREFIX="`pwd`/clang+llvm-8.0.0-x86_64-apple-darwin/"
|
|
||||||
make integration-tests
|
|
||||||
- save_cache:
|
|
||||||
paths:
|
|
||||||
- ~/.cargo/registry/
|
|
||||||
- target/release/.fingerprint
|
|
||||||
- target/release/build
|
|
||||||
- target/release/deps
|
|
||||||
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: |
|
|
||||||
git submodule init
|
|
||||||
git submodule update
|
|
||||||
- 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/8.0.0/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
|
|
||||||
tar xf clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
|
|
||||||
- run: rustup default nightly-2019-06-10
|
|
||||||
- run:
|
|
||||||
name: Tests
|
|
||||||
command: |
|
|
||||||
export LLVM_SYS_80_PREFIX="`pwd`/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04/"
|
|
||||||
make test
|
|
||||||
- run:
|
|
||||||
name: Release Build
|
|
||||||
command: |
|
|
||||||
export LLVM_SYS_80_PREFIX="`pwd`/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04/"
|
|
||||||
make release
|
|
||||||
cargo build --release --manifest-path wapm-cli/Cargo.toml --features "telemetry update-notifications"
|
|
||||||
mkdir -p artifacts
|
|
||||||
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
|
|
||||||
# GIT_VERSION=$(git describe --exact-match --tags)
|
|
||||||
echo "${VERSION}" >> artifacts/version
|
|
||||||
echo "${CIRCLE_TAG}" >> artifacts/git_version
|
|
||||||
make build-install
|
|
||||||
cp ./wasmer.tar.gz ./artifacts/$(./scripts/binary-name.sh)
|
|
||||||
- run:
|
|
||||||
name: Dynamic library
|
|
||||||
command: |
|
|
||||||
cargo build --release --manifest-path lib/runtime-c-api/Cargo.toml
|
|
||||||
cp target/release/libwasmer_runtime_c_api.so ./artifacts
|
|
||||||
- persist_to_workspace:
|
|
||||||
root: .
|
|
||||||
paths:
|
|
||||||
- artifacts
|
|
||||||
- save_cache:
|
|
||||||
paths:
|
|
||||||
- /usr/local/cargo/registry
|
|
||||||
- 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-linux-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
|
|
||||||
|
|
||||||
test-and-build-macos:
|
|
||||||
macos:
|
|
||||||
xcode: "9.0"
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- run:
|
|
||||||
name: "Pull dependencies"
|
|
||||||
command: |
|
|
||||||
git submodule init
|
|
||||||
git submodule update
|
|
||||||
- restore_cache:
|
|
||||||
keys:
|
|
||||||
- v8-cargo-cache-darwin-nightly-{{ arch }}-{{ checksum "Cargo.lock" }}
|
|
||||||
- run:
|
|
||||||
name: Install crate dependencies
|
|
||||||
command: |
|
|
||||||
# Installing cmake outside of brew to improve speed
|
|
||||||
curl -O https://cmake.org/files/v3.4/cmake-3.4.1-Darwin-x86_64.tar.gz
|
|
||||||
tar xf cmake-3.4.1-Darwin-x86_64.tar.gz
|
|
||||||
export PATH="`pwd`/cmake-3.4.1-Darwin-x86_64/CMake.app/Contents/bin:$PATH"
|
|
||||||
# Installing LLVM outside of brew
|
|
||||||
curl -O https://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz
|
|
||||||
tar xf clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz
|
|
||||||
- run:
|
|
||||||
name: Install Rust
|
|
||||||
command: |
|
|
||||||
curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly-2019-06-10
|
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
|
||||||
cargo --version
|
|
||||||
- run:
|
|
||||||
name: 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_80_PREFIX="`pwd`/clang+llvm-8.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
|
|
||||||
- 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_80_PREFIX="`pwd`/clang+llvm-8.0.0-x86_64-apple-darwin/"
|
|
||||||
make release
|
|
||||||
cargo build --release --manifest-path wapm-cli/Cargo.toml --features "telemetry update-notifications"
|
|
||||||
mkdir -p artifacts
|
|
||||||
make build-install
|
|
||||||
cp ./wasmer.tar.gz ./artifacts/$(./scripts/binary-name.sh)
|
|
||||||
# VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
|
|
||||||
# echo "${VERSION}" >> artifacts/version
|
|
||||||
- run:
|
|
||||||
name: Generate dynamic library for the runtime C API
|
|
||||||
command: |
|
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
|
||||||
cargo build --release --manifest-path lib/runtime-c-api/Cargo.toml
|
|
||||||
install_name_tool -id "@rpath/libwasmer_runtime_c_api.dylib" target/release/libwasmer_runtime_c_api.dylib
|
|
||||||
cp target/release/libwasmer_runtime_c_api.dylib ./artifacts
|
|
||||||
- persist_to_workspace:
|
|
||||||
root: .
|
|
||||||
paths:
|
|
||||||
- artifacts
|
|
||||||
- save_cache:
|
|
||||||
paths:
|
|
||||||
- ~/.cargo/registry/
|
|
||||||
- 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" }}
|
|
||||||
|
|
||||||
publish-github-release:
|
|
||||||
docker:
|
|
||||||
- image: cibuilds/github
|
|
||||||
steps:
|
|
||||||
- attach_workspace:
|
|
||||||
at: .
|
|
||||||
- run:
|
|
||||||
name: "Publish Release on GitHub"
|
|
||||||
command: |
|
|
||||||
# go get github.com/tcnksm/ghr
|
|
||||||
# VERSION=$(git log -1 --pretty=%B)
|
|
||||||
# VERSION=$(./artifacts/ --version)
|
|
||||||
VERSION=$(cat ./artifacts/version)
|
|
||||||
# VERSION_TAG=${CIRCLE_TAG}
|
|
||||||
VERSION_TAG=$(cat ./artifacts/git_version)
|
|
||||||
LATEST_VERSION_PUBLISHED_ON_CRATES=$(curl -s https://raw.githubusercontent.com/rust-lang/crates.io-index/master/wa/sm/wasmer-runtime | tail -n 1 | sed 's/.*"vers":"\([^"]*\)".*/\1/')
|
|
||||||
if ( [ $VERSION_TAG -ne $LATEST_VERSION_PUBLISHED_ON_CRATES ] ) then { echo "Could not detect version published to crates.io; make sure we've published the crates before publishing the Wasmer binary"; exit 1; } else { true; } fi
|
|
||||||
rm ./artifacts/version
|
|
||||||
rm ./artifacts/git_version
|
|
||||||
# VERSION_TAG=$(git describe --exact-match --tags)
|
|
||||||
#if [ "$VERSION" == "$VERSION_TAG" ]; then
|
|
||||||
# echo "Versions match, publishing to Github"
|
|
||||||
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} ${VERSION} ./artifacts/ || true
|
|
||||||
#else
|
|
||||||
# echo "Versions don't match. Wasmer output version (wasmer --version) is ${VERSION} while Git tag is ${VERSION_TAG}"
|
|
||||||
# exit 1
|
|
||||||
#fi
|
|
||||||
trigger-benchmark-build:
|
|
||||||
docker:
|
|
||||||
- image: circleci/rust:latest
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
name: "Trigger Benchmark Build"
|
|
||||||
command: |
|
|
||||||
if [[ -z "${CIRCLE_API_USER_TOKEN}" ]]; then
|
|
||||||
echo "CIRCLE_API_USER_TOKEN environment variable not set"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "Triggering benchmark build"
|
|
||||||
curl -u ${CIRCLE_API_USER_TOKEN} \
|
|
||||||
-d build_parameters[CIRCLE_JOB]=bench \
|
|
||||||
https://circleci.com/api/v1.1/project/github/wasmerio/wasmer-bench/tree/master
|
|
||||||
fi
|
|
||||||
workflows:
|
|
||||||
version: 2
|
|
||||||
main:
|
|
||||||
jobs:
|
|
||||||
- changelog
|
|
||||||
- lint
|
|
||||||
- test:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- trying
|
|
||||||
- staging
|
|
||||||
- test-rust-example:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- trying
|
|
||||||
- staging
|
|
||||||
- test-macos:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- trying
|
|
||||||
- staging
|
|
||||||
- test-and-build:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- test-and-build-macos:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- test-stable:
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- trying
|
|
||||||
- staging
|
|
||||||
- publish-github-release:
|
|
||||||
requires:
|
|
||||||
- lint
|
|
||||||
- test-and-build
|
|
||||||
- test-and-build-macos
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only: master
|
|
||||||
- trigger-benchmark-build:
|
|
||||||
requires:
|
|
||||||
- test-and-build
|
|
||||||
- lint
|
|
||||||
filters:
|
|
||||||
branches:
|
|
||||||
only: master
|
|
@ -8,6 +8,7 @@ Blocks of changes will separated by version increments.
|
|||||||
|
|
||||||
Special thanks to @YaronWittenstein @penberg for their contributions.
|
Special thanks to @YaronWittenstein @penberg for their contributions.
|
||||||
|
|
||||||
|
- [#656](https://github.com/wasmerio/wasmer/issues/656) Move CI to Azure Pipelines
|
||||||
- [#650](https://github.com/wasmerio/wasmer/issues/650) Implement `wasi::path_rename`, improve WASI FS public api, and allow open files to exist even when the underlying file is deleted
|
- [#650](https://github.com/wasmerio/wasmer/issues/650) Implement `wasi::path_rename`, improve WASI FS public api, and allow open files to exist even when the underlying file is deleted
|
||||||
- [#643](https://github.com/wasmerio/wasmer/issues/643) Implement `wasi::path_symlink` and improve WASI FS public api IO error reporting
|
- [#643](https://github.com/wasmerio/wasmer/issues/643) Implement `wasi::path_symlink` and improve WASI FS public api IO error reporting
|
||||||
- [#608](https://github.com/wasmerio/wasmer/issues/608) Implement wasi syscalls `fd_allocate`, `fd_sync`, `fd_pread`, `path_link`, `path_filestat_set_times`; update WASI fs API in a WIP way; reduce coupling of WASI code to host filesystem; make debug messages from WASI more readable; improve rights-checking when calling syscalls; implement reference counting on inodes; misc bug fixes and improvements
|
- [#608](https://github.com/wasmerio/wasmer/issues/608) Implement wasi syscalls `fd_allocate`, `fd_sync`, `fd_pread`, `path_link`, `path_filestat_set_times`; update WASI fs API in a WIP way; reduce coupling of WASI code to host filesystem; make debug messages from WASI more readable; improve rights-checking when calling syscalls; implement reference counting on inodes; misc bug fixes and improvements
|
||||||
|
76
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as
|
||||||
|
contributors and maintainers pledge to making participation in our project and
|
||||||
|
our community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||||
|
level of experience, education, socio-economic status, nationality, personal
|
||||||
|
appearance, race, religion, or sexual identity and orientation.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to creating a positive environment
|
||||||
|
include:
|
||||||
|
|
||||||
|
* Using welcoming and inclusive language
|
||||||
|
* Being respectful of differing viewpoints and experiences
|
||||||
|
* Gracefully accepting constructive criticism
|
||||||
|
* Focusing on what is best for the community
|
||||||
|
* Showing empathy towards other community members
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||||
|
advances
|
||||||
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or electronic
|
||||||
|
address, without explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Our Responsibilities
|
||||||
|
|
||||||
|
Project maintainers are responsible for clarifying the standards of acceptable
|
||||||
|
behavior and are expected to take appropriate and fair corrective action in
|
||||||
|
response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or
|
||||||
|
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||||
|
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||||
|
permanently any contributor for other behaviors that they deem inappropriate,
|
||||||
|
threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies both within project spaces and in public spaces
|
||||||
|
when an individual is representing the project or its community. Examples of
|
||||||
|
representing a project or community include using an official project e-mail
|
||||||
|
address, posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event. Representation of a project may be
|
||||||
|
further defined and clarified by project maintainers.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported by contacting the project team at contact@wasmer.io. All
|
||||||
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||||
|
faith may face temporary or permanent repercussions as determined by other
|
||||||
|
members of the project's leadership.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||||
|
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see
|
||||||
|
https://www.contributor-covenant.org/faq
|
9
Cargo.lock
generated
@ -1437,6 +1437,7 @@ dependencies = [
|
|||||||
"wasmer-kernel-loader 0.1.0",
|
"wasmer-kernel-loader 0.1.0",
|
||||||
"wasmer-llvm-backend 0.6.0",
|
"wasmer-llvm-backend 0.6.0",
|
||||||
"wasmer-middleware-common 0.6.0",
|
"wasmer-middleware-common 0.6.0",
|
||||||
|
"wasmer-middleware-common-tests 0.6.0",
|
||||||
"wasmer-runtime 0.6.0",
|
"wasmer-runtime 0.6.0",
|
||||||
"wasmer-runtime-core 0.6.0",
|
"wasmer-runtime-core 0.6.0",
|
||||||
"wasmer-singlepass-backend 0.6.0",
|
"wasmer-singlepass-backend 0.6.0",
|
||||||
@ -1558,11 +1559,19 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "wasmer-middleware-common"
|
name = "wasmer-middleware-common"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
|
dependencies = [
|
||||||
|
"wasmer-runtime-core 0.6.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasmer-middleware-common-tests"
|
||||||
|
version = "0.6.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wabt 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"wabt 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"wasmer-clif-backend 0.6.0",
|
"wasmer-clif-backend 0.6.0",
|
||||||
"wasmer-llvm-backend 0.6.0",
|
"wasmer-llvm-backend 0.6.0",
|
||||||
|
"wasmer-middleware-common 0.6.0",
|
||||||
"wasmer-runtime-core 0.6.0",
|
"wasmer-runtime-core 0.6.0",
|
||||||
"wasmer-singlepass-backend 0.6.0",
|
"wasmer-singlepass-backend 0.6.0",
|
||||||
]
|
]
|
||||||
|
11
Cargo.toml
@ -35,6 +35,7 @@ wasmer-wasi = { path = "lib/wasi", optional = true }
|
|||||||
wasmer-kernel-loader = { path = "lib/kernel-loader", optional = true }
|
wasmer-kernel-loader = { path = "lib/kernel-loader", optional = true }
|
||||||
wasmer-dev-utils = { path = "lib/dev-utils", optional = true }
|
wasmer-dev-utils = { path = "lib/dev-utils", optional = true }
|
||||||
wasmer-wasi-tests = { path = "lib/wasi-tests", optional = true }
|
wasmer-wasi-tests = { path = "lib/wasi-tests", optional = true }
|
||||||
|
wasmer-middleware-common-tests = { path = "lib/middleware-common-tests", optional = true }
|
||||||
wasmer-emscripten-tests = { path = "lib/emscripten-tests", optional = true }
|
wasmer-emscripten-tests = { path = "lib/emscripten-tests", optional = true }
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
@ -56,6 +57,7 @@ members = [
|
|||||||
"lib/dev-utils",
|
"lib/dev-utils",
|
||||||
"lib/wasi-tests",
|
"lib/wasi-tests",
|
||||||
"lib/emscripten-tests",
|
"lib/emscripten-tests",
|
||||||
|
"lib/middleware-common-tests",
|
||||||
"examples/plugin-for-example"
|
"examples/plugin-for-example"
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -75,19 +77,22 @@ fast-tests = []
|
|||||||
backend-cranelift = [
|
backend-cranelift = [
|
||||||
"wasmer-runtime-core/backend-cranelift",
|
"wasmer-runtime-core/backend-cranelift",
|
||||||
"wasmer-runtime/cranelift",
|
"wasmer-runtime/cranelift",
|
||||||
"wasmer-middleware-common/clif"
|
"wasmer-middleware-common-tests/clif",
|
||||||
|
"wasmer-wasi-tests/clif"
|
||||||
]
|
]
|
||||||
backend-llvm = [
|
backend-llvm = [
|
||||||
"wasmer-llvm-backend",
|
"wasmer-llvm-backend",
|
||||||
"wasmer-runtime-core/backend-llvm",
|
"wasmer-runtime-core/backend-llvm",
|
||||||
"wasmer-runtime/llvm",
|
"wasmer-runtime/llvm",
|
||||||
"wasmer-middleware-common/llvm"
|
"wasmer-middleware-common-tests/llvm",
|
||||||
|
"wasmer-wasi-tests/llvm"
|
||||||
]
|
]
|
||||||
backend-singlepass = [
|
backend-singlepass = [
|
||||||
"wasmer-singlepass-backend",
|
"wasmer-singlepass-backend",
|
||||||
"wasmer-runtime-core/backend-singlepass",
|
"wasmer-runtime-core/backend-singlepass",
|
||||||
"wasmer-runtime/singlepass",
|
"wasmer-runtime/singlepass",
|
||||||
"wasmer-middleware-common/singlepass"
|
"wasmer-middleware-common-tests/singlepass",
|
||||||
|
"wasmer-wasi-tests/singlepass"
|
||||||
]
|
]
|
||||||
wasi = ["wasmer-wasi"]
|
wasi = ["wasmer-wasi"]
|
||||||
managed = ["backend-singlepass", "wasmer-runtime-core/managed"]
|
managed = ["backend-singlepass", "wasmer-runtime-core/managed"]
|
||||||
|
34
Makefile
@ -50,13 +50,13 @@ emtests: emtests-unit emtests-singlepass emtests-cranelift emtests-llvm
|
|||||||
|
|
||||||
# Middleware tests
|
# Middleware tests
|
||||||
middleware-singlepass:
|
middleware-singlepass:
|
||||||
cargo test --manifest-path lib/middleware-common/Cargo.toml --release --features singlepass
|
cargo test --manifest-path lib/middleware-common-tests/Cargo.toml --release --features singlepass
|
||||||
|
|
||||||
middleware-cranelift:
|
middleware-cranelift:
|
||||||
cargo test --manifest-path lib/middleware-common/Cargo.toml --release --features clif
|
cargo test --manifest-path lib/middleware-common-tests/Cargo.toml --release --features clif
|
||||||
|
|
||||||
middleware-llvm:
|
middleware-llvm:
|
||||||
cargo test --manifest-path lib/middleware-common/Cargo.toml --release --features llvm
|
cargo test --manifest-path lib/middleware-common-tests/Cargo.toml --release --features llvm
|
||||||
|
|
||||||
middleware: middleware-singlepass middleware-cranelift middleware-llvm
|
middleware: middleware-singlepass middleware-cranelift middleware-llvm
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ capi:
|
|||||||
cargo test -p wasmer-runtime-c-api --release
|
cargo test -p wasmer-runtime-c-api --release
|
||||||
|
|
||||||
test-rest: capi
|
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
|
cargo test --release --all --exclude wasmer-runtime-c-api --exclude wasmer-emscripten --exclude wasmer-spectests --exclude wasmer-wasi --exclude wasmer-middleware-common --exclude wasmer-middleware-common-tests --exclude wasmer-singlepass-backend --exclude wasmer-clif-backend --exclude wasmer-llvm-backend --exclude wasmer-wasi-tests --exclude wasmer-emscripten-tests
|
||||||
|
|
||||||
circleci-clean:
|
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;
|
@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;
|
||||||
@ -127,9 +127,20 @@ debug:
|
|||||||
install:
|
install:
|
||||||
cargo install --path .
|
cargo install --path .
|
||||||
|
|
||||||
check:
|
# Checks
|
||||||
cargo check --release --features backend-singlepass,backend-llvm,loader-kernel
|
check-bench-singlepass:
|
||||||
|
cargo bench --all --no-run --no-default-features --features "backend-singlepass"
|
||||||
|
check-bench-clif:
|
||||||
|
cargo bench --all --no-run --no-default-features --features "backend-cranelift"
|
||||||
|
check-bench-llvm:
|
||||||
|
cargo bench --all --no-run --no-default-features --features "backend-llvm"
|
||||||
|
|
||||||
|
check-bench: check-bench-singlepass check-bench-llvm
|
||||||
|
|
||||||
|
check: check-bench
|
||||||
|
cargo check --release --features backend-singlepass,backend-llvm,loader-kernel,debug
|
||||||
|
|
||||||
|
# Release
|
||||||
release:
|
release:
|
||||||
cargo build --release --features backend-singlepass,backend-llvm,loader-kernel
|
cargo build --release --features backend-singlepass,backend-llvm,loader-kernel
|
||||||
|
|
||||||
@ -152,15 +163,6 @@ bench-clif:
|
|||||||
bench-llvm:
|
bench-llvm:
|
||||||
cargo bench --all --no-default-features --features "backend-llvm"
|
cargo bench --all --no-default-features --features "backend-llvm"
|
||||||
|
|
||||||
# compile but don't run the benchmarks
|
|
||||||
compile-bench-singlepass:
|
|
||||||
cargo bench --all --no-run --no-default-features --features "backend-singlepass"
|
|
||||||
compile-bench-clif:
|
|
||||||
cargo bench --all --no-run --no-default-features --features "backend-cranelift"
|
|
||||||
compile-bench-llvm:
|
|
||||||
cargo bench --all --no-run --no-default-features --features "backend-llvm"
|
|
||||||
|
|
||||||
|
|
||||||
# Build utils
|
# Build utils
|
||||||
build-install:
|
build-install:
|
||||||
mkdir -p ./install/bin
|
mkdir -p ./install/bin
|
||||||
@ -178,4 +180,4 @@ publish-release:
|
|||||||
# cargo install cargo-deps
|
# cargo install cargo-deps
|
||||||
# must install graphviz for `dot`
|
# must install graphviz for `dot`
|
||||||
dep-graph:
|
dep-graph:
|
||||||
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
|
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-middleware-common-tests wasmer-singlepass-backend wasmer-clif-backend wasmer --manifest-path Cargo.toml | dot -Tpng > wasmer_depgraph.png
|
||||||
|
43
README.md
@ -5,41 +5,49 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://circleci.com/gh/wasmerio/wasmer/">
|
<a href="https://dev.azure.com/wasmerio/wasmer/_build/latest?definitionId=3&branchName=master">
|
||||||
<img src="https://img.shields.io/circleci/project/github/wasmerio/wasmer/master.svg" alt="Build Status">
|
<img src="https://img.shields.io/azure-devops/build/wasmerio/wasmer/3.svg?style=flat-square" alt="Build Status">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/wasmerio/wasmer/blob/master/LICENSE">
|
<a href="https://github.com/wasmerio/wasmer/blob/master/LICENSE">
|
||||||
<img src="https://img.shields.io/github/license/wasmerio/wasmer.svg" alt="License">
|
<img src="https://img.shields.io/github/license/wasmerio/wasmer.svg?style=flat-square" alt="License">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://spectrum.chat/wasmer">
|
<a href="https://spectrum.chat/wasmer">
|
||||||
<img src="https://withspectrum.github.io/badge/badge.svg" alt="Join the Wasmer Community">
|
<img src="https://withspectrum.github.io/badge/badge.svg" alt="Join the Wasmer Community">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://twitter.com/wasmerio">
|
<a href="https://twitter.com/wasmerio">
|
||||||
<img alt="Follow @wasmerio on Twitter" src="https://img.shields.io/twitter/follow/wasmerio?label=%40wasmerio&style=social">
|
<img alt="Follow @wasmerio on Twitter" src="https://img.shields.io/twitter/follow/wasmerio?label=%40wasmerio&style=flat-square">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
[Wasmer](https://wasmer.io/) is a standalone JIT WebAssembly runtime, aiming to be fully compatible with [WASI](https://github.com/WebAssembly/WASI) and [Emscripten](https://emscripten.org/).
|
[Wasmer](https://wasmer.io/) is a standalone WebAssembly runtime, for running WebAssembly [outside of the Browser](https://webassembly.org/docs/non-web/), supporting [WASI](https://github.com/WebAssembly/WASI) and [Emscripten](https://emscripten.org/).
|
||||||
|
|
||||||
Install Wasmer with:
|
Install the Wasmer CLI with:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl https://get.wasmer.io -sSfL | sh
|
curl https://get.wasmer.io -sSfL | sh
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note: *Wasmer is also available on Windows. Download the [`WasmerInstaller.exe` from the Github Releases](https://github.com/wasmerio/wasmer/releases) page.*
|
> Note: *Wasmer is also [available on Windows](https://github.com/wasmerio/wasmer/releases)*
|
||||||
|
|
||||||
Wasmer runtime can also be embedded in different languages, so you can use WebAssembly anywhere ✨:
|
### Languages
|
||||||
|
|
||||||
* [**🦀 Rust**](https://github.com/wasmerio/wasmer-rust-example)
|
Wasmer runtime can be used as a library embedded in different languages, so you can use WebAssembly anywhere:
|
||||||
* [**🔗 C/C++**](https://github.com/wasmerio/wasmer-c-api)
|
|
||||||
* [**#️⃣ C#**](https://github.com/migueldeicaza/WasmerSharp)
|
| | Language | Author(s) | Maintenance | Release | Stars |
|
||||||
* [**🐘 PHP**](https://github.com/wasmerio/php-ext-wasm)
|
|-|-|-|-|-|-|
|
||||||
* [**🐍 Python**](https://github.com/wasmerio/python-ext-wasm)
|
|  | [**Rust**](https://github.com/wasmerio/wasmer-rust-example) | Wasmer | actively developed | <a href="https://crates.io/crates/wasmer-runtime/" target="_blank"></a> |  |
|
||||||
* [**💎 Ruby**](https://github.com/wasmerio/ruby-ext-wasm)
|
|  | [**C/C++**](https://github.com/wasmerio/wasmer-c-api) | Wasmer | actively developed | <a href="https://github.com/wasmerio/wasmer-c-api/" target="_blank"></a> |  |
|
||||||
* [**🐹 Go**](https://github.com/wasmerio/go-ext-wasm)
|
|  | [**Python**](https://github.com/wasmerio/python-ext-wasm) | Wasmer | actively developed | <a href="https://pypi.org/project/wasmer/" target="_blank"></a> |  |
|
||||||
|
|  | [**Go**](https://github.com/wasmerio/go-ext-wasm) | Wasmer | actively developed | <a href="https://github.com/wasmerio/go-ext-wasm" target="_blank"></a> |  |
|
||||||
|
|  | [**PHP**](https://github.com/wasmerio/php-ext-wasm) | Wasmer | actively developed | <a href="https://pecl.php.net/package/wasm" target="_blank"></a> |  |
|
||||||
|
|  | [**Ruby**](https://github.com/wasmerio/ruby-ext-wasm) | Wasmer | actively developed | <a href="https://rubygems.org/gems/wasmer" target="_blank"></a> |  |
|
||||||
|
|  | [**Postgres**](https://github.com/wasmerio/postgres-ext-wasm) | Wasmer | actively developed | <a href="https://github.com/wasmerio/postgres-ext-wasm" target="_blank"></a> |  |
|
||||||
|
|  | [**C#/.Net**](https://github.com/migueldeicaza/WasmerSharp) | [Miguel de Icaza](https://github.com/migueldeicaza) | actively developed | <a href="https://www.nuget.org/packages/WasmerSharp/" target="_blank"></a> |  |
|
||||||
|
|  | [**R**](https://github.com/dirkschumacher/wasmr) | [Dirk Schumacher](https://github.com/dirkschumacher) | actively developed | |  |
|
||||||
|
|  | [**Swift**](https://github.com/markmals/swift-ext-wasm) | [Mark Malström](https://github.com/markmals/) | passively maintened | |  |
|
||||||
|
| ❓ | [your language is missing?](https://github.com/wasmerio/wasmer/issues/new?assignees=&labels=%F0%9F%8E%89+enhancement&template=---feature-request.md&title=) | | | |
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
@ -169,14 +177,19 @@ nginx and Lua do not work on Windows - you can track the progress on [this issue
|
|||||||
</details>
|
</details>
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
[](https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html)
|
||||||
|
|
||||||
Wasmer is built with [Cargo](https://crates.io/), the Rust package manager.
|
Wasmer is built with [Cargo](https://crates.io/), the Rust package manager.
|
||||||
|
|
||||||
|
The Singlepass backend requires nightly, so if you want to use it,
|
||||||
|
|
||||||
Set Rust Nightly:
|
Set Rust Nightly:
|
||||||
```
|
```
|
||||||
rustup default nightly
|
rustup default nightly
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Otherwise an up to date (see badge above) verison of stable Rust will work.
|
||||||
|
|
||||||
And install Wasmer
|
And install Wasmer
|
||||||
```sh
|
```sh
|
||||||
# checkout code
|
# checkout code
|
||||||
|
214
azure-pipelines.yml
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
name: $(Build.SourceBranch)-$(date:yyyyMMdd)$(rev:.r)
|
||||||
|
|
||||||
|
# The Different jobs (lint, test, build to run)
|
||||||
|
jobs:
|
||||||
|
- job: changelog
|
||||||
|
steps:
|
||||||
|
- bash: |
|
||||||
|
git --no-pager diff --name-only HEAD $(git merge-base HEAD master) --exit-code CHANGELOG.md
|
||||||
|
displayName: Changelog Updated
|
||||||
|
|
||||||
|
- job: lint
|
||||||
|
pool:
|
||||||
|
vmImage: "macos-10.14"
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
submodules: true
|
||||||
|
- template: .azure/install-rust.yml
|
||||||
|
- script: |
|
||||||
|
rustup component add rustfmt
|
||||||
|
rustup component add clippy || cargo install --git https://github.com/rust-lang/rust-clippy/ --force clippy
|
||||||
|
displayName: Lint dependencies
|
||||||
|
- script: cargo fmt --all -- --check
|
||||||
|
displayName: Lint
|
||||||
|
variables:
|
||||||
|
rust_toolchain: stable
|
||||||
|
|
||||||
|
- job: Test
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
linux:
|
||||||
|
imageName: "ubuntu-16.04"
|
||||||
|
rust_toolchain: nightly-2019-06-10
|
||||||
|
mac:
|
||||||
|
imageName: "macos-10.14"
|
||||||
|
rust_toolchain: nightly-2019-06-10
|
||||||
|
windows:
|
||||||
|
imageName: "vs2017-win2016"
|
||||||
|
rust_toolchain: stable
|
||||||
|
pool:
|
||||||
|
vmImage: $(imageName)
|
||||||
|
condition: in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/heads/staging', 'refs/heads/trying')
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
submodules: true
|
||||||
|
- template: .azure/install-rust.yml
|
||||||
|
- template: .azure/install-sccache.yml
|
||||||
|
- template: .azure/install-cmake.yml
|
||||||
|
- template: .azure/install-llvm.yml
|
||||||
|
- bash: make test
|
||||||
|
displayName: Tests (*nix)
|
||||||
|
condition: and(succeeded(), not(eq(variables['Agent.OS'], 'Windows_NT')))
|
||||||
|
- bash: make spectests-cranelift
|
||||||
|
displayName: Tests (Windows)
|
||||||
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
||||||
|
|
||||||
|
- job: Check
|
||||||
|
pool:
|
||||||
|
vmImage: "ubuntu-16.04"
|
||||||
|
variables:
|
||||||
|
rust_toolchain: nightly-2019-06-10
|
||||||
|
condition: in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/heads/staging', 'refs/heads/trying')
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
submodules: true
|
||||||
|
- template: .azure/install-rust.yml
|
||||||
|
- template: .azure/install-sccache.yml
|
||||||
|
- template: .azure/install-cmake.yml
|
||||||
|
- template: .azure/install-llvm.yml
|
||||||
|
- bash: make check
|
||||||
|
displayName: Check with Flags
|
||||||
|
condition: and(succeeded(), not(eq(variables['Agent.OS'], 'Windows_NT')))
|
||||||
|
|
||||||
|
- job: Build_CLI
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
linux:
|
||||||
|
imageName: "ubuntu-16.04"
|
||||||
|
rust_toolchain: nightly-2019-06-10
|
||||||
|
mac:
|
||||||
|
imageName: "macos-10.14"
|
||||||
|
rust_toolchain: nightly-2019-06-10
|
||||||
|
MACOSX_DEPLOYMENT_TARGET: 10.10
|
||||||
|
windows:
|
||||||
|
imageName: "vs2017-win2016"
|
||||||
|
rust_toolchain: stable
|
||||||
|
# RUSTFLAGS: -Ctarget-feature=+crt-static
|
||||||
|
pool:
|
||||||
|
vmImage: $(imageName)
|
||||||
|
condition: in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/heads/staging', 'refs/heads/trying')
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
submodules: true
|
||||||
|
- template: .azure/install-rust.yml
|
||||||
|
- template: .azure/install-sccache.yml
|
||||||
|
- template: .azure/install-cmake.yml
|
||||||
|
- template: .azure/install-innosetup.yml
|
||||||
|
- template: .azure/install-llvm.yml
|
||||||
|
- bash: |
|
||||||
|
mkdir -p artifacts
|
||||||
|
displayName: Create Artifacts Dir
|
||||||
|
- bash: make release
|
||||||
|
displayName: Build (*nix)
|
||||||
|
condition: and(succeeded(), not(eq(variables['Agent.OS'], 'Windows_NT')))
|
||||||
|
- bash: make release-llvm
|
||||||
|
displayName: Build (Windows)
|
||||||
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
||||||
|
- bash: |
|
||||||
|
cargo build --release --manifest-path wapm-cli/Cargo.toml --features "telemetry update-notifications"
|
||||||
|
displayName: Build WAPM
|
||||||
|
condition: |
|
||||||
|
eq(variables['Build.SourceBranch'], 'refs/heads/master')
|
||||||
|
- bash: |
|
||||||
|
make build-install
|
||||||
|
cp ./wasmer.tar.gz ./artifacts/$(./scripts/binary-name.sh)
|
||||||
|
displayName: Build Distribution (*nix)
|
||||||
|
condition: |
|
||||||
|
and(
|
||||||
|
succeeded(),
|
||||||
|
not(eq(variables['Agent.OS'], 'Windows_NT'))
|
||||||
|
)
|
||||||
|
- bash: |
|
||||||
|
cd ./src/installer
|
||||||
|
iscc wasmer.iss
|
||||||
|
cp WasmerInstaller.exe ../../artifacts/wasmer-windows.exe
|
||||||
|
displayName: Build Distribution (Windows)
|
||||||
|
condition: |
|
||||||
|
and(
|
||||||
|
succeeded(),
|
||||||
|
eq(variables['Build.SourceBranch'], 'refs/heads/master'),
|
||||||
|
eq(variables['Agent.OS'], 'Windows_NT')
|
||||||
|
)
|
||||||
|
- publish: $(System.DefaultWorkingDirectory)/artifacts
|
||||||
|
artifact: cli-$(Agent.OS)
|
||||||
|
|
||||||
|
- job: Build_Library
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
linux:
|
||||||
|
imageName: "ubuntu-16.04"
|
||||||
|
rust_toolchain: nightly-2019-06-10
|
||||||
|
mac:
|
||||||
|
imageName: "macos-10.14"
|
||||||
|
rust_toolchain: nightly-2019-06-10
|
||||||
|
MACOSX_DEPLOYMENT_TARGET: 10.10
|
||||||
|
windows:
|
||||||
|
imageName: "vs2017-win2016"
|
||||||
|
rust_toolchain: stable
|
||||||
|
# RUSTFLAGS: -Ctarget-feature=+crt-static
|
||||||
|
pool:
|
||||||
|
vmImage: $(imageName)
|
||||||
|
condition: in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/heads/staging', 'refs/heads/trying')
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
submodules: true
|
||||||
|
- template: .azure/install-rust.yml
|
||||||
|
- template: .azure/install-sccache.yml
|
||||||
|
- template: .azure/install-cmake.yml
|
||||||
|
# - template: .azure/install-llvm.yml
|
||||||
|
- bash: |
|
||||||
|
mkdir -p artifacts
|
||||||
|
displayName: Create Artifacts Dir
|
||||||
|
- bash: |
|
||||||
|
make capi
|
||||||
|
cp target/release/libwasmer_runtime_c_api.so ./artifacts
|
||||||
|
displayName: Build c-api (Linux)
|
||||||
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
|
||||||
|
- bash: |
|
||||||
|
make capi
|
||||||
|
install_name_tool -id "@rpath/libwasmer_runtime_c_api.dylib" target/release/libwasmer_runtime_c_api.dylib
|
||||||
|
cp target/release/libwasmer_runtime_c_api.dylib ./artifacts
|
||||||
|
displayName: Build c-api (Darwin)
|
||||||
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
|
||||||
|
- bash: |
|
||||||
|
cargo build --release
|
||||||
|
cargo build -p wasmer-runtime-c-api --release
|
||||||
|
cp target/release/wasmer_runtime_c_api.dll ./artifacts
|
||||||
|
displayName: Build c-api (Windows)
|
||||||
|
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
||||||
|
- publish: $(System.DefaultWorkingDirectory)/artifacts
|
||||||
|
artifact: library-$(Agent.OS)
|
||||||
|
|
||||||
|
- job: Publish
|
||||||
|
dependsOn:
|
||||||
|
- Build_CLI
|
||||||
|
- Build_Library
|
||||||
|
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
|
||||||
|
steps:
|
||||||
|
# - download: current
|
||||||
|
- task: DownloadPipelineArtifact@1
|
||||||
|
inputs:
|
||||||
|
targetPath: $(Build.ArtifactStagingDirectory)
|
||||||
|
- bash: |
|
||||||
|
ls $ARTIFACT_STAGING_DIRECTORY
|
||||||
|
displayName: List Artifacts
|
||||||
|
env:
|
||||||
|
ARTIFACT_STAGING_DIRECTORY: $(Build.ArtifactStagingDirectory)
|
||||||
|
- task: GithubRelease@0
|
||||||
|
displayName: "Create GitHub Release"
|
||||||
|
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
|
||||||
|
inputs:
|
||||||
|
gitHubConnection: wasmer
|
||||||
|
repositoryName: wasmerio/wasmer
|
||||||
|
tag: dev
|
||||||
|
assets: $(Build.ArtifactStagingDirectory)
|
||||||
|
|
||||||
|
# We only run the pipelines on PRs to Master
|
||||||
|
pr:
|
||||||
|
- master
|
||||||
|
|
||||||
|
# Otherwise, we test in any of this branches (master or bors related)
|
||||||
|
trigger:
|
||||||
|
- master
|
||||||
|
- staging
|
||||||
|
- trying
|
@ -1,10 +1,5 @@
|
|||||||
status = [
|
status = [
|
||||||
"ci/circleci: lint",
|
"wasmerio.wasmer"
|
||||||
"ci/circleci: test",
|
|
||||||
"ci/circleci: test-macos",
|
|
||||||
"ci/circleci: test-stable",
|
|
||||||
"ci/circleci: test-rust-example",
|
|
||||||
"continuous-integration/appveyor/branch"
|
|
||||||
]
|
]
|
||||||
required_approvals = 1
|
required_approvals = 1
|
||||||
timeout_sec = 7200
|
timeout_sec = 7200
|
||||||
|
1
docs/assets/languages/c.svg
Executable file
@ -0,0 +1 @@
|
|||||||
|
<svg width="20" height="22" id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 22"><defs><style>.cls-1{fill:#7f8b99;}.cls-2{fill:#a9b9cb;}.cls-3{fill:#fff;}</style></defs><title>c-logo-colored</title><path class="cls-1" d="M1,17.22l2.19,1.24L16.79,3.54,11,.26a2,2,0,0,0-2,0L1,4.78A2,2,0,0,0,0,6.52v9A2,2,0,0,0,1,17.22Z"/><path class="cls-2" d="M19,4.78,16.79,3.54,3.21,18.46,9,21.74a2,2,0,0,0,2,0l8-4.52a2,2,0,0,0,1-1.74v-9A2,2,0,0,0,19,4.78Z"/><path class="cls-3" d="M12.07,9.58l3.11,0A4.84,4.84,0,0,0,10.1,5.25,5.42,5.42,0,0,0,4.48,11a5.31,5.31,0,0,0,5.62,5.66c4,0,4.94-2.86,4.94-4.38h-3a1.73,1.73,0,0,1-2,1.75c-1.91,0-2.22-2.27-2.22-3,0-1.18.42-3,2.22-3A1.86,1.86,0,0,1,12.07,9.58Z"/></svg>
|
After Width: | Height: | Size: 726 B |
1
docs/assets/languages/cpp.svg
Executable file
@ -0,0 +1 @@
|
|||||||
|
<svg width="20" height="22" id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 22"><defs><style>.cls-1{fill:#659ad2;}.cls-2{fill:#0e4580;}.cls-3{fill:#035a9d;}.cls-4{fill:#fff;}</style></defs><title>c++-logo-colored</title><path class="cls-1" d="M19.72,5.5A2,2,0,0,0,19,4.77L11,.25a2,2,0,0,0-2,0L1,4.77A2,2,0,0,0,0,6.52v9a2,2,0,0,0,.28,1Z"/><path class="cls-2" d="M.28,16.5a2,2,0,0,0,.74.73l8,4.52a2,2,0,0,0,2,0l8-4.52a2,2,0,0,0,.74-.73L10,11Z"/><path class="cls-3" d="M20,6.52a2,2,0,0,0-.28-1L10,11l9.72,5.5a2,2,0,0,0,.28-1Z"/><path class="cls-4" d="M16.67,10.69h-.74V10h-.75v.73h-.74v.73h.74v.72h.75v-.72h.74Z"/><path class="cls-4" d="M19.44,10.69H18.7V10H18v.73h-.74v.73H18v.72h.74v-.72h.74Z"/><path class="cls-4" d="M12.86,12.62a3.3,3.3,0,1,1,0-3.24l2.8-1.58a6.5,6.5,0,1,0,0,6.4Z"/></svg>
|
After Width: | Height: | Size: 825 B |
1
docs/assets/languages/csharp.svg
Executable file
@ -0,0 +1 @@
|
|||||||
|
<svg width="20" height="20" id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><defs><style>.cls-1{fill:#0c9438;}.cls-2{fill:#219e38;opacity:0.85;}.cls-3{opacity:0.1;isolation:isolate;}.cls-4{fill:#fff;}</style></defs><title>csharp-logo-colored</title><path class="cls-1" d="M17.07,2.93a10,10,0,0,0-14.14,0L17.07,17.07A10,10,0,0,0,17.07,2.93Z"/><path class="cls-2" d="M2.93,2.93A10,10,0,0,0,17.07,17.07Z"/><path class="cls-3" d="M1,10.23a.76.76,0,0,1,0-.15c0,.15,0,.3,0,.45Z"/><path class="cls-4" d="M9.51,13.64a4.6,4.6,0,0,1-2.19.46,3.46,3.46,0,0,1-1.46-.25A3.66,3.66,0,0,1,4.63,13a4.05,4.05,0,0,1-1-2.84,4.34,4.34,0,0,1,.26-1.64,4.2,4.2,0,0,1,.88-1.41,4,4,0,0,1,1.32-.94A3.81,3.81,0,0,1,7.65,6a4.42,4.42,0,0,1,1.84.25v1A3.72,3.72,0,0,0,7.64,6.8,2.9,2.9,0,0,0,6.44,7a2.81,2.81,0,0,0-1,.69,3.4,3.4,0,0,0-.85,2.42,3.24,3.24,0,0,0,.79,2.29,2.68,2.68,0,0,0,.94.66,2.9,2.9,0,0,0,1.13.2,4,4,0,0,0,2.05-.53Z"/><path class="cls-4" d="M16.49,8.3l-.13.58H14.93l-.35,1.65h1.55l-.15.58H14.47L14,13.3h-.69l.47-2.19H12.39l-.46,2.19h-.68l.46-2.19H10.26l.11-.58h1.46l.33-1.65H10.64l.12-.58h1.52l.46-2.21h.69L13,8.3l1.38,0,.47-2.17h.66L15.05,8.3Zm-2.24.58H12.86l-.36,1.65h1.4Z"/></svg>
|
After Width: | Height: | Size: 1.2 KiB |
1
docs/assets/languages/go.svg
Executable file
@ -0,0 +1 @@
|
|||||||
|
<svg width="32" height="12" id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 12"><defs><style>.cls-1{fill:#38b6ac;}</style></defs><title>go-logo-colored</title><path class="cls-1" d="M2.4,3.62s-.07,0,0-.09l.33-.42A.25.25,0,0,1,2.86,3H8.43c.05,0,.08,0,0,.09l-.25.4a.24.24,0,0,1-.17.09Z"/><path class="cls-1" d="M.06,5.06C0,5.06,0,5,0,5l.32-.42a.3.3,0,0,1,.17-.08H7.62a.08.08,0,0,1,.08.1L7.57,5a.15.15,0,0,1-.14.1Z"/><path class="cls-1" d="M3.84,6.49c-.06,0-.09,0-.06-.09L4,6a.2.2,0,0,1,.16-.09H7.28A.09.09,0,0,1,7.37,6l0,.37a.13.13,0,0,1-.12.11Z"/><path class="cls-1" d="M31.94,4.55a4.86,4.86,0,0,0-2.2-3.49A5.72,5.72,0,0,0,25.31.25,6.56,6.56,0,0,0,21,2.87a6.74,6.74,0,0,0-1.08,2.05h-5a.43.43,0,0,0-.38.25c-.22.41-.6,1.24-.8,1.71-.11.27,0,.47.29.47h3c-.16.22-.28.41-.43.58a2.88,2.88,0,0,1-2.65,1A2.45,2.45,0,0,1,11.8,6.49a3.36,3.36,0,0,1,1.6-3,2.69,2.69,0,0,1,2.81-.23,2,2,0,0,1,.73.6c.2.23.22.21.45.15,1-.25,1.64-.45,2.62-.69.18,0,.24-.12.18-.25A5,5,0,0,0,18.39.87,5.48,5.48,0,0,0,14.26.11,6.88,6.88,0,0,0,9.9,2.82,6.12,6.12,0,0,0,8.58,7.41a4.93,4.93,0,0,0,2,3.47,5.49,5.49,0,0,0,4.18,1,6.45,6.45,0,0,0,4.44-2.66,6.88,6.88,0,0,0,.64-1.07,5,5,0,0,0,1.54,2.43A5.77,5.77,0,0,0,25.16,12c.41-.05.78-.06,1.19-.14a7.21,7.21,0,0,0,3.79-2A6.07,6.07,0,0,0,31.94,4.55Zm-5,4.1a2.83,2.83,0,0,1-2.55.09,2.58,2.58,0,0,1-1.42-2.95,3.37,3.37,0,0,1,2.72-2.73,2.58,2.58,0,0,1,3.18,2.09c0,.16,0,.32.05.52A3.44,3.44,0,0,1,26.9,8.65Z"/></svg>
|
After Width: | Height: | Size: 1.4 KiB |
1
docs/assets/languages/php.svg
Executable file
@ -0,0 +1 @@
|
|||||||
|
<svg width="27" height="14" id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 27 14"><title>php-logo</title><path d="M2.14,2.94h4A3.05,3.05,0,0,1,8.69,4a3.59,3.59,0,0,1,.53,2.82,5.59,5.59,0,0,1-.47,1.61,4.6,4.6,0,0,1-1,1.42,3.31,3.31,0,0,1-1.6,1,6.9,6.9,0,0,1-1.76.22H2.64L2.08,14H0ZM3.88,4.7,3,9.33h.39a7.55,7.55,0,0,0,2.39-.29c.63-.22,1.06-1,1.28-2.25.18-1.08,0-1.7-.54-1.87a6.6,6.6,0,0,0-2-.23l-.35,0H3.87Z"/><path d="M11.59,0h2.06l-.59,2.94h1.86a3.72,3.72,0,0,1,2.27.65c.51.41.66,1.19.45,2.35l-1,5.13h-2.1l1-4.9a1.44,1.44,0,0,0-.09-1.1,1.26,1.26,0,0,0-1-.32l-1.66,0L11.5,11.07H9.43Z"/><path d="M19.85,2.94h4A3.08,3.08,0,0,1,26.41,4a3.59,3.59,0,0,1,.52,2.82,5.56,5.56,0,0,1-.46,1.61,4.81,4.81,0,0,1-1,1.42,3.31,3.31,0,0,1-1.6,1,6.79,6.79,0,0,1-1.76.22H20.36L19.79,14H17.71ZM21.6,4.7l-.9,4.63h.39a7.51,7.51,0,0,0,2.39-.29q1-.33,1.29-2.25c.17-1.08,0-1.7-.54-1.87a6.67,6.67,0,0,0-2-.23l-.34,0h-.32Z"/></svg>
|
After Width: | Height: | Size: 938 B |
22
docs/assets/languages/postgres.svg
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||||
|
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
|
||||||
|
<svg width="21px" height="22px" viewBox="0 0 432.071 445.383" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g id="orginal" style="fill-rule:nonzero;clip-rule:nonzero;stroke:#000000;stroke-miterlimit:4;">
|
||||||
|
</g>
|
||||||
|
<g id="Layer_x0020_3" style="fill-rule:nonzero;clip-rule:nonzero;fill:none;stroke:#FFFFFF;stroke-width:12.4651;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;">
|
||||||
|
<path style="fill:#000000;stroke:#000000;stroke-width:37.3953;stroke-linecap:butt;stroke-linejoin:miter;" d="M323.205,324.227c2.833-23.601,1.984-27.062,19.563-23.239l4.463,0.392c13.517,0.615,31.199-2.174,41.587-7c22.362-10.376,35.622-27.7,13.572-23.148c-50.297,10.376-53.755-6.655-53.755-6.655c53.111-78.803,75.313-178.836,56.149-203.322 C352.514-5.534,262.036,26.049,260.522,26.869l-0.482,0.089c-9.938-2.062-21.06-3.294-33.554-3.496c-22.761-0.374-40.032,5.967-53.133,15.904c0,0-161.408-66.498-153.899,83.628c1.597,31.936,45.777,241.655,98.47,178.31 c19.259-23.163,37.871-42.748,37.871-42.748c9.242,6.14,20.307,9.272,31.912,8.147l0.897-0.765c-0.281,2.876-0.157,5.689,0.359,9.019c-13.572,15.167-9.584,17.83-36.723,23.416c-27.457,5.659-11.326,15.734-0.797,18.367c12.768,3.193,42.305,7.716,62.268-20.224 l-0.795,3.188c5.325,4.26,4.965,30.619,5.72,49.452c0.756,18.834,2.017,36.409,5.856,46.771c3.839,10.36,8.369,37.05,44.036,29.406c29.809-6.388,52.6-15.582,54.677-101.107"/>
|
||||||
|
<path style="fill:#336791;stroke:none;" d="M402.395,271.23c-50.302,10.376-53.76-6.655-53.76-6.655c53.111-78.808,75.313-178.843,56.153-203.326c-52.27-66.785-142.752-35.2-144.262-34.38l-0.486,0.087c-9.938-2.063-21.06-3.292-33.56-3.496c-22.761-0.373-40.026,5.967-53.127,15.902 c0,0-161.411-66.495-153.904,83.63c1.597,31.938,45.776,241.657,98.471,178.312c19.26-23.163,37.869-42.748,37.869-42.748c9.243,6.14,20.308,9.272,31.908,8.147l0.901-0.765c-0.28,2.876-0.152,5.689,0.361,9.019c-13.575,15.167-9.586,17.83-36.723,23.416 c-27.459,5.659-11.328,15.734-0.796,18.367c12.768,3.193,42.307,7.716,62.266-20.224l-0.796,3.188c5.319,4.26,9.054,27.711,8.428,48.969c-0.626,21.259-1.044,35.854,3.147,47.254c4.191,11.4,8.368,37.05,44.042,29.406c29.809-6.388,45.256-22.942,47.405-50.555 c1.525-19.631,4.976-16.729,5.194-34.28l2.768-8.309c3.192-26.611,0.507-35.196,18.872-31.203l4.463,0.392c13.517,0.615,31.208-2.174,41.591-7c22.358-10.376,35.618-27.7,13.573-23.148z"/>
|
||||||
|
<path d="M215.866,286.484c-1.385,49.516,0.348,99.377,5.193,111.495c4.848,12.118,15.223,35.688,50.9,28.045c29.806-6.39,40.651-18.756,45.357-46.051c3.466-20.082,10.148-75.854,11.005-87.281"/>
|
||||||
|
<path d="M173.104,38.256c0,0-161.521-66.016-154.012,84.109c1.597,31.938,45.779,241.664,98.473,178.316c19.256-23.166,36.671-41.335,36.671-41.335"/>
|
||||||
|
<path d="M260.349,26.207c-5.591,1.753,89.848-34.889,144.087,34.417c19.159,24.484-3.043,124.519-56.153,203.329"/>
|
||||||
|
<path style="stroke-linejoin:bevel;" d="M348.282,263.953c0,0,3.461,17.036,53.764,6.653c22.04-4.552,8.776,12.774-13.577,23.155c-18.345,8.514-59.474,10.696-60.146-1.069c-1.729-30.355,21.647-21.133,19.96-28.739c-1.525-6.85-11.979-13.573-18.894-30.338 c-6.037-14.633-82.796-126.849,21.287-110.183c3.813-0.789-27.146-99.002-124.553-100.599c-97.385-1.597-94.19,119.762-94.19,119.762"/>
|
||||||
|
<path d="M188.604,274.334c-13.577,15.166-9.584,17.829-36.723,23.417c-27.459,5.66-11.326,15.733-0.797,18.365c12.768,3.195,42.307,7.718,62.266-20.229c6.078-8.509-0.036-22.086-8.385-25.547c-4.034-1.671-9.428-3.765-16.361,3.994z"/>
|
||||||
|
<path d="M187.715,274.069c-1.368-8.917,2.93-19.528,7.536-31.942c6.922-18.626,22.893-37.255,10.117-96.339c-9.523-44.029-73.396-9.163-73.436-3.193c-0.039,5.968,2.889,30.26-1.067,58.548c-5.162,36.913,23.488,68.132,56.479,64.938"/>
|
||||||
|
<path style="fill:#FFFFFF;stroke-width:4.155;stroke-linecap:butt;stroke-linejoin:miter;" d="M172.517,141.7c-0.288,2.039,3.733,7.48,8.976,8.207c5.234,0.73,9.714-3.522,9.998-5.559c0.284-2.039-3.732-4.285-8.977-5.015c-5.237-0.731-9.719,0.333-9.996,2.367z"/>
|
||||||
|
<path style="fill:#FFFFFF;stroke-width:2.0775;stroke-linecap:butt;stroke-linejoin:miter;" d="M331.941,137.543c0.284,2.039-3.732,7.48-8.976,8.207c-5.238,0.73-9.718-3.522-10.005-5.559c-0.277-2.039,3.74-4.285,8.979-5.015c5.239-0.73,9.718,0.333,10.002,2.368z"/>
|
||||||
|
<path d="M350.676,123.432c0.863,15.994-3.445,26.888-3.988,43.914c-0.804,24.748,11.799,53.074-7.191,81.435"/>
|
||||||
|
<path style="stroke-width:3;" d="M0,60.232"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 4.3 KiB |
1
docs/assets/languages/python.svg
Executable file
@ -0,0 +1 @@
|
|||||||
|
<svg width="20" height="20" id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><defs><style>.cls-1{fill:#387ab0;}.cls-2{fill:#feca3d;}</style></defs><title>python-logo-colored</title><path class="cls-1" d="M9.93,0C4.87,0,5.18,2.21,5.18,2.21V4.5H10v.7H3.25S0,4.82,0,10s2.84,5,2.84,5H4.53V12.56A2.71,2.71,0,0,1,7.32,9.7h4.79A2.58,2.58,0,0,0,14.8,7.08V2.67S15.23,0,9.93,0ZM7.26,1.53a.88.88,0,1,1-.87.88A.88.88,0,0,1,7.26,1.53Z"/><path class="cls-2" d="M10.07,20c5.06,0,4.75-2.21,4.75-2.21V15.5H10v-.7h6.76S20,15.18,20,10s-2.84-5-2.84-5H15.47V7.44a2.71,2.71,0,0,1-2.79,2.86H7.89A2.58,2.58,0,0,0,5.2,12.92v4.41S4.77,20,10.07,20Zm2.67-1.53a.88.88,0,1,1,.87-.88A.88.88,0,0,1,12.74,18.47Z"/></svg>
|
After Width: | Height: | Size: 726 B |
14
docs/assets/languages/r.svg
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<svg width="24" height="18" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid" viewBox="0 0 724 561">
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="gradientFill-1" x1="0" x2="1" y1="0" y2="1" gradientUnits="objectBoundingBox" spreadMethod="pad">
|
||||||
|
<stop offset="0" stop-color="rgb(203,206,208)" stop-opacity="1"/>
|
||||||
|
<stop offset="1" stop-color="rgb(132,131,139)" stop-opacity="1"/>
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id="gradientFill-2" x1="0" x2="1" y1="0" y2="1" gradientUnits="objectBoundingBox" spreadMethod="pad">
|
||||||
|
<stop offset="0" stop-color="rgb(39,109,195)" stop-opacity="1"/>
|
||||||
|
<stop offset="1" stop-color="rgb(22,92,170)" stop-opacity="1"/>
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<path d="M361.453,485.937 C162.329,485.937 0.906,377.828 0.906,244.469 C0.906,111.109 162.329,3.000 361.453,3.000 C560.578,3.000 722.000,111.109 722.000,244.469 C722.000,377.828 560.578,485.937 361.453,485.937 ZM416.641,97.406 C265.289,97.406 142.594,171.314 142.594,262.484 C142.594,353.654 265.289,427.562 416.641,427.562 C567.992,427.562 679.687,377.033 679.687,262.484 C679.687,147.971 567.992,97.406 416.641,97.406 Z" fill="url(#gradientFill-1)" fill-rule="evenodd"/>
|
||||||
|
<path d="M550.000,377.000 C550.000,377.000 571.822,383.585 584.500,390.000 C588.899,392.226 596.510,396.668 602.000,402.500 C607.378,408.212 610.000,414.000 610.000,414.000 L696.000,559.000 L557.000,559.062 L492.000,437.000 C492.000,437.000 478.690,414.131 470.500,407.500 C463.668,401.969 460.755,400.000 454.000,400.000 C449.298,400.000 420.974,400.000 420.974,400.000 L421.000,558.974 L298.000,559.026 L298.000,152.938 L545.000,152.938 C545.000,152.938 657.500,154.967 657.500,262.000 C657.500,369.033 550.000,377.000 550.000,377.000 ZM496.500,241.024 L422.037,240.976 L422.000,310.026 L496.500,310.002 C496.500,310.002 531.000,309.895 531.000,274.877 C531.000,239.155 496.500,241.024 496.500,241.024 Z" fill="url(#gradientFill-2)" fill-rule="evenodd"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.9 KiB |
1
docs/assets/languages/ruby.svg
Executable file
@ -0,0 +1 @@
|
|||||||
|
<svg width="20" height="20" id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><defs><style>.cls-1{fill:#b11917;}</style></defs><title>ruby-logo-colored</title><path class="cls-1" d="M2,12.84l-.42-1C1.21,11,.86,10.15.51,9.3a.08.08,0,0,1,0-.1C1.23,8,2,6.73,2.67,5.49a.61.61,0,0,1,.12-.16l3.9-3.65a.74.74,0,0,1,.21-.13L10.2.33a.11.11,0,0,1,.1,0l2.77,2s0,0,0,.09c-.47,1.48-.93,3-1.4,4.44a.41.41,0,0,1,0,.09L6.39,11.82l-.09,0L2,12.83Z"/><path class="cls-1" d="M5.12,19.94Q6,16.38,6.9,12.83l6.78,2.63-.07,0A22.89,22.89,0,0,1,11,17.58a14.7,14.7,0,0,1-4.29,2,13.17,13.17,0,0,1-1.54.33Z"/><path class="cls-1" d="M12.68,7.55l6.67-.15c-.08.19-.14.37-.22.55a18.59,18.59,0,0,1-2.54,4.3c-.54.7-1.11,1.35-1.69,2l0,0Z"/><path class="cls-1" d="M7.39,12.08l4.48-4.19,2.21,6.79Z"/><path class="cls-1" d="M15.29,15.19l0,0,.05-.05c.59-.64,1.17-1.29,1.71-2A21.07,21.07,0,0,0,19.43,9.4L19.64,9h0q-.37,4.79-.73,9.55"/><path class="cls-1" d="M19.73,6.08l-5.34-3.9,0,0L17.61.38a.06.06,0,0,1,.06,0,3.5,3.5,0,0,1,2,2A4.49,4.49,0,0,1,20,3.54a6.5,6.5,0,0,1-.12,1.92C19.81,5.66,19.77,5.86,19.73,6.08Z"/><path class="cls-1" d="M18.46,19.09,9,19.74a21.13,21.13,0,0,0,5.66-4l.42.38"/><path class="cls-1" d="M12.66,6.67c.4-1.27.8-2.53,1.19-3.8l5,3.65h0Z"/><path class="cls-1" d="M4.32,19.48c-.67-1.94-1.43-3.87-2.11-5.81L6,12.83c-.56,2.23-1.12,4.44-1.67,6.65Z"/><path class="cls-1" d="M1.64,14.4c.64,1.87,1.29,3.73,1.94,5.6l-.3,0A4.44,4.44,0,0,1,2,19.53,3.32,3.32,0,0,1,.54,18.1,4.57,4.57,0,0,1,.15,17a.19.19,0,0,1,0-.08l1.45-2.49Z"/><path class="cls-1" d="M11.33,0h5.15l0,0L13.67,1.58s-.06,0-.09,0L11.36,0Z"/><path class="cls-1" d="M0,15.47V10.35l0,.08c.39.94.79,1.89,1.18,2.84a.08.08,0,0,1,0,.1L0,15.42A.13.13,0,0,1,0,15.47Z"/></svg>
|
After Width: | Height: | Size: 1.7 KiB |
1
docs/assets/languages/rust.svg
Executable file
@ -0,0 +1 @@
|
|||||||
|
<svg width="22" height="22" id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 22"><title>rust-logo</title><path d="M21.85,10.73l-.92-.57,0-.27.79-.74a.34.34,0,0,0,.1-.3.33.33,0,0,0-.2-.23l-1-.38A2,2,0,0,0,20.49,8l.64-.88a.34.34,0,0,0,0-.31.31.31,0,0,0-.24-.19l-1.07-.18c0-.08-.08-.16-.13-.24l.45-1a.31.31,0,0,0-.3-.45l-1.08,0-.18-.21.25-1.06a.31.31,0,0,0-.38-.38l-1.06.25a1.73,1.73,0,0,0-.21-.17l0-1.09a.32.32,0,0,0-.14-.28.31.31,0,0,0-.31,0l-1,.45-.24-.13L15.4,1.08a.31.31,0,0,0-.19-.24.34.34,0,0,0-.31,0L14,1.51l-.26-.08-.38-1a.33.33,0,0,0-.23-.2.34.34,0,0,0-.3.1l-.74.79-.27,0L11.27.15a.32.32,0,0,0-.54,0l-.57.92-.27,0L9.15.31a.32.32,0,0,0-.53.1l-.38,1L8,1.51,7.1.87a.32.32,0,0,0-.5.21L6.42,2.15l-.24.13-1-.45a.31.31,0,0,0-.31,0,.32.32,0,0,0-.14.28l0,1.09-.21.17L3.52,3.14a.31.31,0,0,0-.38.38l.25,1.06-.17.21-1.09,0a.32.32,0,0,0-.28.14.31.31,0,0,0,0,.31l.45,1-.13.24L1.08,6.6a.31.31,0,0,0-.24.19.34.34,0,0,0,0,.31L1.51,8a2,2,0,0,0-.08.26l-1,.38a.33.33,0,0,0-.2.23.34.34,0,0,0,.1.3l.79.74,0,.27-.92.57a.32.32,0,0,0,0,.54l.92.57,0,.27-.79.74a.34.34,0,0,0-.1.3.33.33,0,0,0,.2.23l1,.38a2,2,0,0,0,.08.26l-.64.88a.34.34,0,0,0,0,.31.31.31,0,0,0,.24.19l1.07.18.13.24-.45,1a.31.31,0,0,0,0,.31.32.32,0,0,0,.28.14l1.09,0a1.73,1.73,0,0,0,.17.21l-.25,1.06a.31.31,0,0,0,.38.38l1.06-.25.21.17,0,1.09a.32.32,0,0,0,.14.28.31.31,0,0,0,.31,0l1-.45.24.13.18,1.07a.31.31,0,0,0,.19.24.34.34,0,0,0,.31,0L8,20.49l.26.08.38,1a.33.33,0,0,0,.23.2.34.34,0,0,0,.3-.1l.74-.79.27,0,.57.92a.32.32,0,0,0,.54,0l.57-.92.27,0,.74.79a.34.34,0,0,0,.3.1.33.33,0,0,0,.23-.2l.38-1,.26-.08.88.64a.34.34,0,0,0,.31,0,.31.31,0,0,0,.19-.24l.18-1.07.24-.13,1,.45a.31.31,0,0,0,.31,0,.32.32,0,0,0,.14-.28l0-1.09a1.73,1.73,0,0,0,.21-.17l1.06.25a.31.31,0,0,0,.38-.38l-.25-1.06.18-.21,1.08,0a.31.31,0,0,0,.3-.45l-.45-1c.05-.08.09-.16.13-.24l1.07-.18a.31.31,0,0,0,.24-.19.34.34,0,0,0,0-.31L20.49,14a2,2,0,0,0,.08-.26l1-.38a.33.33,0,0,0,.2-.23.34.34,0,0,0-.1-.3l-.79-.74,0-.27.92-.57a.32.32,0,0,0,0-.54Zm-6.18,7.66a.65.65,0,0,1,.27-1.28.66.66,0,0,1,.5.78A.64.64,0,0,1,15.67,18.39Zm-.32-2.12a.59.59,0,0,0-.7.46l-.33,1.53A8,8,0,0,1,11,19a8.16,8.16,0,0,1-3.39-.74L7.28,16.7a.58.58,0,0,0-.7-.46l-1.35.29a7.88,7.88,0,0,1-.7-.83H11.1c.08,0,.12,0,.12-.08V13.3c0-.07,0-.08-.12-.08H9.18V11.74h2.08a1.32,1.32,0,0,1,1.28,1.11c.08.33.26,1.38.38,1.72s.63,1.13,1.17,1.13h3.39a10.43,10.43,0,0,1-.74.88ZM6.26,18.36a.64.64,0,0,1-.77-.5.65.65,0,0,1,.5-.78.65.65,0,0,1,.27,1.28ZM3.77,8.25a.65.65,0,1,1-.86-.33A.64.64,0,0,1,3.77,8.25ZM3,10.07l1.41-.63a.59.59,0,0,0,.3-.79L4.42,8H5.56v5.14H3.26A8.54,8.54,0,0,1,3,10.07Zm6.18-.5V8.05h2.71c.14,0,1,.16,1,.8s-.65.72-1.18.72ZM19,10.93c0,.2,0,.4,0,.6H18.2c-.09,0-.12.05-.12.13V12c0,.89-.5,1.09-.94,1.14s-.89-.18-.95-.44a2.81,2.81,0,0,0-1.31-2.2,3,3,0,0,0,1.65-2.29,2.59,2.59,0,0,0-1.26-2.12,3.63,3.63,0,0,0-1.73-.57H5A8.07,8.07,0,0,1,9.51,3l1,1.06a.6.6,0,0,0,.85,0L12.48,3A8.07,8.07,0,0,1,18,6.94l-.77,1.74a.59.59,0,0,0,.3.79l1.48.66A7,7,0,0,1,19,10.93Zm-8.53-8.8a.66.66,0,0,1,.93,0,.65.65,0,0,1,0,.92.66.66,0,0,1-.93,0A.65.65,0,0,1,10.51,2.13Zm7.65,6.15A.65.65,0,0,1,19,8a.65.65,0,1,1-.86.33Z"/></svg>
|
After Width: | Height: | Size: 3.0 KiB |
10
docs/assets/languages/swift.svg
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg width="20px" height="18px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 36" version="1.1">
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="a" x2="50%" x1="50%" y2="100%">
|
||||||
|
<stop stop-color="#F88A36" offset="0"/>
|
||||||
|
<stop stop-color="#FD2020" offset="1"/>
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<path d="m29.885 33.047c-4.667 2.696-11.084 2.973-17.54 0.206-5.2273-2.224-9.5646-6.117-12.345-10.565 1.3346 1.112 2.8916 2.002 4.5598 2.78 6.6672 3.125 13.333 2.911 18.024 0.008-0.003-0.003-0.005-0.005-0.007-0.008-6.673-5.116-12.345-11.789-16.571-17.238-0.8901-0.8898-1.5574-2.002-2.2247-3.0029 5.1159 4.671 13.235 10.565 16.126 12.234-6.116-6.451-11.566-14.458-11.344-14.236 9.676 9.787 18.685 15.348 18.685 15.348 0.298 0.168 0.528 0.308 0.713 0.433 0.195-0.496 0.366-1.011 0.51-1.545 1.557-5.672-0.222-12.123-4.115-17.461 9.008 5.4495 14.347 15.681 12.122 24.245-0.058 0.231-0.121 0.459-0.189 0.683 0.026 0.031 0.052 0.063 0.078 0.096 4.448 5.561 3.225 11.455 2.669 10.343-2.413-4.722-6.88-3.278-9.151-2.32z" fill="url(#a)"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.0 KiB |
16
install.sh
@ -71,14 +71,14 @@ wasmer_download_file() {
|
|||||||
|
|
||||||
# echo "Fetching $url.."
|
# echo "Fetching $url.."
|
||||||
if test -x "$(command -v curl)"; then
|
if test -x "$(command -v curl)"; then
|
||||||
if [ "$WASMER_INSTALL_LOG" == "$WASMER_VERBOSE" ]; then
|
if [ "$WASMER_INSTALL_LOG" = "$WASMER_VERBOSE" ]; then
|
||||||
code=$(curl --progress-bar -w '%{http_code}' -L "$url" -o "$destination")
|
code=$(curl --progress-bar -w '%{http_code}' -L "$url" -o "$destination")
|
||||||
printf "\033[K\n\033[1A"
|
printf "\033[K\n\033[1A"
|
||||||
else
|
else
|
||||||
code=$(curl -s -w '%{http_code}' -L "$url" -o "$destination")
|
code=$(curl -s -w '%{http_code}' -L "$url" -o "$destination")
|
||||||
fi
|
fi
|
||||||
elif test -x "$(command -v wget)"; then
|
elif test -x "$(command -v wget)"; then
|
||||||
if [ "$WASMER_INSTALL_LOG" == "$WASMER_VERBOSE" ]; then
|
if [ "$WASMER_INSTALL_LOG" = "$WASMER_VERBOSE" ]; then
|
||||||
code=$(wget --show-progress --progress=bar:force:noscroll -q -O "$destination" --server-response "$url" 2>&1 | awk '/^ HTTP/{print $2}' | tail -1)
|
code=$(wget --show-progress --progress=bar:force:noscroll -q -O "$destination" --server-response "$url" 2>&1 | awk '/^ HTTP/{print $2}' | tail -1)
|
||||||
printf "\033[K\n\033[1A";
|
printf "\033[K\n\033[1A";
|
||||||
else
|
else
|
||||||
@ -89,7 +89,7 @@ wasmer_download_file() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$code" == 404 ]; then
|
if [ "$code" = 404 ]; then
|
||||||
printf "$red> Your architecture is not yet supported ($OS-$ARCH).$reset\n"
|
printf "$red> Your architecture is not yet supported ($OS-$ARCH).$reset\n"
|
||||||
echo "> Please open an issue on the project if you would like to use wasmer in your project: https://github.com/wasmerio/wasmer"
|
echo "> Please open an issue on the project if you would like to use wasmer in your project: https://github.com/wasmerio/wasmer"
|
||||||
exit 1
|
exit 1
|
||||||
@ -160,14 +160,14 @@ wasmer_link() {
|
|||||||
command printf "${SOURCE_STR}"
|
command printf "${SOURCE_STR}"
|
||||||
else
|
else
|
||||||
if ! grep -q 'wasmer.sh' "$WASMER_PROFILE"; then
|
if ! grep -q 'wasmer.sh' "$WASMER_PROFILE"; then
|
||||||
# if [[ $WASMER_PROFILE == *"fish"* ]]; then
|
# if [[ $WASMER_PROFILE = *"fish"* ]]; then
|
||||||
# command fish -c 'set -U fish_user_paths $fish_user_paths ~/.wasmer/bin'
|
# command fish -c 'set -U fish_user_paths $fish_user_paths ~/.wasmer/bin'
|
||||||
# else
|
# else
|
||||||
command printf "$LOAD_STR" >> "$WASMER_PROFILE"
|
command printf "$LOAD_STR" >> "$WASMER_PROFILE"
|
||||||
# fi
|
# fi
|
||||||
fi
|
fi
|
||||||
printf "\033[1A$cyan> Adding to bash profile... ✓$reset\n"
|
printf "\033[1A$cyan> Adding to bash profile... ✓$reset\n"
|
||||||
if [ "$WASMER_INSTALL_LOG" == "$WASMER_VERBOSE" ]; then
|
if [ "$WASMER_INSTALL_LOG" = "$WASMER_VERBOSE" ]; then
|
||||||
printf "${dim}Note: We've added the following to your $WASMER_PROFILE\n"
|
printf "${dim}Note: We've added the following to your $WASMER_PROFILE\n"
|
||||||
echo "If you have a different profile please add the following:"
|
echo "If you have a different profile please add the following:"
|
||||||
printf "$LOAD_STR$reset\n"
|
printf "$LOAD_STR$reset\n"
|
||||||
@ -179,7 +179,7 @@ wasmer_link() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
printf "$green> Successfully installed $version!\n"
|
printf "$green> Successfully installed $version!\n"
|
||||||
if [ "$WASMER_INSTALL_LOG" == "$WASMER_VERBOSE" ]; then
|
if [ "$WASMER_INSTALL_LOG" = "$WASMER_VERBOSE" ]; then
|
||||||
printf "${reset}${dim}wasmer & wapm will be available the next time you open the terminal.\n"
|
printf "${reset}${dim}wasmer & wapm will be available the next time you open the terminal.\n"
|
||||||
printf "${reset}${dim}If you want to have the commands available now please execute:\n${reset}source $INSTALL_DIRECTORY/wasmer.sh$reset\n"
|
printf "${reset}${dim}If you want to have the commands available now please execute:\n${reset}source $INSTALL_DIRECTORY/wasmer.sh$reset\n"
|
||||||
fi
|
fi
|
||||||
@ -255,7 +255,7 @@ wasmer_install() {
|
|||||||
printf "${reset}Updating Wasmer and WAPM$reset\n"
|
printf "${reset}Updating Wasmer and WAPM$reset\n"
|
||||||
else
|
else
|
||||||
printf "${reset}Installing Wasmer and WAPM!$reset\n"
|
printf "${reset}Installing Wasmer and WAPM!$reset\n"
|
||||||
if [ "$WASMER_INSTALL_LOG" == "$WASMER_VERBOSE" ]; then
|
if [ "$WASMER_INSTALL_LOG" = "$WASMER_VERBOSE" ]; then
|
||||||
printf "
|
printf "
|
||||||
${magenta1} ww
|
${magenta1} ww
|
||||||
${magenta1} wwwww
|
${magenta1} wwwww
|
||||||
@ -328,7 +328,7 @@ wasmer_reset() {
|
|||||||
# Example taken from
|
# Example taken from
|
||||||
# https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash
|
# https://stackoverflow.com/questions/4023830/how-to-compare-two-strings-in-dot-separated-version-format-in-bash
|
||||||
# wasmer_compareversions () {
|
# wasmer_compareversions () {
|
||||||
# if [[ $1 == $2 ]]
|
# if [[ $1 = $2 ]]
|
||||||
# then
|
# then
|
||||||
# echo "="
|
# echo "="
|
||||||
# return 0
|
# return 0
|
||||||
|
@ -6,6 +6,7 @@ license = "MIT"
|
|||||||
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
|
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
repository = "https://github.com/wasmerio/wasmer"
|
repository = "https://github.com/wasmerio/wasmer"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2.60"
|
libc = "0.2.60"
|
||||||
|
28
lib/middleware-common-tests/Cargo.toml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
[package]
|
||||||
|
name = "wasmer-middleware-common-tests"
|
||||||
|
version = "0.6.0"
|
||||||
|
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
|
||||||
|
edition = "2018"
|
||||||
|
repository = "https://github.com/wasmerio/wasmer"
|
||||||
|
license = "MIT"
|
||||||
|
publish = false
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
wasmer-runtime-core = { path = "../runtime-core", version = "0.6.0" }
|
||||||
|
wasmer-middleware-common = { path = "../middleware-common", version = "0.6.0" }
|
||||||
|
wasmer-clif-backend = { path = "../clif-backend", version = "0.6.0" }
|
||||||
|
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.6.0", optional = true }
|
||||||
|
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.6.0", optional = true }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
clif = []
|
||||||
|
llvm = ["wasmer-llvm-backend"]
|
||||||
|
singlepass = ["wasmer-singlepass-backend"]
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
wabt = "0.9.1"
|
||||||
|
criterion = "0.2"
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "metering_benchmark"
|
||||||
|
harness = false
|
152
lib/middleware-common-tests/src/lib.rs
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
#[cfg(all(test, any(feature = "singlepass", feature = "llvm")))]
|
||||||
|
mod tests {
|
||||||
|
use wabt::wat2wasm;
|
||||||
|
|
||||||
|
use wasmer_middleware_common::metering::*;
|
||||||
|
use wasmer_runtime_core::codegen::{MiddlewareChain, StreamingCompiler};
|
||||||
|
use wasmer_runtime_core::{backend::Compiler, compile_with, imports, Func};
|
||||||
|
|
||||||
|
#[cfg(feature = "llvm")]
|
||||||
|
fn get_compiler(limit: u64) -> impl Compiler {
|
||||||
|
use wasmer_llvm_backend::ModuleCodeGenerator as LLVMMCG;
|
||||||
|
let c: StreamingCompiler<LLVMMCG, _, _, _, _> = StreamingCompiler::new(move || {
|
||||||
|
let mut chain = MiddlewareChain::new();
|
||||||
|
chain.push(Metering::new(limit));
|
||||||
|
chain
|
||||||
|
});
|
||||||
|
c
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "singlepass")]
|
||||||
|
fn get_compiler(limit: u64) -> impl Compiler {
|
||||||
|
use wasmer_singlepass_backend::ModuleCodeGenerator as SinglePassMCG;
|
||||||
|
let c: StreamingCompiler<SinglePassMCG, _, _, _, _> = StreamingCompiler::new(move || {
|
||||||
|
let mut chain = MiddlewareChain::new();
|
||||||
|
chain.push(Metering::new(limit));
|
||||||
|
chain
|
||||||
|
});
|
||||||
|
c
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(any(feature = "llvm", feature = "clif", feature = "singlepass")))]
|
||||||
|
compile_error!("compiler not specified, activate a compiler via features");
|
||||||
|
|
||||||
|
#[cfg(feature = "clif")]
|
||||||
|
fn get_compiler(_limit: u64) -> impl Compiler {
|
||||||
|
compile_error!("cranelift does not implement metering");
|
||||||
|
use wasmer_clif_backend::CraneliftCompiler;
|
||||||
|
CraneliftCompiler::new()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assemblyscript
|
||||||
|
// export function add_to(x: i32, y: i32): i32 {
|
||||||
|
// for(var i = 0; i < x; i++){
|
||||||
|
// if(i % 1 == 0){
|
||||||
|
// y += i;
|
||||||
|
// } else {
|
||||||
|
// y *= i
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return y;
|
||||||
|
// }
|
||||||
|
static WAT: &'static str = r#"
|
||||||
|
(module
|
||||||
|
(type $t0 (func (param i32 i32) (result i32)))
|
||||||
|
(type $t1 (func))
|
||||||
|
(func $add_to (export "add_to") (type $t0) (param $p0 i32) (param $p1 i32) (result i32)
|
||||||
|
(local $l0 i32)
|
||||||
|
block $B0
|
||||||
|
i32.const 0
|
||||||
|
set_local $l0
|
||||||
|
loop $L1
|
||||||
|
get_local $l0
|
||||||
|
get_local $p0
|
||||||
|
i32.lt_s
|
||||||
|
i32.eqz
|
||||||
|
br_if $B0
|
||||||
|
get_local $l0
|
||||||
|
i32.const 1
|
||||||
|
i32.rem_s
|
||||||
|
i32.const 0
|
||||||
|
i32.eq
|
||||||
|
if $I2
|
||||||
|
get_local $p1
|
||||||
|
get_local $l0
|
||||||
|
i32.add
|
||||||
|
set_local $p1
|
||||||
|
else
|
||||||
|
get_local $p1
|
||||||
|
get_local $l0
|
||||||
|
i32.mul
|
||||||
|
set_local $p1
|
||||||
|
end
|
||||||
|
get_local $l0
|
||||||
|
i32.const 1
|
||||||
|
i32.add
|
||||||
|
set_local $l0
|
||||||
|
br $L1
|
||||||
|
unreachable
|
||||||
|
end
|
||||||
|
unreachable
|
||||||
|
end
|
||||||
|
get_local $p1)
|
||||||
|
(func $f1 (type $t1))
|
||||||
|
(table $table (export "table") 1 anyfunc)
|
||||||
|
(memory $memory (export "memory") 0)
|
||||||
|
(global $g0 i32 (i32.const 8))
|
||||||
|
(elem (i32.const 0) $f1))
|
||||||
|
"#;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_points_reduced_after_call() {
|
||||||
|
let wasm_binary = wat2wasm(WAT).unwrap();
|
||||||
|
|
||||||
|
let limit = 100u64;
|
||||||
|
|
||||||
|
let module = compile_with(&wasm_binary, &get_compiler(limit)).unwrap();
|
||||||
|
|
||||||
|
let import_object = imports! {};
|
||||||
|
let mut instance = module.instantiate(&import_object).unwrap();
|
||||||
|
|
||||||
|
set_points_used(&mut instance, 0u64);
|
||||||
|
|
||||||
|
let add_to: Func<(i32, i32), i32> = instance.func("add_to").unwrap();
|
||||||
|
let value = add_to.call(3, 4).unwrap();
|
||||||
|
|
||||||
|
// verify it returns the correct value
|
||||||
|
assert_eq!(value, 7);
|
||||||
|
|
||||||
|
// verify it used the correct number of points
|
||||||
|
assert_eq!(get_points_used(&instance), 74);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_traps_after_costly_call() {
|
||||||
|
use wasmer_runtime_core::error::RuntimeError;
|
||||||
|
let wasm_binary = wat2wasm(WAT).unwrap();
|
||||||
|
|
||||||
|
let limit = 100u64;
|
||||||
|
|
||||||
|
let module = compile_with(&wasm_binary, &get_compiler(limit)).unwrap();
|
||||||
|
|
||||||
|
let import_object = imports! {};
|
||||||
|
let mut instance = module.instantiate(&import_object).unwrap();
|
||||||
|
|
||||||
|
set_points_used(&mut instance, 0u64);
|
||||||
|
|
||||||
|
let add_to: Func<(i32, i32), i32> = instance.func("add_to").unwrap();
|
||||||
|
let result = add_to.call(10_000_000, 4);
|
||||||
|
|
||||||
|
let err = result.unwrap_err();
|
||||||
|
match err {
|
||||||
|
RuntimeError::Error { data } => {
|
||||||
|
assert!(data.downcast_ref::<ExecutionLimitExceededError>().is_some());
|
||||||
|
}
|
||||||
|
_ => unreachable!(),
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify it used the correct number of points
|
||||||
|
assert_eq!(get_points_used(&instance), 109); // Used points will be slightly more than `limit` because of the way we do gas checking.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,19 +9,3 @@ edition = "2018"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasmer-runtime-core = { path = "../runtime-core" }
|
wasmer-runtime-core = { path = "../runtime-core" }
|
||||||
wasmer-clif-backend = { path = "../clif-backend", version = "0.6.0" }
|
|
||||||
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.6.0", optional = true }
|
|
||||||
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.6.0", optional = true }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
wabt = "0.9.1"
|
|
||||||
criterion = "0.2"
|
|
||||||
|
|
||||||
[features]
|
|
||||||
clif = []
|
|
||||||
llvm = ["wasmer-llvm-backend"]
|
|
||||||
singlepass = ["wasmer-singlepass-backend"]
|
|
||||||
|
|
||||||
[[bench]]
|
|
||||||
name = "metering_benchmark"
|
|
||||||
harness = false
|
|
||||||
|
@ -128,156 +128,3 @@ pub fn get_points_used_ctx(ctx: &Ctx) -> u64 {
|
|||||||
pub fn set_points_used_ctx(ctx: &mut Ctx, value: u64) {
|
pub fn set_points_used_ctx(ctx: &mut Ctx, value: u64) {
|
||||||
ctx.set_internal(&INTERNAL_FIELD, value);
|
ctx.set_internal(&INTERNAL_FIELD, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(test, any(feature = "singlepass", feature = "llvm")))]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
use wabt::wat2wasm;
|
|
||||||
|
|
||||||
use wasmer_runtime_core::codegen::{MiddlewareChain, StreamingCompiler};
|
|
||||||
use wasmer_runtime_core::{backend::Compiler, compile_with, imports, Func};
|
|
||||||
|
|
||||||
#[cfg(feature = "llvm")]
|
|
||||||
fn get_compiler(limit: u64) -> impl Compiler {
|
|
||||||
use wasmer_llvm_backend::ModuleCodeGenerator as LLVMMCG;
|
|
||||||
let c: StreamingCompiler<LLVMMCG, _, _, _, _> = StreamingCompiler::new(move || {
|
|
||||||
let mut chain = MiddlewareChain::new();
|
|
||||||
chain.push(Metering::new(limit));
|
|
||||||
chain
|
|
||||||
});
|
|
||||||
c
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "singlepass")]
|
|
||||||
fn get_compiler(limit: u64) -> impl Compiler {
|
|
||||||
use wasmer_singlepass_backend::ModuleCodeGenerator as SinglePassMCG;
|
|
||||||
let c: StreamingCompiler<SinglePassMCG, _, _, _, _> = StreamingCompiler::new(move || {
|
|
||||||
let mut chain = MiddlewareChain::new();
|
|
||||||
chain.push(Metering::new(limit));
|
|
||||||
chain
|
|
||||||
});
|
|
||||||
c
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(any(feature = "llvm", feature = "clif", feature = "singlepass")))]
|
|
||||||
compile_error!("compiler not specified, activate a compiler via features");
|
|
||||||
|
|
||||||
#[cfg(feature = "clif")]
|
|
||||||
fn get_compiler(_limit: u64) -> impl Compiler {
|
|
||||||
compile_error!("cranelift does not implement metering");
|
|
||||||
use wasmer_clif_backend::CraneliftCompiler;
|
|
||||||
CraneliftCompiler::new()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assemblyscript
|
|
||||||
// export function add_to(x: i32, y: i32): i32 {
|
|
||||||
// for(var i = 0; i < x; i++){
|
|
||||||
// if(i % 1 == 0){
|
|
||||||
// y += i;
|
|
||||||
// } else {
|
|
||||||
// y *= i
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return y;
|
|
||||||
// }
|
|
||||||
static WAT: &'static str = r#"
|
|
||||||
(module
|
|
||||||
(type $t0 (func (param i32 i32) (result i32)))
|
|
||||||
(type $t1 (func))
|
|
||||||
(func $add_to (export "add_to") (type $t0) (param $p0 i32) (param $p1 i32) (result i32)
|
|
||||||
(local $l0 i32)
|
|
||||||
block $B0
|
|
||||||
i32.const 0
|
|
||||||
set_local $l0
|
|
||||||
loop $L1
|
|
||||||
get_local $l0
|
|
||||||
get_local $p0
|
|
||||||
i32.lt_s
|
|
||||||
i32.eqz
|
|
||||||
br_if $B0
|
|
||||||
get_local $l0
|
|
||||||
i32.const 1
|
|
||||||
i32.rem_s
|
|
||||||
i32.const 0
|
|
||||||
i32.eq
|
|
||||||
if $I2
|
|
||||||
get_local $p1
|
|
||||||
get_local $l0
|
|
||||||
i32.add
|
|
||||||
set_local $p1
|
|
||||||
else
|
|
||||||
get_local $p1
|
|
||||||
get_local $l0
|
|
||||||
i32.mul
|
|
||||||
set_local $p1
|
|
||||||
end
|
|
||||||
get_local $l0
|
|
||||||
i32.const 1
|
|
||||||
i32.add
|
|
||||||
set_local $l0
|
|
||||||
br $L1
|
|
||||||
unreachable
|
|
||||||
end
|
|
||||||
unreachable
|
|
||||||
end
|
|
||||||
get_local $p1)
|
|
||||||
(func $f1 (type $t1))
|
|
||||||
(table $table (export "table") 1 anyfunc)
|
|
||||||
(memory $memory (export "memory") 0)
|
|
||||||
(global $g0 i32 (i32.const 8))
|
|
||||||
(elem (i32.const 0) $f1))
|
|
||||||
"#;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_points_reduced_after_call() {
|
|
||||||
let wasm_binary = wat2wasm(WAT).unwrap();
|
|
||||||
|
|
||||||
let limit = 100u64;
|
|
||||||
|
|
||||||
let module = compile_with(&wasm_binary, &get_compiler(limit)).unwrap();
|
|
||||||
|
|
||||||
let import_object = imports! {};
|
|
||||||
let mut instance = module.instantiate(&import_object).unwrap();
|
|
||||||
|
|
||||||
set_points_used(&mut instance, 0u64);
|
|
||||||
|
|
||||||
let add_to: Func<(i32, i32), i32> = instance.func("add_to").unwrap();
|
|
||||||
let value = add_to.call(3, 4).unwrap();
|
|
||||||
|
|
||||||
// verify it returns the correct value
|
|
||||||
assert_eq!(value, 7);
|
|
||||||
|
|
||||||
// verify it used the correct number of points
|
|
||||||
assert_eq!(get_points_used(&instance), 74);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_traps_after_costly_call() {
|
|
||||||
use wasmer_runtime_core::error::RuntimeError;
|
|
||||||
let wasm_binary = wat2wasm(WAT).unwrap();
|
|
||||||
|
|
||||||
let limit = 100u64;
|
|
||||||
|
|
||||||
let module = compile_with(&wasm_binary, &get_compiler(limit)).unwrap();
|
|
||||||
|
|
||||||
let import_object = imports! {};
|
|
||||||
let mut instance = module.instantiate(&import_object).unwrap();
|
|
||||||
|
|
||||||
set_points_used(&mut instance, 0u64);
|
|
||||||
|
|
||||||
let add_to: Func<(i32, i32), i32> = instance.func("add_to").unwrap();
|
|
||||||
let result = add_to.call(10_000_000, 4);
|
|
||||||
|
|
||||||
let err = result.unwrap_err();
|
|
||||||
match err {
|
|
||||||
RuntimeError::Error { data } => {
|
|
||||||
assert!(data.downcast_ref::<ExecutionLimitExceededError>().is_some());
|
|
||||||
}
|
|
||||||
_ => unreachable!(),
|
|
||||||
}
|
|
||||||
|
|
||||||
// verify it used the correct number of points
|
|
||||||
assert_eq!(get_points_used(&instance), 109); // Used points will be slightly more than `limit` because of the way we do gas checking.
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -18,7 +18,7 @@ add_executable(test-context test-context.c)
|
|||||||
add_executable(test-module-import-instantiate test-module-import-instantiate.c)
|
add_executable(test-module-import-instantiate test-module-import-instantiate.c)
|
||||||
|
|
||||||
find_library(
|
find_library(
|
||||||
WASMER_LIB NAMES libwasmer_runtime_c_api.dylib libwasmer_runtime_c_api.so libwasmer_runtime_c_api.dll
|
WASMER_LIB NAMES libwasmer_runtime_c_api.dylib libwasmer_runtime_c_api.so wasmer_runtime_c_api.dll
|
||||||
PATHS ${CMAKE_SOURCE_DIR}/../../../target/release/
|
PATHS ${CMAKE_SOURCE_DIR}/../../../target/release/
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -35,6 +35,9 @@ impl From<io::Error> for Error {
|
|||||||
///
|
///
|
||||||
/// [`Cache`]: trait.Cache.html
|
/// [`Cache`]: trait.Cache.html
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
|
// WasmHash is made up of two 32 byte arrays instead of a 64 byte array
|
||||||
|
// because derive only works on fixed sized arrays size 32 or below
|
||||||
|
// TODO: fix this when this gets fixed by improved const generics
|
||||||
pub struct WasmHash([u8; 32], [u8; 32]);
|
pub struct WasmHash([u8; 32], [u8; 32]);
|
||||||
|
|
||||||
impl WasmHash {
|
impl WasmHash {
|
||||||
|
@ -1,2 +1,5 @@
|
|||||||
__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } }
|
__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } }
|
||||||
[__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } }, __wasi_event_t { userdata: 1193046, error: 0, type_: 2, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 1234, flags: 0 } } }]
|
[__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } }, __wasi_event_t { userdata: 1193046, error: 0, type_: 2, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 1234, flags: 0 } } }]
|
||||||
|
Stdin: OK
|
||||||
|
Stdout: OK
|
||||||
|
Stderr: OK
|
||||||
|
@ -171,11 +171,46 @@ fn main() {
|
|||||||
poll(fds.as_slice(), &[true, false], &[false, true]).expect("subsequent polls");
|
poll(fds.as_slice(), &[true, false], &[false, true]).expect("subsequent polls");
|
||||||
}
|
}
|
||||||
println!("{:?}", result);
|
println!("{:?}", result);
|
||||||
|
|
||||||
|
/// stdin, stdout, stderr checking
|
||||||
|
let fds = vec![std::io::stdin().as_raw_fd()];
|
||||||
|
print!("Stdin: ");
|
||||||
|
println!(
|
||||||
|
"{}",
|
||||||
|
if poll(fds.as_slice(), &[true], &[false]).is_ok() {
|
||||||
|
"OK"
|
||||||
|
} else {
|
||||||
|
"ERROR"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
let fds = vec![std::io::stdout().as_raw_fd()];
|
||||||
|
print!("Stdout: ");
|
||||||
|
println!(
|
||||||
|
"{}",
|
||||||
|
if poll(fds.as_slice(), &[false], &[true]).is_ok() {
|
||||||
|
"OK"
|
||||||
|
} else {
|
||||||
|
"ERROR"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
let fds = vec![std::io::stderr().as_raw_fd()];
|
||||||
|
print!("Stderr: ");
|
||||||
|
println!(
|
||||||
|
"{}",
|
||||||
|
if poll(fds.as_slice(), &[false], &[true]).is_ok() {
|
||||||
|
"OK"
|
||||||
|
} else {
|
||||||
|
"ERROR"
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
#[cfg(not(target_os = "wasi"))]
|
#[cfg(not(target_os = "wasi"))]
|
||||||
{
|
{
|
||||||
println!("{}", "__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } }");
|
println!("{}", "__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } }");
|
||||||
println!("{}", "[__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } }, __wasi_event_t { userdata: 1193046, error: 0, type_: 2, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 1234, flags: 0 } } }]");
|
println!("{}", "[__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } }, __wasi_event_t { userdata: 1193046, error: 0, type_: 2, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 1234, flags: 0 } } }]");
|
||||||
|
println!("Stdin: OK");
|
||||||
|
println!("Stdout: OK");
|
||||||
|
println!("Stderr: OK");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,26 +452,11 @@ impl WasiFile for HostFile {
|
|||||||
std::fs::rename(&self.host_path, new_name).map_err(Into::into)
|
std::fs::rename(&self.host_path, new_name).map_err(Into::into)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
fn bytes_available(&self) -> Result<usize, WasiFsError> {
|
fn bytes_available(&self) -> Result<usize, WasiFsError> {
|
||||||
use std::os::unix::io::AsRawFd;
|
// unwrap is safe because of get_raw_fd implementation
|
||||||
let host_fd = self.inner.as_raw_fd();
|
let host_fd = self.get_raw_fd().unwrap();
|
||||||
|
|
||||||
let mut bytes_found = 0 as libc::c_int;
|
host_file_bytes_available(host_fd)
|
||||||
let result = unsafe { libc::ioctl(host_fd, libc::FIONREAD, &mut bytes_found) };
|
|
||||||
|
|
||||||
match result {
|
|
||||||
// success
|
|
||||||
0 => Ok(bytes_found.try_into().unwrap_or(0)),
|
|
||||||
libc::EBADF => Err(WasiFsError::InvalidFd),
|
|
||||||
libc::EFAULT => Err(WasiFsError::InvalidData),
|
|
||||||
libc::EINVAL => Err(WasiFsError::InvalidInput),
|
|
||||||
_ => Err(WasiFsError::IOError),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[cfg(not(unix))]
|
|
||||||
fn bytes_available(&self) -> Result<usize, WasiFsError> {
|
|
||||||
unimplemented!("HostFile::bytes_available in WasiFile is not implemented for non-Unix-like targets yet");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
@ -514,6 +499,26 @@ impl From<io::Error> for WasiFsError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(unix)]
|
||||||
|
fn host_file_bytes_available(host_fd: i32) -> Result<usize, WasiFsError> {
|
||||||
|
let mut bytes_found = 0 as libc::c_int;
|
||||||
|
let result = unsafe { libc::ioctl(host_fd, libc::FIONREAD, &mut bytes_found) };
|
||||||
|
|
||||||
|
match result {
|
||||||
|
// success
|
||||||
|
0 => Ok(bytes_found.try_into().unwrap_or(0)),
|
||||||
|
libc::EBADF => Err(WasiFsError::InvalidFd),
|
||||||
|
libc::EFAULT => Err(WasiFsError::InvalidData),
|
||||||
|
libc::EINVAL => Err(WasiFsError::InvalidInput),
|
||||||
|
_ => Err(WasiFsError::IOError),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(unix))]
|
||||||
|
fn host_file_bytes_available(_raw_fd: i32) -> Result<usize, WasiFsError> {
|
||||||
|
unimplemented!("host_file_bytes_available not yet implemented for non-Unix-like targets. This probably means the program tried to use wasi::poll_oneoff")
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Stdout(pub std::io::Stdout);
|
pub struct Stdout(pub std::io::Stdout);
|
||||||
impl Read for Stdout {
|
impl Read for Stdout {
|
||||||
@ -579,6 +584,13 @@ impl WasiFile for Stdout {
|
|||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn bytes_available(&self) -> Result<usize, WasiFsError> {
|
||||||
|
// unwrap is safe because of get_raw_fd implementation
|
||||||
|
let host_fd = self.get_raw_fd().unwrap();
|
||||||
|
|
||||||
|
host_file_bytes_available(host_fd)
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn get_raw_fd(&self) -> Option<i32> {
|
fn get_raw_fd(&self) -> Option<i32> {
|
||||||
use std::os::unix::io::AsRawFd;
|
use std::os::unix::io::AsRawFd;
|
||||||
@ -658,6 +670,13 @@ impl WasiFile for Stderr {
|
|||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn bytes_available(&self) -> Result<usize, WasiFsError> {
|
||||||
|
// unwrap is safe because of get_raw_fd implementation
|
||||||
|
let host_fd = self.get_raw_fd().unwrap();
|
||||||
|
|
||||||
|
host_file_bytes_available(host_fd)
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn get_raw_fd(&self) -> Option<i32> {
|
fn get_raw_fd(&self) -> Option<i32> {
|
||||||
use std::os::unix::io::AsRawFd;
|
use std::os::unix::io::AsRawFd;
|
||||||
@ -737,28 +756,11 @@ impl WasiFile for Stdin {
|
|||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
|
||||||
fn bytes_available(&self) -> Result<usize, WasiFsError> {
|
fn bytes_available(&self) -> Result<usize, WasiFsError> {
|
||||||
use std::os::unix::io::AsRawFd;
|
// unwrap is safe because of get_raw_fd implementation
|
||||||
let host_fd = self.0.as_raw_fd();
|
let host_fd = self.get_raw_fd().unwrap();
|
||||||
|
|
||||||
let mut bytes_found = 0 as libc::c_int;
|
host_file_bytes_available(host_fd)
|
||||||
let result = unsafe { libc::ioctl(host_fd, libc::FIONREAD, &mut bytes_found) };
|
|
||||||
|
|
||||||
match result {
|
|
||||||
// success
|
|
||||||
0 => Ok(bytes_found.try_into().unwrap_or(0)),
|
|
||||||
libc::EBADF => Err(WasiFsError::InvalidFd),
|
|
||||||
libc::EFAULT => Err(WasiFsError::InvalidData),
|
|
||||||
libc::EINVAL => Err(WasiFsError::InvalidInput),
|
|
||||||
_ => Err(WasiFsError::IOError),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[cfg(not(unix))]
|
|
||||||
fn bytes_available(&self) -> Result<usize, WasiFsError> {
|
|
||||||
unimplemented!(
|
|
||||||
"Stdin::bytes_available in WasiFile is not implemented for non-Unix-like targets yet"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
@ -34,7 +34,7 @@ pub(crate) fn get_wasi_state(ctx: &Ctx) -> &mut WasiState {
|
|||||||
unsafe { state::get_wasi_state(&mut *(ctx as *const Ctx as *mut Ctx)) }
|
unsafe { state::get_wasi_state(&mut *(ctx as *const Ctx as *mut Ctx)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_bytes<T: Write>(
|
fn write_bytes_inner<T: Write>(
|
||||||
mut write_loc: T,
|
mut write_loc: T,
|
||||||
memory: &Memory,
|
memory: &Memory,
|
||||||
iovs_arr_cell: &[Cell<__wasi_ciovec_t>],
|
iovs_arr_cell: &[Cell<__wasi_ciovec_t>],
|
||||||
@ -44,19 +44,25 @@ fn write_bytes<T: Write>(
|
|||||||
let iov_inner = iov.get();
|
let iov_inner = iov.get();
|
||||||
let bytes = iov_inner.buf.deref(memory, 0, iov_inner.buf_len)?;
|
let bytes = iov_inner.buf.deref(memory, 0, iov_inner.buf_len)?;
|
||||||
write_loc
|
write_loc
|
||||||
.write(&bytes.iter().map(|b_cell| b_cell.get()).collect::<Vec<u8>>())
|
.write_all(&bytes.iter().map(|b_cell| b_cell.get()).collect::<Vec<u8>>())
|
||||||
.map_err(|_| {
|
.map_err(|_| __WASI_EIO)?;
|
||||||
write_loc.flush();
|
|
||||||
__WASI_EIO
|
|
||||||
})?;
|
|
||||||
|
|
||||||
// TODO: handle failure more accurately
|
// TODO: handle failure more accurately
|
||||||
bytes_written += iov_inner.buf_len;
|
bytes_written += iov_inner.buf_len;
|
||||||
}
|
}
|
||||||
write_loc.flush();
|
|
||||||
Ok(bytes_written)
|
Ok(bytes_written)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn write_bytes<T: Write>(
|
||||||
|
mut write_loc: T,
|
||||||
|
memory: &Memory,
|
||||||
|
iovs_arr_cell: &[Cell<__wasi_ciovec_t>],
|
||||||
|
) -> Result<u32, __wasi_errno_t> {
|
||||||
|
let result = write_bytes_inner(&mut write_loc, memory, iovs_arr_cell);
|
||||||
|
write_loc.flush();
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
fn read_bytes<T: Read>(
|
fn read_bytes<T: Read>(
|
||||||
mut reader: T,
|
mut reader: T,
|
||||||
memory: &Memory,
|
memory: &Memory,
|
||||||
@ -2261,17 +2267,28 @@ pub fn poll_oneoff(
|
|||||||
|
|
||||||
let fd = match s.event_type {
|
let fd = match s.event_type {
|
||||||
EventType::Read(__wasi_subscription_fs_readwrite_t { fd }) => {
|
EventType::Read(__wasi_subscription_fs_readwrite_t { fd }) => {
|
||||||
let fd_entry = wasi_try!(state.fs.get_fd(fd));
|
match fd {
|
||||||
if !has_rights(fd_entry.rights, __WASI_RIGHT_FD_READ) {
|
__WASI_STDIN_FILENO | __WASI_STDOUT_FILENO | __WASI_STDERR_FILENO => (),
|
||||||
return __WASI_EACCES;
|
_ => {
|
||||||
|
let fd_entry = wasi_try!(state.fs.get_fd(fd));
|
||||||
|
if !has_rights(fd_entry.rights, __WASI_RIGHT_FD_READ) {
|
||||||
|
return __WASI_EACCES;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
in_events.push(peb.add(PollEvent::PollIn).build());
|
in_events.push(peb.add(PollEvent::PollIn).build());
|
||||||
Some(fd)
|
Some(fd)
|
||||||
}
|
}
|
||||||
EventType::Write(__wasi_subscription_fs_readwrite_t { fd }) => {
|
EventType::Write(__wasi_subscription_fs_readwrite_t { fd }) => {
|
||||||
let fd_entry = wasi_try!(state.fs.get_fd(fd));
|
match fd {
|
||||||
if !has_rights(fd_entry.rights, __WASI_RIGHT_FD_WRITE) {
|
__WASI_STDIN_FILENO | __WASI_STDOUT_FILENO | __WASI_STDERR_FILENO => (),
|
||||||
return __WASI_EACCES;
|
_ => {
|
||||||
|
let fd_entry = wasi_try!(state.fs.get_fd(fd));
|
||||||
|
|
||||||
|
if !has_rights(fd_entry.rights, __WASI_RIGHT_FD_WRITE) {
|
||||||
|
return __WASI_EACCES;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
in_events.push(peb.add(PollEvent::PollOut).build());
|
in_events.push(peb.add(PollEvent::PollOut).build());
|
||||||
Some(fd)
|
Some(fd)
|
||||||
|
@ -11,6 +11,7 @@ echo "manually check changes to wasmer.iss"
|
|||||||
# Order to upload packages in
|
# Order to upload packages in
|
||||||
## runtime-core
|
## runtime-core
|
||||||
## win-exception-handler
|
## win-exception-handler
|
||||||
|
## middleware-common
|
||||||
## clif-backend
|
## clif-backend
|
||||||
## llvm-backend
|
## llvm-backend
|
||||||
## singlepass-backend
|
## singlepass-backend
|
||||||
|