switch to zbox

This commit is contained in:
Mackenzie Clark 2019-03-13 14:22:32 -07:00
parent 650125f338
commit c1e0d325e3
9 changed files with 318 additions and 117 deletions

View File

@ -47,6 +47,14 @@ jobs:
sudo apt-get install -y cmake
curl -O https://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
tar xf clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
# install libsodium
curl -O https://download.libsodium.org/libsodium/releases/libsodium-1.0.17.tar.gz
tar xf libsodium-1.0.17.tar.gz
cd libsodium-1.0.17/
./configure
make && make check
sudo make install
cd ..
- run:
name: Tests
command: |
@ -56,6 +64,8 @@ jobs:
name: Emscripten Tests
command: |
export LLVM_SYS_70_PREFIX="`pwd`/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/"
export SODIUM_LIB_DIR=/usr/local/lib
export SODIUM_STATIC=true
make test-emscripten
- run:
name: Integration Tests
@ -88,6 +98,13 @@ jobs:
# Installing LLVM outside of brew
curl -O https://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-apple-darwin.tar.xz
tar xf clang+llvm-7.0.0-x86_64-apple-darwin.tar.xz
# install libsodium
curl -O https://download.libsodium.org/libsodium/releases/libsodium-1.0.17.tar.gz
tar xf libsodium-1.0.17.tar.gz
cd libsodium-1.0.17/
./configure
make && make check
sudo make install
- run:
name: Install Rust
command: |
@ -113,6 +130,8 @@ jobs:
# We increase the ulimit for fixing cargo unclosed files in mac
ulimit -n 8000
sudo sysctl -w kern.maxfiles=655360 kern.maxfilesperproc=327680
export SODIUM_LIB_DIR=/usr/local/lib
export SODIUM_STATIC=true
make test-emscripten
- run:
name: Integration Tests
@ -146,6 +165,13 @@ jobs:
sudo apt-get install -y cmake
curl -O https://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
tar xf clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
# install libsodium
curl -O https://download.libsodium.org/libsodium/releases/libsodium-1.0.17.tar.gz
tar xf libsodium-1.0.17.tar.gz
cd libsodium-1.0.17/
./configure
make && make check
sudo make install
- run:
name: Tests
command: |
@ -155,6 +181,8 @@ jobs:
name: Emscripten Tests
command: |
export LLVM_SYS_70_PREFIX="`pwd`/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04/"
export SODIUM_LIB_DIR=/usr/local/lib
export SODIUM_STATIC=true
make test-emscripten
- run:
name: Release Build
@ -200,6 +228,13 @@ jobs:
# Installing LLVM outside of brew
curl -O https://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-apple-darwin.tar.xz
tar xf clang+llvm-7.0.0-x86_64-apple-darwin.tar.xz
# install libsodium
curl -O https://download.libsodium.org/libsodium/releases/libsodium-1.0.17.tar.gz
tar xf libsodium-1.0.17.tar.gz
cd libsodium-1.0.17/
./configure
make && make check
sudo make install
- run:
name: Install Rust
command: |
@ -225,6 +260,8 @@ jobs:
# We increase the ulimit for fixing cargo unclosed files in mac
ulimit -n 8000
sudo sysctl -w kern.maxfiles=655360 kern.maxfilesperproc=327680
export SODIUM_LIB_DIR=/usr/local/lib
export SODIUM_STATIC=true
make test-emscripten
- run:
name: Release Build

181
Cargo.lock generated
View File

@ -118,11 +118,25 @@ dependencies = [
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bytecount"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "byteorder"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bytes"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "capstone"
version = "0.5.0"
@ -139,6 +153,18 @@ dependencies = [
"cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cargo_metadata"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cast"
version = "0.2.2"
@ -401,6 +427,18 @@ dependencies = [
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "env_logger"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "env_logger"
version = "0.6.1"
@ -432,6 +470,14 @@ dependencies = [
"libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "error-chain"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "failure"
version = "0.1.5"
@ -557,6 +603,15 @@ dependencies = [
"syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "iovec"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "itertools"
version = "0.8.0"
@ -598,6 +653,15 @@ dependencies = [
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "linked-hash-map"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_test 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "llvm-sys"
version = "70.1.0"
@ -627,6 +691,25 @@ dependencies = [
"cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "lz4"
version = "1.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
"lz4-sys 1.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
"skeptic 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "lz4-sys"
version = "1.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "memchr"
version = "2.2.0"
@ -687,6 +770,14 @@ dependencies = [
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-traits"
version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-traits"
version = "0.2.6"
@ -744,6 +835,11 @@ name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "pkg-config"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "plain"
version = "0.2.3"
@ -757,6 +853,14 @@ dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "pulldown-cmark"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "quick-error"
version = "1.2.2"
@ -972,6 +1076,25 @@ dependencies = [
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rmp"
version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rmp-serde"
version = "0.13.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rustc-demangle"
version = "0.1.13"
@ -1028,6 +1151,7 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -1080,6 +1204,29 @@ dependencies = [
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_test"
version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "skeptic"
version = "0.13.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytecount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "smallvec"
version = "0.6.9"
@ -1440,6 +1587,7 @@ dependencies = [
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime-core 0.2.1",
"wasmparser 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)",
"zbox 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"zstd 0.4.22+zstd.1.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1577,6 +1725,22 @@ dependencies = [
"libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "zbox"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
"linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lz4 1.23.1 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rmp-serde 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "zstd"
version = "0.4.22+zstd.1.3.8"
@ -1619,9 +1783,12 @@ dependencies = [
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
"checksum blake2b_simd 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce2571a6cd634670daa2977cc894c1cc2ba57c563c498e5a82c35446f34d056e"
"checksum blob 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "19803aa44ff8b43123bbe369efaddcb638ea7dc332e543972dd95ac7cb148b92"
"checksum bytecount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b92204551573580e078dc80017f36a213eb77a0450e4ddd8cfa0f3f2d1f0178f"
"checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb"
"checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
"checksum capstone 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "00be9d203fa0e078b93b24603633fb081851dfe0c1086364431f52587a47157e"
"checksum capstone-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2dc8d32bc5c1e6d0fcde10af411c98b07d93498d51654f678757f08fa2acd6a6"
"checksum cargo_metadata 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1b4d380e1bab994591a24c2bdd1b054f64b60bef483a8c598c7c345bc3bbe"
"checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427"
"checksum cbindgen 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f61c5411fe3ac196fae7ea397dd13959b1323edda046eec50d648a8e92015a53"
"checksum cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)" = "d01c69d08ff207f231f07196e30f84c70f1c815b04f980f8b7b01ff01f05eb92"
@ -1649,9 +1816,11 @@ dependencies = [
"checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c"
"checksum either 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c67353c641dc847124ea1902d69bd753dee9bb3beff9aa3662ecf86c971d1fac"
"checksum enum-methods 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7798e7da2d4cb0d6d6fc467e8d6b5bf247e9e989f786dde1732d79899c32bb10"
"checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38"
"checksum env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b61fa891024a945da30a9581546e8cfaf5602c7b3f4c137a2805cf388f92075a"
"checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e"
"checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067"
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"
"checksum field-offset 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "64e9bc339e426139e02601fa69d101e96a92aee71b58bc01697ec2a63a5c9e68"
@ -1668,15 +1837,19 @@ dependencies = [
"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d"
"checksum inkwell 0.1.0 (git+https://github.com/wasmerio/inkwell?branch=llvm7-0)" = "<none>"
"checksum inkwell_internal_macros 0.1.0 (git+https://github.com/wasmerio/inkwell?branch=llvm7-0)" = "<none>"
"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08"
"checksum itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b8467d9c1cebe26feb08c640139247fac215782d35371ade9a2136ed6085358"
"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14"
"checksum libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "aab692d7759f5cd8c859e169db98ae5b52c924add2af5fbbca11d12fefb567c1"
"checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2"
"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e"
"checksum llvm-sys 70.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60a9ee82fe0fa72ae6ef6d018b407296085863836451c7a97384f84ed7e26b9f"
"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
"checksum lz4 1.23.1 (registry+https://github.com/rust-lang/crates.io-index)" = "43c94a9f09a60017f373020cc93d4291db4cd92b0db64ff25927f27d09dc23d5"
"checksum lz4-sys 1.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "20ab022822e9331c58d373acdd6b98085bace058ac6837b8266f213a2fccdafe"
"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39"
"checksum memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
@ -1684,6 +1857,7 @@ dependencies = [
"checksum nix 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46f0f3210768d796e8fa79ec70ee6af172dacbe7147f5e69be5240a47778302b"
"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945"
"checksum nom 4.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "22293d25d3f33a8567cc8a1dc20f40c7eeb761ce83d0fcca059858580790cac3"
"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31"
"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"
"checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba"
"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13"
@ -1691,8 +1865,10 @@ dependencies = [
"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337"
"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9"
"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
"checksum plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915"
"checksum pulldown-cmark 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eef52fac62d0ea7b9b4dc7da092aa64ea7ec3d90af6679422d3d7e0e14b6ee15"
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1"
@ -1717,6 +1893,8 @@ dependencies = [
"checksum regex 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53ee8cfdddb2e0291adfb9f13d31d3bbe0a03c9a402c01b1e24188d86c35b24f"
"checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861"
"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5"
"checksum rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a3d45d7afc9b132b34a2479648863aa95c5c88e98b32285326a6ebadc80ec5c9"
"checksum rmp-serde 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)" = "011e1d58446e9fa3af7cdc1fb91295b10621d3ac4cb3a85cc86385ee9ca50cd3"
"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7"
@ -1731,6 +1909,8 @@ dependencies = [
"checksum serde_bytes 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)" = "defbb8a83d7f34cc8380751eeb892b825944222888aff18996ea7901f24aec88"
"checksum serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6eabf4b5914e88e24eea240bb7c9f9a2cbc1bbbe8d961d381975ec3c6b806c"
"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d"
"checksum serde_test 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "70807e147558b5253cb70f55d343db1d07204d773087c96d0f35fced295dba82"
"checksum skeptic 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6fb8ed853fdc19ce09752d63f3a2e5b5158aeb261520cd75eb618bd60305165"
"checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be"
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
@ -1776,6 +1956,7 @@ dependencies = [
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba"
"checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c"
"checksum zbox 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4a969b504de4ee47ac68bbd035b0c5a53818edb1edd6737131de001de2a09e64"
"checksum zstd 0.4.22+zstd.1.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6f042dd18d52854d302d3d92f66d0a63c2d520d7b7034a9d43cde7441d1b4ddd"
"checksum zstd-safe 1.4.7+zstd.1.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "63febf0b0dcd076db81e6b3110ed254cfb8ed54378a4c3cfbb68956e839d4f59"
"checksum zstd-sys 1.4.8+zstd.1.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4cb187d624025a7d9878ecf13437491869423426183ded2fa40d4651b85f7ae7"

View File

@ -54,10 +54,8 @@ pub use self::utils::{
get_emscripten_table_size, is_emscripten_module,
};
use std::fs::File;
use std::io::Write;
#[cfg(feature = "vfs")]
use wasmer_runtime_abi::vfs::vfs::VfsBacking;
use wasmer_runtime_abi::vfs::vfs::Vfs;
// TODO: Magic number - how is this calculated?
const TOTAL_STACK: u32 = 5_242_880;
@ -124,7 +122,7 @@ pub struct EmscriptenData<'a> {
pub dyn_call_vijj: Option<Func<'a, (i32, i32, i32, i32, i32, i32)>>,
#[cfg(feature = "vfs")]
pub vfs: Option<VfsBacking>,
pub vfs: Option<Vfs>,
}
impl<'a> EmscriptenData<'a> {
@ -237,10 +235,12 @@ pub fn run_emscripten_instance(
// Construct a new virtual filesystem and inject it into the emscripten data
// This is behind a feature flag for now, but will be default in the future
#[cfg(not(feature = "vfs"))]
let _ = module;
#[cfg(feature = "vfs")]
{
data.vfs = match module.info().custom_sections.get("wasmer_fs") {
Some(bytes) => match VfsBacking::from_tar_zstd_bytes(&bytes[..]) {
Some(bytes) => match Vfs::from_tar_zstd_bytes(&bytes[..]) {
Ok(vfs_backing) => Some(vfs_backing),
Err(_) => None,
},

View File

@ -29,7 +29,6 @@ use libc::{
// iovec,
lseek,
// open,
// read,
// readv,
rmdir,
// writev,
@ -68,7 +67,7 @@ pub fn ___syscall3(ctx: &mut Ctx, _which: i32, mut varargs: VarArgs) -> i32 {
/// read
#[cfg(feature = "vfs")]
pub fn ___syscall3(ctx: &mut Ctx, which: i32, mut varargs: VarArgs) -> i32 {
pub fn ___syscall3(ctx: &mut Ctx, _which: i32, mut varargs: VarArgs) -> i32 {
// -> ssize_t
debug!("emscripten::___syscall3 (read - vfs) {}", which);
let fd: i32 = varargs.get(ctx);
@ -99,7 +98,7 @@ pub fn ___syscall4(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int
/// open
#[cfg(feature = "vfs")]
pub fn ___syscall5(ctx: &mut Ctx, which: c_int, mut varargs: VarArgs) -> c_int {
pub fn ___syscall5(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall5 (open vfs) {}", which);
let pathname: u32 = varargs.get(ctx);
let pathname_addr = emscripten_memory_pointer!(ctx.memory(0), pathname) as *const i8;

View File

@ -24,7 +24,6 @@ use libc::{
listen,
mkdir,
msghdr,
open,
pid_t,
pread,
pwrite,
@ -86,7 +85,7 @@ pub fn ___syscall5(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int
let mode: u32 = varargs.get(ctx);
let pathname_addr = emscripten_memory_pointer!(ctx.memory(0), pathname) as *const i8;
let _path_str = unsafe { std::ffi::CStr::from_ptr(pathname_addr).to_str().unwrap() };
let fd = unsafe { open(pathname_addr, flags, mode) };
let fd = unsafe { libc::open(pathname_addr, flags, mode) };
debug!(
"=> pathname: {}, flags: {}, mode: {} = fd: {}\npath: {}",
pathname, flags, mode, fd, _path_str

View File

@ -1,9 +1,8 @@
use crate::emtests::_common::assert_emscripten_output;
#[test]
fn test_vfs() {
assert_emscripten_output!(
"../../emtests/test_vfs.wasm",
"test_vfs",
vec![],
"../../emtests/test_vfs.out"
);
let wasm_bytes = include_bytes!("../../emtests/test_vfs.wasm");
let expected_str = include_str!("../../emtests/test_vfs.out");
assert_emscripten_output(wasm_bytes, expected_str);
}

View File

@ -12,8 +12,9 @@ wasmer-runtime-core = { path = "../runtime-core" }
hashbrown = "0.1"
failure = "0.1"
tar = "0.4"
zstd = "0.4"
wasmparser = "0.23.0"
zstd = "0.4"
zbox = "0.6.1"
[dev-dependencies]
tempdir = "0.3"

View File

@ -12,5 +12,12 @@ The only current supported operation is the `read` syscall.
The virtual filesystem is not enabled by default. Build with `--features vfs` to use it.
[Zbox][3] is a virtual filesystem that depends on [libsodium][4]. See [installation instructions][5] for libsodium here. One can
statically link libsodium with the [instructions][6] on Zbox's readme.
[1]: https://facebook.github.io/zstd/
[2]: https://www.gnu.org/software/tar/
[3]: https://zbox.io/
[4]: https://download.libsodium.org/doc/
[5]: https://download.libsodium.org/doc/installation
[6]: https://github.com/zboxfs/zbox#static-linking-with-libsodium

View File

@ -1,125 +1,103 @@
use hashbrown::HashMap;
use zbox::{init_env, RepoOpener, Repo, OpenOptions};
use std::io::Read;
use std::io::Write;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicIsize, Ordering};
use std::sync::Arc;
use std::collections::BTreeMap;
use std::io;
/// Simply an alias. May become a more complicated type in the future.
pub type Fd = isize;
/// Index into the file data vec.
pub type DataIndex = usize;
/// A simple key representing a path or a file descriptor. This filesystem treats paths and file
/// descriptor as first class citizens. A key has access to an index in the filesystem data.
#[derive(Hash, Eq, PartialEq, Debug)]
pub enum DataKey {
Path(PathBuf),
Fd(Fd),
pub struct Vfs {
pub repo: Repo,
pub fd_map: BTreeMap<Fd, zbox::File>, // best because we look for lowest fd
}
pub struct VfsBacking {
/// The file data
blocks: Vec<Vec<u8>>,
/// Map of file descriptors or paths to indexes in the file data
data: HashMap<DataKey, DataIndex>,
/// Counter for file descriptors
fd_count: Arc<AtomicIsize>,
}
impl VfsBacking {
/// like read(2), will read the data for the file descriptor
pub fn read_file<Writer: Write>(
&mut self,
fd: Fd,
mut buf: Writer,
) -> Result<usize, failure::Error> {
let key = DataKey::Fd(fd);
let data_index = *self
.data
.get(&key)
.ok_or(VfsBackingError::FileDescriptorNotExist)?;
let data = self
.blocks
.get(data_index)
.ok_or(VfsBackingError::DataDoesNotExist)?;
buf.write(&data[..])
.map_err(|_| VfsBackingError::CopyError.into())
.map(|s| s as _)
}
/// like open(2), creates a file descriptor for the path if it exists
pub fn open_file<P: AsRef<Path>>(&mut self, path: P) -> Result<Fd, failure::Error> {
let path = path.as_ref().to_path_buf();
let key = DataKey::Path(path);
let data_index = *self
.data
.get(&key)
.ok_or(VfsBackingError::PathDoesNotExist)?;
// create an insert a file descriptor key
let fd = self.fd_count.fetch_add(1, Ordering::SeqCst);
let fd_key = DataKey::Fd(fd);
let _ = self.data.insert(fd_key, data_index);
Ok(fd)
}
impl Vfs {
/// Like `VfsBacking::from_tar_bytes` except it also decompresses from the zstd format.
pub fn from_tar_zstd_bytes<Reader: Read>(tar_bytes: Reader) -> Result<Self, failure::Error> {
let result = zstd::decode_all(tar_bytes);
let decompressed_data = result.unwrap();
VfsBacking::from_tar_bytes(&decompressed_data[..])
Vfs::from_tar_bytes(&decompressed_data[..])
}
/// Create a vfs from raw bytes in tar format
pub fn from_tar_bytes<Reader: Read>(tar_bytes: Reader) -> Result<Self, failure::Error> {
let mut ar = tar::Archive::new(tar_bytes);
let mut data = HashMap::new();
let mut blocks = vec![];
init_env();
let mut repo = RepoOpener::new().create(true).open("mem://wasmer_fs", "").unwrap();
for entry in ar.entries()? {
let mut entry = entry?;
// make a key from a path and insert the index of the
let path = entry.path().unwrap().to_path_buf();
let key = DataKey::Path(path);
let index = blocks.len();
data.insert(key, index);
// read the entry into a buffer and then push it into the file store
let mut file_data: Vec<u8> = vec![];
entry.read_to_end(&mut file_data).unwrap();
blocks.push(file_data);
let path = convert_to_absolute_path(entry.path().unwrap());
let mut file = OpenOptions::new()
.create(true)
.open(&mut repo, path)?;
io::copy(&mut entry, &mut file)?;
file.finish().unwrap();
}
let vfs = VfsBacking {
blocks,
data,
fd_count: Arc::new(AtomicIsize::new(0)),
let vfs = Vfs {
repo,
fd_map: BTreeMap::new(),
};
Ok(vfs)
}
/// like read(2), will read the data for the file descriptor
pub fn read_file(
&mut self,
fd: Fd,
buf: &mut [u8],
) -> Result<usize, failure::Error> {
self.fd_map
.get_mut(&fd)
.ok_or(VfsError::FileDescriptorNotExist)?
.read(buf)
.map_err(|e| e.into())
}
/// like open(2), creates a file descriptor for the path if it exists
pub fn open_file<P: AsRef<Path>>(&mut self, path: P) -> Result<Fd, failure::Error> {
let mut repo = &mut self.repo;
let path = convert_to_absolute_path(path);
let file = OpenOptions::new().open(&mut repo, path)?;
let fd = if self.fd_map.len() == 0 {
0
}
else {
let fd = *match self.fd_map.keys().max() {
Some(fd) => fd,
None => return Err(VfsError::CouldNotGetNextLowestFileDescriptor.into())
};
fd + 1
};
self.fd_map.insert(fd, file);
Ok(fd)
}
}
#[derive(Debug, Fail)]
pub enum VfsBackingError {
#[fail(display = "Data does not exist.")]
DataDoesNotExist,
#[fail(display = "Path does not exist.")]
PathDoesNotExist,
pub enum VfsError {
#[fail(display = "File descriptor does not exist.")]
FileDescriptorNotExist,
#[fail(display = "Error while copying to buffer")]
CopyError,
#[fail(display = "Error when trying to read maximum file descriptor.")]
CouldNotGetNextLowestFileDescriptor,
}
#[derive(Debug, Fail)]
pub enum VfsError {
#[fail(display = "File does not exist.")]
FileDoesNotExist,
fn convert_to_absolute_path<P: AsRef<Path>>(path: P) -> PathBuf {
let path = path.as_ref();
if path.is_relative() {
std::path::PathBuf::from("/").join(path)
}
else {
path.to_path_buf()
}
}
#[cfg(test)]
mod open_test {
use crate::vfs::vfs::VfsBacking;
use std::fs::File;
use std::io::Write;
use crate::vfs::vfs::Vfs;
#[test]
fn open_files() {
@ -133,7 +111,7 @@ mod open_test {
ar.append_path_with_name(file_path, "foo.txt").unwrap();
let archive = ar.into_inner().unwrap();
// SETUP: create virtual filesystem with tar data
let vfs_result = VfsBacking::from_tar_bytes(&archive[..]);
let vfs_result = Vfs::from_tar_bytes(&archive[..]);
// ASSERT:
assert!(
vfs_result.is_ok(),
@ -169,7 +147,7 @@ mod open_test {
ar.append_path_with_name(file_path, "foo.txt").unwrap();
let archive = ar.into_inner().unwrap();
// SETUP: create virtual filesystem with tar data
let vfs_result = VfsBacking::from_tar_bytes(&archive[..]);
let vfs_result = Vfs::from_tar_bytes(&archive[..]);
// ASSERT:
assert!(
vfs_result.is_ok(),
@ -190,17 +168,17 @@ mod open_test {
#[cfg(test)]
mod read_test {
use crate::vfs::vfs::VfsBacking;
use std::fs::File;
use std::io::Write;
use tempdir;
use crate::vfs::vfs::Vfs;
#[test]
fn empty_archive() {
// SETUP: create temp dir and files
let empty_archive = vec![];
// SETUP: create virtual filesystem with tar data
let vfs_result = VfsBacking::from_tar_bytes(&empty_archive[..]);
let vfs_result = Vfs::from_tar_bytes(&empty_archive[..]);
// ASSERT:
assert!(
vfs_result.is_ok(),
@ -220,7 +198,7 @@ mod read_test {
ar.append_path_with_name(foo_file_path, "foo.txt").unwrap();
let archive = ar.into_inner().unwrap();
// SETUP: create virtual filesystem with tar data
let vfs_result = VfsBacking::from_tar_bytes(&archive[..]);
let vfs_result = Vfs::from_tar_bytes(&archive[..]);
// ASSERT:
assert!(
vfs_result.is_ok(),
@ -229,7 +207,7 @@ mod read_test {
let mut vfs = vfs_result.unwrap();
// read the file
let fd = vfs.open_file("foo.txt").unwrap();
let mut actual_data: Vec<u8> = Vec::new();
let mut actual_data: [u8; 12] = [0; 12];
let read_result = vfs.read_file(fd, &mut actual_data);
assert!(read_result.is_ok(), "Failed to read file from vfs");
let expected_data = "foo foo foo\n".as_bytes();
@ -252,7 +230,7 @@ mod read_test {
ar.append_path_with_name(bar_file_path, "bar.txt").unwrap();
let archive = ar.into_inner().unwrap();
// SETUP: create virtual filesystem with tar data
let vfs_result = VfsBacking::from_tar_bytes(&archive[..]);
let vfs_result = Vfs::from_tar_bytes(&archive[..]);
// ASSERT:
assert!(
vfs_result.is_ok(),
@ -262,20 +240,20 @@ mod read_test {
// read the file
let foo_fd = vfs.open_file("foo.txt").unwrap();
let bar_fd = vfs.open_file("bar.txt").unwrap();
let mut foo_actual_data: Vec<u8> = Vec::new();
let mut foo_actual_data: [u8; 12] = [0; 12];
let foo_read_result = vfs.read_file(foo_fd, &mut foo_actual_data);
let mut bar_actual_data: Vec<u8> = Vec::new();
let mut bar_actual_data: [u8; 8] = [0; 8];
let bar_read_result = vfs.read_file(bar_fd, &mut bar_actual_data);
assert!(foo_read_result.is_ok(), "Failed to read foo.txt from vfs");
assert!(bar_read_result.is_ok(), "Failed to read bar.txt from vfs");
let foo_expected_data = Vec::from("foo foo foo\n");
let bar_expected_data = Vec::from("bar bar\n");
let foo_expected_data: &[u8; 12] = b"foo foo foo\n";
let bar_expected_data: &[u8; 8] = b"bar bar\n";
assert_eq!(
foo_actual_data, foo_expected_data,
&foo_actual_data, foo_expected_data,
"Contents of `foo.txt` is not correct"
);
assert_eq!(
bar_actual_data, bar_expected_data,
&bar_actual_data, bar_expected_data,
"Contents of `bar.txt` is not correct"
);
}