Oops. Revert to temp file creation.

This commit is contained in:
Sergey Pepyakin 2018-02-19 19:05:15 +03:00
parent 213bc160bf
commit c626208a0a
1 changed files with 5 additions and 3 deletions

View File

@ -10,11 +10,13 @@ use std::io::Write;
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
fn run_spec(data: &[u8]) -> Result<(), ()> { fn run_spec(data: &[u8]) -> Result<(), ()> {
const TEST_FILE: &'static str = "test.wasm"; let temp_dir = tempdir::TempDir::new("spec").unwrap();
let mut seed_path = temp_dir.path().to_path_buf();
seed_path.push("test.wasm");
{ {
let mut seedfile = let mut seedfile =
File::create(TEST_FILE).expect("open temporary file for writing to store fuzzer input"); File::create(&seed_path).expect("open temporary file for writing to store fuzzer input");
seedfile.write_all(data).expect( seedfile.write_all(data).expect(
"write fuzzer input to temporary file", "write fuzzer input to temporary file",
); );
@ -25,7 +27,7 @@ fn run_spec(data: &[u8]) -> Result<(), ()> {
let exit_status = Command::new("wasm") let exit_status = Command::new("wasm")
.arg("-d") .arg("-d")
.arg(TEST_FILE) .arg(&seed_path)
.stdout(Stdio::null()) .stdout(Stdio::null())
.stderr(Stdio::null()) .stderr(Stdio::null())
.status() .status()