machinst x64: add testing to the CI;

This commit is contained in:
Benjamin Bouvier
2020-07-29 18:08:35 +02:00
parent 39ea64140f
commit 79abcdb035
11 changed files with 87 additions and 2 deletions

View File

@@ -269,6 +269,45 @@ jobs:
env: env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
# Perform all tests (debug mode) for `wasmtime` with the experimental x64
# backend. This runs on the nightly channel of Rust (because of issues with
# unifying Cargo features on stable) on Ubuntu.
test_x64:
name: Test x64 new backend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: ./.github/actions/install-rust
with:
toolchain: nightly-2020-07-27
- uses: ./.github/actions/define-llvm-env
# Install wasm32 targets in order to build various tests throughout the
# repo
- run: rustup target add wasm32-wasi
- run: rustup target add wasm32-unknown-unknown
# Build and test all features except for lightbeam
- run: |
cargo \
-Zfeatures=all -Zpackage-features \
test \
--features test-programs/test_programs \
--features experimental_x64 \
--all \
--exclude lightbeam \
--exclude peepmatic \
--exclude peepmatic-automata \
--exclude peepmatic-fuzzing \
--exclude peepmatic-macro \
--exclude peepmatic-runtime \
--exclude peepmatic-test
env:
RUST_BACKTRACE: 1
# Verify that cranelift's code generation is deterministic # Verify that cranelift's code generation is deterministic
meta_determinist_check: meta_determinist_check:
name: Meta deterministic check name: Meta deterministic check

View File

@@ -151,7 +151,12 @@ fn write_testsuite_tests(
let testname = extract_name(path); let testname = extract_name(path);
writeln!(out, "#[test]")?; writeln!(out, "#[test]")?;
if ignore(testsuite, &testname, strategy) { if experimental_x64_should_panic(testsuite, &testname, strategy) {
writeln!(
out,
r#"#[cfg_attr(feature = "experimental_x64", should_panic)]"#
)?;
} else if ignore(testsuite, &testname, strategy) {
writeln!(out, "#[ignore]")?; writeln!(out, "#[ignore]")?;
} }
writeln!(out, "fn r#{}() {{", &testname)?; writeln!(out, "fn r#{}() {{", &testname)?;
@@ -167,6 +172,21 @@ fn write_testsuite_tests(
Ok(()) Ok(())
} }
/// For experimental_x64 backend features that are not supported yet, mark tests as panicking, so
/// they stop "passing" once the features are properly implemented.
fn experimental_x64_should_panic(testsuite: &str, testname: &str, strategy: &str) -> bool {
if !cfg!(feature = "experimental_x64") || strategy != "Cranelift" {
return false;
}
match (testsuite, testname) {
("simd", _) => return true,
_ => {}
}
false
}
/// Ignore tests that aren't supported yet. /// Ignore tests that aren't supported yet.
fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool { fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool {
let target = env::var("TARGET").unwrap(); let target = env::var("TARGET").unwrap();

View File

@@ -347,7 +347,7 @@ fn lower_insn_to_regs<C: LowerCtx<I = Inst>>(
}; };
match op { match op {
Opcode::Iconst | Opcode::Null => { Opcode::Iconst | Opcode::Bconst | Opcode::Null => {
if let Some(w64) = iri_to_u64_imm(ctx, insn) { if let Some(w64) = iri_to_u64_imm(ctx, insn) {
let dst_is_64 = w64 > 0x7fffffff; let dst_is_64 = w64 > 0x7fffffff;
let dst = output_to_reg(ctx, outputs[0]); let dst = output_to_reg(ctx, outputs[0]);

View File

@@ -397,6 +397,7 @@ mod tests {
use target_lexicon::triple; use target_lexicon::triple;
#[test] #[test]
#[cfg_attr(feature = "x64", should_panic)] // TODO #2079
fn test_simple_func() { fn test_simple_func() {
let isa = lookup(triple!("x86_64")) let isa = lookup(triple!("x86_64"))
.expect("expect x86 ISA") .expect("expect x86 ISA")
@@ -439,6 +440,7 @@ mod tests {
} }
#[test] #[test]
#[cfg_attr(feature = "x64", should_panic)] // TODO #2079
fn test_multi_return_func() { fn test_multi_return_func() {
let isa = lookup(triple!("x86_64")) let isa = lookup(triple!("x86_64"))
.expect("expect x86 ISA") .expect("expect x86 ISA")

View File

@@ -158,6 +158,7 @@ mod tests {
} }
#[test] #[test]
#[cfg_attr(feature = "x64", should_panic)] // TODO #2079
fn test_small_alloc() { fn test_small_alloc() {
let isa = lookup(triple!("x86_64")) let isa = lookup(triple!("x86_64"))
.expect("expect x86 ISA") .expect("expect x86 ISA")
@@ -215,6 +216,7 @@ mod tests {
} }
#[test] #[test]
#[cfg_attr(feature = "x64", should_panic)] // TODO #2079
fn test_medium_alloc() { fn test_medium_alloc() {
let isa = lookup(triple!("x86_64")) let isa = lookup(triple!("x86_64"))
.expect("expect x86 ISA") .expect("expect x86 ISA")
@@ -276,6 +278,7 @@ mod tests {
} }
#[test] #[test]
#[cfg_attr(feature = "x64", should_panic)] // TODO #2079
fn test_large_alloc() { fn test_large_alloc() {
let isa = lookup(triple!("x86_64")) let isa = lookup(triple!("x86_64"))
.expect("expect x86 ISA") .expect("expect x86 ISA")

View File

@@ -1,4 +1,5 @@
#[test] #[test]
#[cfg_attr(feature = "experimental_x64", should_panic)] // TODO #2079
fn filetests() { fn filetests() {
// Run all the filetests in the following directories. // Run all the filetests in the following directories.
cranelift_filetests::run(false, false, &["filetests".into(), "docs".into()]) cranelift_filetests::run(false, false, &["filetests".into(), "docs".into()])

View File

@@ -14,6 +14,12 @@ include = ["src/**/*", "LICENSE"]
proc-macro = true proc-macro = true
test = false test = false
# This has been added to make testing of the experimental_x64 feature possible,
# working around a Cargo nightly bug: once
# https://github.com/rust-lang/cargo/issues/8563 has been fixed, we should be
# able to revert it.
doctest = false
[dependencies] [dependencies]
wiggle-generate = { path = "../generate", version = "0.19.0" } wiggle-generate = { path = "../generate", version = "0.19.0" }
witx = { path = "../../wasi-common/WASI/tools/witx", version = "0.8.5" } witx = { path = "../../wasi-common/WASI/tools/witx", version = "0.8.5" }

View File

@@ -373,6 +373,7 @@ fn gc_during_gc_when_passing_refs_into_wasm() -> anyhow::Result<()> {
} }
#[test] #[test]
#[cfg_attr(feature = "experimental_x64", ignore)] // TODO #2079 investigate.
fn gc_during_gc_from_many_table_gets() -> anyhow::Result<()> { fn gc_during_gc_from_many_table_gets() -> anyhow::Result<()> {
let (store, module) = ref_types_module( let (store, module) = ref_types_module(
r#" r#"

View File

@@ -99,6 +99,7 @@ fn loop_interrupt_from_afar() -> anyhow::Result<()> {
} }
#[test] #[test]
#[cfg_attr(feature = "experimental_x64", ignore)] // TODO #2079 interrupts in wasmtime
fn function_interrupt_from_afar() -> anyhow::Result<()> { fn function_interrupt_from_afar() -> anyhow::Result<()> {
// Create an instance which calls an imported function on each iteration of // Create an instance which calls an imported function on each iteration of
// the loop so we can count the number of loop iterations we've executed so // the loop so we can count the number of loop iterations we've executed so

View File

@@ -2,6 +2,7 @@ use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
use wasmtime::*; use wasmtime::*;
#[test] #[test]
#[cfg_attr(feature = "experimental_x64", ignore)] // TODO #2079 require probe stacks
fn host_always_has_some_stack() -> anyhow::Result<()> { fn host_always_has_some_stack() -> anyhow::Result<()> {
static HITS: AtomicUsize = AtomicUsize::new(0); static HITS: AtomicUsize = AtomicUsize::new(0);
// assume hosts always have at least 512k of stack // assume hosts always have at least 512k of stack

View File

@@ -32,6 +32,7 @@ fn test_trap_return() -> Result<()> {
#[test] #[test]
#[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642) #[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642)
#[cfg_attr(feature = "experimental_x64", ignore)] // FIXME(#2078)
fn test_trap_trace() -> Result<()> { fn test_trap_trace() -> Result<()> {
let store = Store::default(); let store = Store::default();
let wat = r#" let wat = r#"
@@ -74,6 +75,7 @@ fn test_trap_trace() -> Result<()> {
#[test] #[test]
#[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642) #[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642)
#[cfg_attr(feature = "experimental_x64", ignore)] // FIXME(#2078)
fn test_trap_trace_cb() -> Result<()> { fn test_trap_trace_cb() -> Result<()> {
let store = Store::default(); let store = Store::default();
let wat = r#" let wat = r#"
@@ -110,6 +112,7 @@ fn test_trap_trace_cb() -> Result<()> {
#[test] #[test]
#[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642) #[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642)
#[cfg_attr(feature = "experimental_x64", ignore)] // FIXME(#2078)
fn test_trap_stack_overflow() -> Result<()> { fn test_trap_stack_overflow() -> Result<()> {
let store = Store::default(); let store = Store::default();
let wat = r#" let wat = r#"
@@ -142,6 +145,7 @@ fn test_trap_stack_overflow() -> Result<()> {
#[test] #[test]
#[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642) #[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642)
#[cfg_attr(feature = "experimental_x64", ignore)] // FIXME(#2078)
fn trap_display_pretty() -> Result<()> { fn trap_display_pretty() -> Result<()> {
let store = Store::default(); let store = Store::default();
let wat = r#" let wat = r#"
@@ -174,6 +178,7 @@ wasm backtrace:
#[test] #[test]
#[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642) #[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642)
#[cfg_attr(feature = "experimental_x64", ignore)] // FIXME(#2078)
fn trap_display_multi_module() -> Result<()> { fn trap_display_multi_module() -> Result<()> {
let store = Store::default(); let store = Store::default();
let wat = r#" let wat = r#"
@@ -219,6 +224,7 @@ wasm backtrace:
#[test] #[test]
#[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642) #[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642)
#[cfg_attr(feature = "experimental_x64", ignore)] // FIXME(#2078)
fn trap_start_function_import() -> Result<()> { fn trap_start_function_import() -> Result<()> {
let store = Store::default(); let store = Store::default();
let binary = wat::parse_str( let binary = wat::parse_str(
@@ -246,6 +252,7 @@ fn trap_start_function_import() -> Result<()> {
#[test] #[test]
#[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642) #[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642)
#[cfg_attr(feature = "experimental_x64", ignore)] // FIXME(#2078)
fn rust_panic_import() -> Result<()> { fn rust_panic_import() -> Result<()> {
let store = Store::default(); let store = Store::default();
let binary = wat::parse_str( let binary = wat::parse_str(
@@ -291,6 +298,7 @@ fn rust_panic_import() -> Result<()> {
#[test] #[test]
#[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642) #[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642)
#[cfg_attr(feature = "experimental_x64", ignore)] // FIXME(#2078)
fn rust_panic_start_function() -> Result<()> { fn rust_panic_start_function() -> Result<()> {
let store = Store::default(); let store = Store::default();
let binary = wat::parse_str( let binary = wat::parse_str(
@@ -325,6 +333,7 @@ fn rust_panic_start_function() -> Result<()> {
#[test] #[test]
#[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642) #[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642)
#[cfg_attr(feature = "experimental_x64", ignore)] // FIXME(#2078)
fn mismatched_arguments() -> Result<()> { fn mismatched_arguments() -> Result<()> {
let store = Store::default(); let store = Store::default();
let binary = wat::parse_str( let binary = wat::parse_str(
@@ -357,6 +366,7 @@ fn mismatched_arguments() -> Result<()> {
#[test] #[test]
#[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642) #[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642)
#[cfg_attr(feature = "experimental_x64", ignore)] // FIXME(#2078)
fn call_signature_mismatch() -> Result<()> { fn call_signature_mismatch() -> Result<()> {
let store = Store::default(); let store = Store::default();
let binary = wat::parse_str( let binary = wat::parse_str(
@@ -388,6 +398,7 @@ fn call_signature_mismatch() -> Result<()> {
#[test] #[test]
#[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642) #[cfg_attr(target_arch = "aarch64", ignore)] // FIXME(#1642)
#[cfg_attr(feature = "experimental_x64", ignore)] // FIXME(#2078)
fn start_trap_pretty() -> Result<()> { fn start_trap_pretty() -> Result<()> {
let store = Store::default(); let store = Store::default();
let wat = r#" let wat = r#"