From 73dacfaad000d14e5d5f60c426019695393b4254 Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Fri, 5 Jul 2019 12:42:40 -0500 Subject: [PATCH 1/3] Add build jobs to bors --- bors.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bors.toml b/bors.toml index 3ccbdc008..6144eca54 100644 --- a/bors.toml +++ b/bors.toml @@ -1,6 +1,8 @@ status = [ "ci/circleci: lint", "ci/circleci: test", + "ci/circleci: test-and-build", + "ci/circleci: test-and-build-macos", "ci/circleci: test-macos", "ci/circleci: test-rust-nightly", "continuous-integration/appveyor/branch" From 8850f3545c639a9b1f7f9db1115679ff4da99691 Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Fri, 5 Jul 2019 15:10:56 -0500 Subject: [PATCH 2/3] Update config to try test-and-build jobs on trying/staging --- .circleci/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index b608db640..23fb8a778 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -406,11 +406,15 @@ workflows: filters: branches: only: + - trying + - staging - master - test-and-build-macos: filters: branches: only: + - trying + - staging - master - test-rust-nightly: filters: From 84a30292175c982f5e3ca773b41115c6756e545c Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Fri, 5 Jul 2019 15:53:14 -0500 Subject: [PATCH 3/3] Add back imports used within feature scop --- src/bin/kwasmd.rs | 12 ++++++++++++ src/bin/wasmer.rs | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/bin/kwasmd.rs b/src/bin/kwasmd.rs index 2a8b65f8f..d7c05d48d 100644 --- a/src/bin/kwasmd.rs +++ b/src/bin/kwasmd.rs @@ -24,12 +24,17 @@ struct Listen { socket: String, } +#[cfg(feature = "loader:kernel")] const CMD_RUN_CODE: u32 = 0x901; +#[cfg(feature = "loader:kernel")] const CMD_READ_MEMORY: u32 = 0x902; +#[cfg(feature = "loader:kernel")] const CMD_WRITE_MEMORY: u32 = 0x903; #[cfg(feature = "loader:kernel")] fn handle_client(mut stream: UnixStream) { + use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; + use std::io::{Read, Write}; let binary_size = stream.read_u32::().unwrap(); if binary_size > 1048576 * 16 { println!("binary too large"); @@ -38,6 +43,11 @@ fn handle_client(mut stream: UnixStream) { let mut wasm_binary: Vec = Vec::with_capacity(binary_size as usize); unsafe { wasm_binary.set_len(binary_size as usize) }; stream.read_exact(&mut wasm_binary).unwrap(); + use wasmer::webassembly; + use wasmer_runtime_core::{ + backend::{CompilerConfig, MemoryBoundCheckMode}, + loader::Instance, + }; let module = webassembly::compile_with_config_with( &wasm_binary[..], CompilerConfig { @@ -72,6 +82,7 @@ fn handle_client(mut stream: UnixStream) { println!("Too many arguments"); return; } + use wasmer_runtime::Value; let mut args: Vec = Vec::with_capacity(arg_count as usize); for _ in 0..arg_count { args.push(Value::I64(stream.read_u64::().unwrap() as _)); @@ -123,6 +134,7 @@ fn handle_client(mut stream: UnixStream) { #[cfg(feature = "loader:kernel")] fn run_listen(opts: Listen) { let listener = UnixListener::bind(&opts.socket).unwrap(); + use std::thread; for stream in listener.incoming() { match stream { Ok(stream) => { diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index a1ef390db..54625072a 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -505,7 +505,8 @@ fn execute_wasm(options: &Run) -> Result<(), String> { mapped_dirs, ); - let instance = module + #[allow(unused_mut)] // mut used in feature + let mut instance = module .instantiate(&import_object) .map_err(|e| format!("Can't instantiate module: {:?}", e))?;