fn build_replay_harness(
    input: &FlashInput,
    cargo_path: &mut PathBuf,
    target_dir: &mut PathBuf,
) -> Result<ExitStatus, std::io::Error> {
    let mut cargo = Command::new("cargo");
    cargo.arg("build");

    if input.target.is_some() {
        let target = input.target.clone().unwrap();
        cargo.args(&["--target", target.as_str()]);
        target_dir.push(target);
    }

    if input.is_release() {
        cargo.arg("--release");
        target_dir.push("release/");
    } else {
        target_dir.push("debug/");
    }

    if input.verbose {
        cargo.arg("--verbose");
    }

    let name: String;
    if input.build.example.is_none() {
        name = input.build.bin.as_ref().unwrap().to_string();
        cargo.args(&["--bin", name.as_str()]);
    } else {
        name = input.build.example.as_ref().unwrap().to_string();
        cargo.args(&["--example", name.as_str()]);
        target_dir.push("examples/");
    }
    target_dir.push(name);

    cargo
        .args(&["--features", "klee-replay"])
        .args(&["--manifest-path", cargo_path.to_str().unwrap()]);

    cargo.status()
}
/// Builds the replay harness by setting the correct features for all patched
/// crates.
Builds the replay harness by setting the correct features for all patched
crates.
Builds the replay harness by setting the correct features for all patched crates .
fn build_replay_harness(
    input: &FlashInput,
    cargo_path: &mut PathBuf,
    target_dir: &mut PathBuf,
) -> Result<ExitStatus, std::io::Error> {
    let mut cargo = Command::new("cargo");
    cargo.arg("build");
    if input.target.is_some() {
        let target = input.target.clone().unwrap();
        cargo.args(&["--target", target.as_str()]);
        target_dir.push(target);
    }
    if input.is_release() {
        cargo.arg("--release");
        target_dir.push("release/");
    } else {
        target_dir.push("debug/");
    }
    if input.verbose {
        cargo.arg("--verbose");
    }
    let name: String;
    if input.build.example.is_none() {
        name = input.build.bin.as_ref().unwrap().to_string();
        cargo.args(&["--bin", name.as_str()]);
    } else {
        name = input.build.example.as_ref().unwrap().to_string();
        cargo.args(&["--example", name.as_str()]);
        target_dir.push("examples/");
    }
    target_dir.push(name);
    cargo
        .args(&["--features", "klee-replay"])
        .args(&["--manifest-path", cargo_path.to_str().unwrap()]);
    cargo.status()
}
fn build_replay_harness ( input : & FlashInput , cargo_path : & mut PathBuf , target_dir : & mut PathBuf , ) -> Result < ExitStatus , std :: io :: Error > { let mut cargo = Command :: new ( " " ) ; cargo . arg ( " " ) ; if input . target . is_some ( ) { let target = input . target . clone ( ) . unwrap ( ) ; cargo . args ( & [ " " , target . as_str ( ) ] ) ; target_dir . push ( target ) ; } if input . is_release ( ) { cargo . arg ( " " ) ; target_dir . push ( " " ) ; } else { target_dir . push ( " " ) ; } if input . verbose { cargo . arg ( " " ) ; } let name : String ; if input . build . example . is_none ( ) { name = input . build . bin . as_ref ( ) . unwrap ( ) . to_string ( ) ; cargo . args ( & [ " " , name . as_str ( ) ] ) ; } else { name = input . build . example . as_ref ( ) . unwrap ( ) . to_string ( ) ; cargo . args ( & [ " " , name . as_str ( ) ] ) ; target_dir . push ( " " ) ; } target_dir . push ( name ) ; cargo . args ( & [ " " , " " ] ) . args ( & [ " " , cargo_path . to_str ( ) . unwrap ( ) ] ) ; cargo . status ( ) }
Builds the replay harness by setting the correct features for all patched
crates.
Builds the replay harness by setting the correct features for all patched crates .
input
&FlashInput
cargo_path
&mut PathBuf
target_dir
&mut PathBuf
input
&FlashInput
cargo_path
&mut PathBuf
target_dir
&mut PathBuf