mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-05-28 23:21:35 +00:00
Merge pull request #36 from NikVolf/more-tests
Update wabt and also failing spec
This commit is contained in:
commit
08e55618f3
@ -1,4 +1,10 @@
|
||||
macro_rules! run_test {
|
||||
($label: expr, $test_name: ident, fail) => (
|
||||
#[test]
|
||||
fn $test_name() {
|
||||
::run::failing_spec($label)
|
||||
}
|
||||
);
|
||||
($label: expr, $test_name: ident) => (
|
||||
#[test]
|
||||
fn $test_name() {
|
||||
@ -8,6 +14,7 @@ macro_rules! run_test {
|
||||
}
|
||||
|
||||
run_test!("address", wasm_address);
|
||||
run_test!("address-offset-range.fail", wasm_address_offset_range_fail, fail);
|
||||
run_test!("endianness", wasm_endianness);
|
||||
run_test!("f32", wasm_f32);
|
||||
run_test!("f32_bitwise", wasm_f32_bitwise);
|
||||
|
@ -80,7 +80,12 @@ fn run_action(module: &ModuleInstance, action: &test::Action)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn spec(name: &str) {
|
||||
pub struct FixtureParams {
|
||||
failing: bool,
|
||||
json: String,
|
||||
}
|
||||
|
||||
pub fn run_wast2wasm(name: &str) -> FixtureParams {
|
||||
let outdir = env::var("OUT_DIR").unwrap();
|
||||
|
||||
let mut wast2wasm_path = PathBuf::from(outdir.clone());
|
||||
@ -98,15 +103,38 @@ pub fn spec(name: &str) {
|
||||
.output()
|
||||
.expect("Failed to execute process");
|
||||
|
||||
if !wast2wasm_output.status.success() {
|
||||
println!("wasm2wast error code: {}", wast2wasm_output.status);
|
||||
println!("wasm2wast stdout: {}", String::from_utf8_lossy(&wast2wasm_output.stdout));
|
||||
println!("wasm2wast stderr: {}", String::from_utf8_lossy(&wast2wasm_output.stderr));
|
||||
panic!("wasm2wast exited with status {}", wast2wasm_output.status);
|
||||
FixtureParams {
|
||||
json: json_spec_path.to_str().unwrap().to_owned(),
|
||||
failing: {
|
||||
if !wast2wasm_output.status.success() {
|
||||
println!("wasm2wast error code: {}", wast2wasm_output.status);
|
||||
println!("wasm2wast stdout: {}", String::from_utf8_lossy(&wast2wasm_output.stdout));
|
||||
println!("wasm2wast stderr: {}", String::from_utf8_lossy(&wast2wasm_output.stderr));
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn failing_spec(name: &str) {
|
||||
let fixture = run_wast2wasm(name);
|
||||
if !fixture.failing {
|
||||
panic!("wasm2wast expected to fail, but terminated normally");
|
||||
}
|
||||
}
|
||||
|
||||
pub fn spec(name: &str) {
|
||||
let outdir = env::var("OUT_DIR").unwrap();
|
||||
|
||||
let fixture = run_wast2wasm(name);
|
||||
if fixture.failing {
|
||||
panic!("wasm2wast terminated abnormally, expected to success");
|
||||
}
|
||||
|
||||
let mut f = File::open(&json_spec_path)
|
||||
.expect(&format!("Failed to load json file {}", &json_spec_path.to_string_lossy()));
|
||||
let mut f = File::open(&fixture.json)
|
||||
.expect(&format!("Failed to load json file {}", &fixture.json));
|
||||
let spec: test::Spec = serde_json::from_reader(&mut f).expect("Failed to deserialize JSON file");
|
||||
|
||||
let first_command = &spec.commands[0];
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 7425bcc31e6516375391d18a62daee4c9f3502de
|
||||
Subproject commit 1e5b546c65e8fef609431e77b1b2434dbf162e6c
|
Loading…
x
Reference in New Issue
Block a user