Tweaks some tests for Mac aarch64

- some tests don't pass because of bad interactions with the system's
libunwind; ignore them for now.
- the page size on mac aarch64 is 16K, not 4K; tweak some tests which
were expecting 4K or multiples of 4K pages to use a multiple of host page size
instead.
- a cranelift-native test needed an update for the new calling convention.
This commit is contained in:
Benjamin Bouvier
2021-04-06 16:23:58 +02:00
parent 6b77786a6e
commit 7588565078
3 changed files with 27 additions and 10 deletions

View File

@@ -137,18 +137,20 @@ mod tests {
if let Ok(isa_builder) = builder() {
let flag_builder = settings::builder();
let isa = isa_builder.finish(settings::Flags::new(flag_builder));
if cfg!(any(unix, target_os = "nebulet")) {
if cfg!(all(target_os = "macos", target_arch = "aarch64")) {
assert_eq!(isa.default_call_conv(), CallConv::AppleAarch64);
} else if cfg!(any(unix, target_os = "nebulet")) {
assert_eq!(isa.default_call_conv(), CallConv::SystemV);
} else if cfg!(windows) {
assert_eq!(isa.default_call_conv(), CallConv::WindowsFastcall);
}
if cfg!(target_pointer_width = "64") {
assert_eq!(isa.pointer_bits(), 64);
}
if cfg!(target_pointer_width = "32") {
} else if cfg!(target_pointer_width = "32") {
assert_eq!(isa.pointer_bits(), 32);
}
if cfg!(target_pointer_width = "16") {
} else if cfg!(target_pointer_width = "16") {
assert_eq!(isa.pointer_bits(), 16);
}
}

View File

@@ -1341,7 +1341,9 @@ mod test {
assert_eq!(instances.offsets.num_defined_tables, 1);
assert_eq!(instances.offsets.num_defined_memories, 1);
assert_eq!(instances.offsets.num_defined_globals, 0);
assert_eq!(instances.instance_size, 4096);
// As of April 2021, the instance struct's size is largely below the size of a single page,
// so it's safe to assume it's been rounded to the size of a single memory page here.
assert_eq!(instances.instance_size, region::page::size());
assert_eq!(instances.max_instances, 3);
assert_eq!(&*instances.free_list.lock().unwrap(), &[0, 1, 2]);
@@ -1477,10 +1479,12 @@ mod test {
},
)?;
assert_eq!(pool.table_size, 4096);
let host_page_size = region::page::size();
assert_eq!(pool.table_size, host_page_size);
assert_eq!(pool.max_tables, 4);
assert_eq!(pool.max_instances, 7);
assert_eq!(pool.page_size, 4096);
assert_eq!(pool.page_size, host_page_size);
assert_eq!(pool.max_elements, 100);
let base = pool.mapping.as_ptr() as usize;
@@ -1512,9 +1516,10 @@ mod test {
1,
)?;
assert_eq!(pool.stack_size, 8192);
let native_page_size = region::page::size();
assert_eq!(pool.stack_size, 2 * native_page_size);
assert_eq!(pool.max_instances, 10);
assert_eq!(pool.page_size, 4096);
assert_eq!(pool.page_size, native_page_size);
assert_eq!(
&*pool.free_list.lock().unwrap(),

View File

@@ -27,6 +27,7 @@ fn test_trap_return() -> Result<()> {
}
#[test]
#[cfg_attr(all(target_os = "macos", target_arch = "aarch64"), ignore)] // TODO #2808 system libunwind is broken on aarch64
fn test_trap_trace() -> Result<()> {
let store = Store::default();
let wat = r#"
@@ -64,6 +65,7 @@ fn test_trap_trace() -> Result<()> {
}
#[test]
#[cfg_attr(all(target_os = "macos", target_arch = "aarch64"), ignore)] // TODO #2808 system libunwind is broken on aarch64
fn test_trap_trace_cb() -> Result<()> {
let store = Store::default();
let wat = r#"
@@ -95,6 +97,7 @@ fn test_trap_trace_cb() -> Result<()> {
}
#[test]
#[cfg_attr(all(target_os = "macos", target_arch = "aarch64"), ignore)] // TODO #2808 system libunwind is broken on aarch64
fn test_trap_stack_overflow() -> Result<()> {
let store = Store::default();
let wat = r#"
@@ -122,6 +125,7 @@ fn test_trap_stack_overflow() -> Result<()> {
}
#[test]
#[cfg_attr(all(target_os = "macos", target_arch = "aarch64"), ignore)] // TODO #2808 system libunwind is broken on aarch64
fn trap_display_pretty() -> Result<()> {
let store = Store::default();
let wat = r#"
@@ -153,6 +157,7 @@ wasm backtrace:
}
#[test]
#[cfg_attr(all(target_os = "macos", target_arch = "aarch64"), ignore)] // TODO #2808 system libunwind is broken on aarch64
fn trap_display_multi_module() -> Result<()> {
let store = Store::default();
let wat = r#"
@@ -358,6 +363,7 @@ fn call_signature_mismatch() -> Result<()> {
}
#[test]
#[cfg_attr(all(target_os = "macos", target_arch = "aarch64"), ignore)] // TODO #2808 system libunwind is broken on aarch64
fn start_trap_pretty() -> Result<()> {
let store = Store::default();
let wat = r#"
@@ -391,6 +397,7 @@ wasm backtrace:
}
#[test]
#[cfg_attr(all(target_os = "macos", target_arch = "aarch64"), ignore)] // TODO #2808 system libunwind is broken on aarch64
fn present_after_module_drop() -> Result<()> {
let store = Store::default();
let module = Module::new(store.engine(), r#"(func (export "foo") unreachable)"#)?;
@@ -474,6 +481,7 @@ fn rustc(src: &str) -> Vec<u8> {
}
#[test]
#[cfg_attr(all(target_os = "macos", target_arch = "aarch64"), ignore)] // TODO #2808 system libunwind is broken on aarch64
fn parse_dwarf_info() -> Result<()> {
let wasm = rustc(
"
@@ -516,6 +524,7 @@ fn parse_dwarf_info() -> Result<()> {
}
#[test]
#[cfg_attr(all(target_os = "macos", target_arch = "aarch64"), ignore)] // TODO #2808 system libunwind is broken on aarch64
fn no_hint_even_with_dwarf_info() -> Result<()> {
let mut config = Config::new();
config.wasm_backtrace_details(WasmBacktraceDetails::Disable);
@@ -548,6 +557,7 @@ wasm backtrace:
}
#[test]
#[cfg_attr(all(target_os = "macos", target_arch = "aarch64"), ignore)] // TODO #2808 system libunwind is broken on aarch64
fn hint_with_dwarf_info() -> Result<()> {
// Skip this test if the env var is already configure, but in CI we're sure
// to run tests without this env var configured.