Improve error handling, and start refactoring Instance.

Introduce proper error handling in several places, and perform a first
pass at refactoring Instance to make it easier to use.
This commit is contained in:
Dan Gohman
2018-12-07 15:32:51 -05:00
parent fe562297a7
commit 7dcca6be5b
24 changed files with 949 additions and 565 deletions

View File

@@ -48,7 +48,7 @@ fn test_directory(out: &mut File, testsuite: &str) -> io::Result<()> {
.unwrap()
.replace("-", "_")
)?;
writeln!(out, " use super::{{native_isa, wast_file, Path}};")?;
writeln!(out, " use super::{{native_isa, WastContext, Path}};")?;
for dir_entry in dir_entries {
let path = dir_entry.path();
let stemstr = path
@@ -66,9 +66,10 @@ fn test_directory(out: &mut File, testsuite: &str) -> io::Result<()> {
" fn {}() {{",
avoid_keywords(&stemstr.replace("-", "_"))
)?;
writeln!(out, " let mut wast_context = WastContext::new();")?;
writeln!(
out,
" wast_file(Path::new(\"{}\"), &*native_isa()).expect(\"error loading wast file {}\");",
" wast_context.run_file(&*native_isa(), Path::new(\"{}\")).expect(\"error running wast file: {}\");",
path.display(),
path.display()
)?;