INNER CODE UNIT · Rust

dd_random_file

openebs/mayastor · io-engine-tests/src/lib.rs:168

pub fn dd_random_file(path: &str, bs: u32, size: u64) {
    let count = size * 1024 / bs as u64;
    let output = Command::new("dd")
        .args([
            "if=/dev/urandom",
            &format!("of={path}"),
            &format!("bs={bs}"),
            &format!("count={count}"),
        ])
        .output()
        .expect("failed exec dd");

    assert!(output.status.success(), "{:#?}", output);
}

pub fn truncate_file(path: &str, size: u64) {
    let output = Command::new("truncate")
        .args(["-s", &format!("{}m", size / 1024), path])

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…