next potion of tests added

This commit is contained in:
Svyatoslav Nikolsky
2017-06-09 12:13:35 +03:00
parent 0f1d63d77e
commit c8614bf6fe
10 changed files with 126 additions and 52 deletions

View File

@ -24,6 +24,27 @@ run_test!("f64_bitwise", wasm_f64_bitwise);
run_test!("forward", wasm_forward);
run_test!("i32", wasm_i32);
run_test!("i64", wasm_i64);
run_test!("memory", wasm_memory);
// TODO: fix comparison??? run_test!("names", wasm_names);
run_test!("nop", wasm_nop);
run_test!("of_string-overflow-hex-u32.fail", wasm_of_string_overflow_hex_u32_fail, fail);
run_test!("of_string-overflow-hex-u64.fail", wasm_of_string_overflow_hex_u64_fail, fail);
run_test!("of_string-overflow-s32.fail", wasm_of_string_overflow_s32_fail, fail);
run_test!("of_string-overflow-s64.fail", wasm_of_string_overflow_s64_fail, fail);
run_test!("of_string-overflow-u32.fail", wasm_of_string_overflow_u32_fail, fail);
run_test!("of_string-overflow-u64.fail", wasm_of_string_overflow_u64_fail, fail);
run_test!("resizing", wasm_resizing);
run_test!("return", wasm_return);
run_test!("select", wasm_select);
run_test!("set_local", wasm_set_local);
run_test!("skip-stack-guard-page", wasm_skip_stack_guard_page);
run_test!("stack", wasm_stack);
run_test!("start", wasm_start);
run_test!("store_retval", wasm_store_retval);
run_test!("store-align-0.fail", wasm_store_align_0_fail, fail);
run_test!("store-align-big.fail", wasm_store_align_big_fail, fail);
run_test!("store-align-odd.fail", wasm_store_align_odd_fail, fail);
run_test!("switch", wasm_switch);
run_test!("tee_local", wasm_tee_local);
run_test!("traps", wasm_traps);
run_test!("typecheck", wasm_typecheck);

View File

@ -18,10 +18,12 @@ use parity_wasm::interpreter::{
fn spec_test_module() -> elements::Module {
builder::module()
.function()
.signature().with_param(elements::ValueType::I32).build()
.signature().build()
.body().build()
.build()
.global().value_type().i32().init_expr(elements::Opcode::I32Const(0)).build()
.export().field("print").internal().func(0).build()
.export().field("global").internal().global(0).build()
.build()
}
@ -196,6 +198,13 @@ pub fn spec(name: &str) {
}
}
},
&test::Command::AssertExhaustion { line, ref action, .. } => {
let result = run_action(&*module.as_ref().unwrap(), action);
match result {
Ok(result) => panic!("Expected exhaustion, got result: {:?}", result),
Err(e) => println!("assert_exhaustion at line {} - success ({:?})", line, e),
}
},
&test::Command::AssertTrap { line, ref action, .. } => {
let result = run_action(&*module.as_ref().unwrap(), action);
match result {
@ -209,6 +218,7 @@ pub fn spec(name: &str) {
},
&test::Command::AssertInvalid { line, ref filename, .. }
| &test::Command::AssertMalformed { line, ref filename, .. }
| &test::Command::AssertUnlinkable { line, ref filename, .. }
=> {
let module_load = try_load(&outdir, filename);
match module_load {
@ -220,6 +230,12 @@ pub fn spec(name: &str) {
}
}
},
&test::Command::AssertUninstantiable { line, ref filename, .. } => {
match try_load(&outdir, &filename) {
Ok(_) => panic!("Expected error running start function at line {}", line),
Err(e) => println!("assert_uninstantiable - success ({:?})", e),
}
},
&test::Command::Action { line, ref action } => {
match run_action(&*module.as_ref().unwrap(), action) {
Ok(_) => { },

View File

@ -53,11 +53,28 @@ pub enum Command {
filename: String,
text: String,
},
#[serde(rename = "assert_uninstantiable")]
AssertUninstantiable {
line: u64,
filename: String,
text: String,
},
#[serde(rename = "assert_exhaustion")]
AssertExhaustion {
line: u64,
action: Action,
},
#[serde(rename = "assert_unlinkable")]
AssertUnlinkable {
line: u64,
filename: String,
text: String,
},
#[serde(rename = "action")]
Action {
line: u64,
action: Action,
}
},
}
#[derive(Deserialize, Debug)]