Refactor mgmt of misc testsuite (#101)

Changes:
* use [tempfile] crate for auto mgmt of temp dirs
* use concrete types in place of generics in `utils` module

[tempfile]: https://github.com/Stebalien/tempfile
This commit is contained in:
Jakub Konka
2019-09-17 00:35:14 +02:00
committed by Dan Gohman
parent dfeae067cc
commit fec5b7ab0a
4 changed files with 31 additions and 50 deletions

View File

@@ -113,7 +113,7 @@ fn write_testsuite_tests(out: &mut File, dir_entry: DirEntry, testsuite: &str) -
" fn {}() -> Result<(), String> {{",
avoid_keywords(&stemstr.replace("-", "_"))
)?;
write!(out, " setup_log();")?;
writeln!(out, " setup_log();")?;
write!(out, " let path = std::path::Path::new(\"")?;
// Write out the string with escape_debug to prevent special characters such
// as backslash from being reinterpreted.
@@ -129,7 +129,11 @@ fn write_testsuite_tests(out: &mut File, dir_entry: DirEntry, testsuite: &str) -
let workspace = if no_preopens(testsuite, stemstr) {
"None"
} else {
"Some(&utils::prepare_workspace(&bin_name)?)"
writeln!(
out,
" let workspace = utils::prepare_workspace(&bin_name)?;"
)?;
"Some(workspace.path())"
};
writeln!(
out,