From c626208a0a7a91b4542cd69152197592b3876464 Mon Sep 17 00:00:00 2001 From: Sergey Pepyakin Date: Mon, 19 Feb 2018 19:05:15 +0300 Subject: [PATCH] Oops. Revert to temp file creation. --- fuzz/fuzz_targets/load_spec.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fuzz/fuzz_targets/load_spec.rs b/fuzz/fuzz_targets/load_spec.rs index 9b7be2a..113c948 100644 --- a/fuzz/fuzz_targets/load_spec.rs +++ b/fuzz/fuzz_targets/load_spec.rs @@ -10,11 +10,13 @@ use std::io::Write; use std::process::{Command, Stdio}; 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 = - 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( "write fuzzer input to temporary file", ); @@ -25,7 +27,7 @@ fn run_spec(data: &[u8]) -> Result<(), ()> { let exit_status = Command::new("wasm") .arg("-d") - .arg(TEST_FILE) + .arg(&seed_path) .stdout(Stdio::null()) .stderr(Stdio::null()) .status()