10
build.rs
10
build.rs
@@ -157,11 +157,9 @@ fn write_testsuite_tests(
|
|||||||
writeln!(out, "#[test]")?;
|
writeln!(out, "#[test]")?;
|
||||||
if x64_should_panic(testsuite, &testname, strategy) {
|
if x64_should_panic(testsuite, &testname, strategy) {
|
||||||
writeln!(out, r#"#[should_panic]"#)?;
|
writeln!(out, r#"#[should_panic]"#)?;
|
||||||
} else if ignore(testsuite, &testname, strategy) {
|
// Ignore when using QEMU for running tests (limited memory).
|
||||||
|
} else if ignore(testsuite, &testname, strategy) || (pooling && platform_is_emulated()) {
|
||||||
writeln!(out, "#[ignore]")?;
|
writeln!(out, "#[ignore]")?;
|
||||||
} else if pooling {
|
|
||||||
// Ignore on aarch64 due to using QEMU for running tests (limited memory)
|
|
||||||
writeln!(out, r#"#[cfg_attr(target_arch = "aarch64", ignore)]"#)?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
writeln!(
|
writeln!(
|
||||||
@@ -254,3 +252,7 @@ fn platform_is_x64() -> bool {
|
|||||||
fn platform_is_s390x() -> bool {
|
fn platform_is_s390x() -> bool {
|
||||||
env::var("CARGO_CFG_TARGET_ARCH").unwrap() == "s390x"
|
env::var("CARGO_CFG_TARGET_ARCH").unwrap() == "s390x"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn platform_is_emulated() -> bool {
|
||||||
|
env::var("WASMTIME_TEST_NO_HOG_MEMORY").unwrap_or_default() == "1"
|
||||||
|
}
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ fn ensure_supported_elf_format(bytes: &[u8]) -> Result<Endianness, Error> {
|
|||||||
let e = header.endian().unwrap();
|
let e = header.endian().unwrap();
|
||||||
|
|
||||||
match header.e_machine.get(e) {
|
match header.e_machine.get(e) {
|
||||||
|
EM_AARCH64 => (),
|
||||||
EM_X86_64 => (),
|
EM_X86_64 => (),
|
||||||
EM_S390 => (),
|
EM_S390 => (),
|
||||||
machine => {
|
machine => {
|
||||||
|
|||||||
@@ -1666,10 +1666,14 @@ mod test {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg_attr(target_arch = "aarch64", ignore)] // https://github.com/bytecodealliance/wasmtime/pull/2518#issuecomment-747280133
|
|
||||||
#[cfg(all(unix, target_pointer_width = "64", feature = "async"))]
|
#[cfg(all(unix, target_pointer_width = "64", feature = "async"))]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_stack_zeroed() -> Result<()> {
|
fn test_stack_zeroed() -> Result<()> {
|
||||||
|
// https://github.com/bytecodealliance/wasmtime/pull/2518#issuecomment-747280133
|
||||||
|
if std::env::var("WASMTIME_TEST_NO_HOG_MEMORY").is_ok() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let allocator = PoolingInstanceAllocator::new(
|
let allocator = PoolingInstanceAllocator::new(
|
||||||
PoolingAllocationStrategy::NextAvailable,
|
PoolingAllocationStrategy::NextAvailable,
|
||||||
ModuleLimits {
|
ModuleLimits {
|
||||||
|
|||||||
@@ -673,7 +673,6 @@ mod test {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_isa_flags_mismatch() -> Result<()> {
|
fn test_isa_flags_mismatch() -> Result<()> {
|
||||||
let engine = Engine::default();
|
let engine = Engine::default();
|
||||||
|
|||||||
@@ -455,9 +455,6 @@ fn func_write_nothing() -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
// Note: Cranelift only supports refrerence types (used in the wasm in this
|
|
||||||
// test) on x64.
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
fn return_cross_store_value() -> anyhow::Result<()> {
|
fn return_cross_store_value() -> anyhow::Result<()> {
|
||||||
let wasm = wat::parse_str(
|
let wasm = wat::parse_str(
|
||||||
r#"
|
r#"
|
||||||
@@ -490,9 +487,6 @@ fn return_cross_store_value() -> anyhow::Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
// Note: Cranelift only supports refrerence types (used in the wasm in this
|
|
||||||
// test) on x64.
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
fn pass_cross_store_arg() -> anyhow::Result<()> {
|
fn pass_cross_store_arg() -> anyhow::Result<()> {
|
||||||
let mut config = Config::new();
|
let mut config = Config::new();
|
||||||
config.wasm_reference_types(true);
|
config.wasm_reference_types(true);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ fn instantiate_empty_module_with_memory() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1523)
|
|
||||||
fn instantiate_module_that_compiled_to_x64_has_register_32() {
|
fn instantiate_module_that_compiled_to_x64_has_register_32() {
|
||||||
let mut config = Config::new();
|
let mut config = Config::new();
|
||||||
config.debug_info(true);
|
config.debug_info(true);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use super::ref_types_module;
|
use super::ref_types_module;
|
||||||
|
use super::skip_pooling_allocator_tests;
|
||||||
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering::SeqCst};
|
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering::SeqCst};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use wasmtime::*;
|
use wasmtime::*;
|
||||||
@@ -237,9 +238,12 @@ fn drop_externref_via_table_set() -> anyhow::Result<()> {
|
|||||||
#[test]
|
#[test]
|
||||||
fn global_drops_externref() -> anyhow::Result<()> {
|
fn global_drops_externref() -> anyhow::Result<()> {
|
||||||
test_engine(&Engine::default())?;
|
test_engine(&Engine::default())?;
|
||||||
|
|
||||||
|
if !skip_pooling_allocator_tests() {
|
||||||
test_engine(&Engine::new(
|
test_engine(&Engine::new(
|
||||||
Config::new().allocation_strategy(InstanceAllocationStrategy::pooling()),
|
Config::new().allocation_strategy(InstanceAllocationStrategy::pooling()),
|
||||||
)?)?;
|
)?)?;
|
||||||
|
}
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
|
||||||
@@ -284,9 +288,12 @@ fn global_drops_externref() -> anyhow::Result<()> {
|
|||||||
#[cfg(not(feature = "old-x86-backend"))] // uses atomic instrs not implemented here
|
#[cfg(not(feature = "old-x86-backend"))] // uses atomic instrs not implemented here
|
||||||
fn table_drops_externref() -> anyhow::Result<()> {
|
fn table_drops_externref() -> anyhow::Result<()> {
|
||||||
test_engine(&Engine::default())?;
|
test_engine(&Engine::default())?;
|
||||||
|
|
||||||
|
if !skip_pooling_allocator_tests() {
|
||||||
test_engine(&Engine::new(
|
test_engine(&Engine::new(
|
||||||
Config::new().allocation_strategy(InstanceAllocationStrategy::pooling()),
|
Config::new().allocation_strategy(InstanceAllocationStrategy::pooling()),
|
||||||
)?)?;
|
)?)?;
|
||||||
|
}
|
||||||
|
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ mod debug;
|
|||||||
mod externals;
|
mod externals;
|
||||||
mod fuel;
|
mod fuel;
|
||||||
mod func;
|
mod func;
|
||||||
|
mod funcref;
|
||||||
mod fuzzing;
|
mod fuzzing;
|
||||||
|
mod gc;
|
||||||
mod globals;
|
mod globals;
|
||||||
mod host_funcs;
|
mod host_funcs;
|
||||||
mod iloop;
|
mod iloop;
|
||||||
@@ -29,14 +31,7 @@ mod table;
|
|||||||
mod traps;
|
mod traps;
|
||||||
mod wast;
|
mod wast;
|
||||||
|
|
||||||
// TODO(#1886): Cranelift only supports reference types on x64.
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
mod funcref;
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
mod gc;
|
|
||||||
|
|
||||||
/// A helper to compile a module in a new store with reference types enabled.
|
/// A helper to compile a module in a new store with reference types enabled.
|
||||||
#[cfg(target_arch = "x86_64")]
|
|
||||||
pub(crate) fn ref_types_module(
|
pub(crate) fn ref_types_module(
|
||||||
source: &str,
|
source: &str,
|
||||||
) -> anyhow::Result<(wasmtime::Store<()>, wasmtime::Module)> {
|
) -> anyhow::Result<(wasmtime::Store<()>, wasmtime::Module)> {
|
||||||
@@ -54,3 +49,11 @@ pub(crate) fn ref_types_module(
|
|||||||
|
|
||||||
Ok((store, module))
|
Ok((store, module))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A helper determining whether the pooling allocator tests should be skipped.
|
||||||
|
pub(crate) fn skip_pooling_allocator_tests() -> bool {
|
||||||
|
// There are a couple of issues when running the pooling allocator tests under QEMU:
|
||||||
|
// - high memory usage that may exceed the limits imposed by the environment (e.g. CI)
|
||||||
|
// - https://github.com/bytecodealliance/wasmtime/pull/2518#issuecomment-747280133
|
||||||
|
std::env::var("WASMTIME_TEST_NO_HOG_MEMORY").is_ok()
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use super::skip_pooling_allocator_tests;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use wasmtime::*;
|
use wasmtime::*;
|
||||||
|
|
||||||
@@ -187,8 +188,11 @@ fn memory_guard_page_trap() -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_arch = "aarch64", ignore)] // https://github.com/bytecodealliance/wasmtime/pull/2518#issuecomment-747280133
|
|
||||||
fn memory_zeroed() -> Result<()> {
|
fn memory_zeroed() -> Result<()> {
|
||||||
|
if skip_pooling_allocator_tests() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let mut config = Config::new();
|
let mut config = Config::new();
|
||||||
config.allocation_strategy(InstanceAllocationStrategy::Pooling {
|
config.allocation_strategy(InstanceAllocationStrategy::Pooling {
|
||||||
strategy: PoolingAllocationStrategy::NextAvailable,
|
strategy: PoolingAllocationStrategy::NextAvailable,
|
||||||
@@ -357,8 +361,11 @@ fn table_init() -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(target_arch = "aarch64", ignore)] // https://github.com/bytecodealliance/wasmtime/pull/2518#issuecomment-747280133
|
|
||||||
fn table_zeroed() -> Result<()> {
|
fn table_zeroed() -> Result<()> {
|
||||||
|
if skip_pooling_allocator_tests() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
let mut config = Config::new();
|
let mut config = Config::new();
|
||||||
config.allocation_strategy(InstanceAllocationStrategy::Pooling {
|
config.allocation_strategy(InstanceAllocationStrategy::Pooling {
|
||||||
strategy: PoolingAllocationStrategy::NextAvailable,
|
strategy: PoolingAllocationStrategy::NextAvailable,
|
||||||
|
|||||||
Reference in New Issue
Block a user