Skip to content

Commit

Permalink
Fix up tests for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark McCaskey committed Apr 6, 2020
1 parent dfa6247 commit 52cbb60
Show file tree
Hide file tree
Showing 53 changed files with 365 additions and 172 deletions.
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,18 @@ generate: generate-emtests generate-wasitests

# Spectests
spectests-singlepass:
cargo test test_run_spectests --release --no-default-features --features "wasi backend-singlepass" -- --nocapture --test-threads 1
SPECTEST_TEST_SINGLEPASS=1 cargo test test_run_spectests --release --no-default-features --features "wasi backend-singlepass" -- --nocapture --test-threads 1

spectests-cranelift:
cargo test test_run_spectests --release --no-default-features --features "wasi backend-cranelift" -- --nocapture

spectests-llvm:
cargo test test_run_spectests --release --no-default-features --features "wasi backend-llvm" -- --nocapture
SPECTEST_TEST_LLVM=1 cargo test test_run_spectests --release --no-default-features --features "wasi backend-llvm wasmer-llvm-backend/test" -- --nocapture

spectests-all:
SPECTEST_TEST_CLIF=1 SPECTEST_TEST_LLVM=1 SPECTEST_TEST_SINGLEPASS=1 \
cargo test test_run_spectests --release --no-default-features --features "wasi backend-cranelift backend-singlepass backend-llvm wasmer-llvm-backend/test" -- --nocapture --test-threads 1


spectests: spectests-singlepass spectests-cranelift spectests-llvm

Expand Down Expand Up @@ -81,7 +86,7 @@ wasitests-setup:
mkdir -p tests/wasi_test_resources/test_fs/temp

wasitests-singlepass: wasitests-setup
cargo test wasitest --release --no-default-features --features "wasi singlepass" -- --test-threads=1
cargo test wasitest --release --no-default-features --features "wasi backend-singlepass" -- --test-threads=1

wasitests-cranelift: wasitests-setup
cargo test wasitest --release --no-default-features --features "wasi backend-cranelift" -- --test-threads=1 --nocapture
Expand Down
1 change: 1 addition & 0 deletions benches/metering_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ fn get_compiler(limit: u64, metering: bool) -> impl Compiler {
)))]
compile_error!("compiler not specified, activate a compiler via features");

#[cfg(feature = "backend-cranelift")]
fn get_compiler(_limit: u64, metering: bool) -> impl Compiler {
unimplemented!("cranelift does not implement metering");
use wasmer_clif_backend::CraneliftCompiler;
Expand Down
1 change: 1 addition & 0 deletions ci/docker/x86_64-linux-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ RUN apt-get update && \
ca-certificates \
curl \
gcc \
g++ \
libc-dev \
python \
unzip \
Expand Down
8 changes: 5 additions & 3 deletions lib/emscripten/src/syscalls/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@ extern "C" {
pub fn lstat(path: *const libc::c_char, buf: *mut stat) -> c_int;
}

#[cfg(not(any(target_os = "freebsd", target_os = "macos", target_os = "android")))]
use libc::fallocate;
#[cfg(target_os = "freebsd")]
use libc::madvise;
#[cfg(not(any(target_os = "freebsd", target_os = "macos")))]
use libc::{fallocate, fdatasync, ftruncate64, lstat, madvise, wait4};
use libc::{fdatasync, ftruncate64, lstat, madvise, wait4};

// Another conditional constant for name resolution: Macos et iOS use
// SO_NOSIGPIPE as a setsockopt flag to disable SIGPIPE emission on socket.
Expand Down Expand Up @@ -1131,11 +1133,11 @@ pub fn ___syscall324(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_in
let _mode: c_int = varargs.get(ctx);
let _offset: off_t = varargs.get(ctx);
let _len: off_t = varargs.get(ctx);
#[cfg(not(any(target_os = "freebsd", target_os = "macos")))]
#[cfg(not(any(target_os = "freebsd", target_os = "macos", target_os = "android")))]
unsafe {
fallocate(_fd, _mode, _offset, _len)
}
#[cfg(any(target_os = "freebsd", target_os = "macos"))]
#[cfg(any(target_os = "freebsd", target_os = "macos", target_os = "android"))]
{
unimplemented!("emscripten::___syscall324 (fallocate) {}", _which)
}
Expand Down
2 changes: 1 addition & 1 deletion lib/emscripten/src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use time;
use super::env;
use wasmer_runtime_core::vm::Ctx;

#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "android"))]
use libc::{CLOCK_MONOTONIC, CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME};

#[cfg(target_os = "freebsd")]
Expand Down
2 changes: 2 additions & 0 deletions tests/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const SHIFT: i32 = 10;
#[allow(non_upper_case_globals)]
const shift: i32 = 100;

#[cfg(all(unix, target_arch = "x86_64"))]
fn imported_functions_forms(test: &dyn Fn(&Instance)) {
const MODULE: &str = r#"
(module
Expand Down Expand Up @@ -391,6 +392,7 @@ fn callback_fn_trap_with_vmctx(vmctx: &mut vm::Ctx, n: i32) -> Result<i32, Strin

macro_rules! test {
($test_name:ident, $function:ident( $( $inputs:ty ),* ) -> $output:ty, ( $( $arguments:expr ),* ) == $expected_value:expr) => {
#[cfg(all(unix, target_arch = "x86_64"))]
#[test]
fn $test_name() {
imported_functions_forms(&|instance| {
Expand Down
Loading

0 comments on commit 52cbb60

Please sign in to comment.