Fix wat syntax so wasm tests pass (#199)

* wasm testsuite: ignore hidden files in test dir

and report a rejected file. it was picking up vim .swp files

* wasmtests: correct wat syntax in icall.wat
This commit is contained in:
Pat Hickey
2017-11-27 12:46:53 -08:00
committed by Dan Gohman
parent b5601d57c8
commit cced2c8b0c
2 changed files with 11 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
(module (module
(type $ft (func (param f32) (result i32))) (type $ft (func (param f32) (result i32)))
(func $foo (export "foo") (param i32 f32) (result i32) (func $foo (export "foo") (param i32 f32) (result i32)
(call_indirect $ft (get_local 1) (get_local 0)) (call_indirect (type $ft) (get_local 1) (get_local 0))
) )
(table (;0;) 23 23 anyfunc) (table (;0;) 23 23 anyfunc)
) )

View File

@@ -23,6 +23,15 @@ fn testsuite() {
let mut paths: Vec<_> = fs::read_dir("../../wasmtests") let mut paths: Vec<_> = fs::read_dir("../../wasmtests")
.unwrap() .unwrap()
.map(|r| r.unwrap()) .map(|r| r.unwrap())
.filter(|p| {
// Ignore files starting with `.`, which could be editor temporary files
if let Some(stem) = p.path().file_stem() {
if let Some(stemstr) = stem.to_str() {
return !stemstr.starts_with(".");
}
}
false
})
.collect(); .collect();
paths.sort_by_key(|dir| dir.path()); paths.sort_by_key(|dir| dir.path());
let flags = Flags::new(&settings::builder()); let flags = Flags::new(&settings::builder());
@@ -88,7 +97,7 @@ fn handle_module(path: PathBuf, flags: &Flags) {
} }
read_wasm_file(file_path).expect("error reading converted wasm file") read_wasm_file(file_path).expect("error reading converted wasm file")
} }
None | Some(&_) => panic!("the file extension is not wasm or wat"), None | Some(&_) => panic!("the file extension for {:?} is not wasm or wat", path),
} }
} }
}; };