Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
1368: Fix issue with `kernel-net`; add it to CI r=MarkMcCaskey a=MarkMcCaskey

Resolves wasmerio#1365 


Co-authored-by: Mark McCaskey <[email protected]>
  • Loading branch information
bors[bot] and Mark McCaskey authored Apr 9, 2020
2 parents 3474c31 + 23bc0fd commit 1ef2fe3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
1 change: 1 addition & 0 deletions .azure/install-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ steps:
rustup update --no-self-update $RUST_TOOLCHAIN
rustup default $RUST_TOOLCHAIN
rustup target add x86_64-unknown-linux-musl
rustup target add wasm32-wasi
if [ -n "$ANDROID" ]; then
rustup target add x86_64-linux-android --toolchain $RUST_TOOLCHAIN
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ check-bench-llvm:

check-bench: check-bench-singlepass check-bench-llvm

check-kernel-net:
cargo check -p kernel-net --target=wasm32-wasi

# checks that require a nightly version of Rust
check-nightly: check-kernel-net

# TODO: We wanted `--workspace --exclude wasmer-runtime`, but can't due
# to https://github.com/rust-lang/cargo/issues/6745 .
NOT_RUNTIME_CRATES = -p wasmer-clif-backend -p wasmer-singlepass-backend -p wasmer-middleware-common -p wasmer-runtime-core -p wasmer-emscripten -p wasmer-llvm-backend -p wasmer-wasi -p wasmer-kernel-loader -p wasmer-interface-types
Expand Down
4 changes: 3 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ jobs:
- template: .azure/install-llvm.yml
- template: .azure/install-sccache.yml
- template: .azure/install-cmake.yml
- bash: make check
- bash: |
make check
make check-nightly
displayName: Check with Flags
condition: and(succeeded(), not(eq(variables['Agent.OS'], 'Windows_NT')))
Expand Down
10 changes: 5 additions & 5 deletions lib/kernel-net/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ thread_local! {

#[derive(Default)]
struct AsyncState {
callback: Option<Box<FnOnce()>>,
callback: Option<Box<dyn FnOnce()>>,
_epoll: Option<Arc<Epoll>>,
}

pub struct Epoll {
fd: i32,
imm_queue: Mutex<Vec<Box<FnOnce()>>>,
imm_queue: Mutex<Vec<Box<dyn FnOnce()>>>,
}

impl Epoll {
Expand Down Expand Up @@ -163,7 +163,7 @@ fn get_async_io_payload<
direction: EpollDirection,
poll_action: P,
on_ready: F,
) -> Box<FnOnce()> {
) -> Box<dyn FnOnce()> {
__get_async_io_payload(epoll, fd, direction, poll_action, on_ready, false)
}

Expand All @@ -178,7 +178,7 @@ fn __get_async_io_payload<
mut poll_action: P,
on_ready: F,
registered: bool,
) -> Box<FnOnce()> {
) -> Box<dyn FnOnce()> {
let epfd = epoll.fd;
Box::new(move || {
//println!("async io payload");
Expand Down Expand Up @@ -230,7 +230,7 @@ struct SockaddrIn {
}

#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Default, Copy, Clone)]
struct InAddr {
s_addr: u32,
}
Expand Down
8 changes: 4 additions & 4 deletions lib/runtime-core/src/memory/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ mod test {
assert!(unsafe { end_wasm_ptr_array.deref_mut(&memory, 0, 1).is_some() });
let invalid_idx_len_combos: [(u32, u32); 3] =
[(last_valid_address_for_u8 + 1, 0), (0, 2), (1, 1)];
for &(idx, len) in invalid_idx_len_combos.into_iter() {
for &(idx, len) in invalid_idx_len_combos.iter() {
assert!(end_wasm_ptr_array.deref(&memory, idx, len).is_none());
assert!(unsafe { end_wasm_ptr_array.deref_mut(&memory, idx, len).is_none() });
}
Expand All @@ -322,7 +322,7 @@ mod test {
WasmPtr::new(last_valid_address_for_u32 + 3),
WasmPtr::new(last_valid_address_for_u32 + 4),
];
for oob_end_ptr in end_wasm_ptr_oob_array.into_iter() {
for oob_end_ptr in end_wasm_ptr_oob_array.iter() {
assert!(oob_end_ptr.deref(&memory).is_none());
assert!(unsafe { oob_end_ptr.deref_mut(&memory).is_none() });
}
Expand All @@ -332,7 +332,7 @@ mod test {

let invalid_idx_len_combos: [(u32, u32); 3] =
[(last_valid_address_for_u32 + 1, 0), (0, 2), (1, 1)];
for &(idx, len) in invalid_idx_len_combos.into_iter() {
for &(idx, len) in invalid_idx_len_combos.iter() {
assert!(end_wasm_ptr_array.deref(&memory, idx, len).is_none());
assert!(unsafe { end_wasm_ptr_array.deref_mut(&memory, idx, len).is_none() });
}
Expand All @@ -344,7 +344,7 @@ mod test {
WasmPtr::new(last_valid_address_for_u32 + 4),
];

for oob_end_array_ptr in end_wasm_ptr_array_oob_array.into_iter() {
for oob_end_array_ptr in end_wasm_ptr_array_oob_array.iter() {
assert!(oob_end_array_ptr.deref(&memory, 0, 1).is_none());
assert!(unsafe { oob_end_array_ptr.deref_mut(&memory, 0, 1).is_none() });
assert!(oob_end_array_ptr.deref(&memory, 1, 0).is_none());
Expand Down

0 comments on commit 1ef2fe3

Please sign in to comment.