1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-09-14 09:10:16 +02:00

flashrom_tester: Use path types for things that are paths

Use Path and PathBuf for things that are paths.

BUG=b:243460685
BRANCH=None
TEST=/usr/bin/flashrom_tester --flashrom_binary /usr/sbin/flashrom host
TEST=/usr/bin/flashrom_tester --libflashrom host

Change-Id: I69531bec5436a60430eae975eeab02c8835962bf
Signed-off-by: Evan Benn <evanbenn@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/69064
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
This commit is contained in:
Evan Benn
2022-11-01 11:43:10 +11:00
committed by Edward O'Callaghan
parent 8170c89568
commit c726a693d6
6 changed files with 79 additions and 69 deletions

View File

@@ -36,10 +36,11 @@
use std::fs::File;
use std::io::prelude::*;
use std::io::BufWriter;
use std::path::Path;
use rand::prelude::*;
pub fn gen_rand_testdata(path: &str, size: usize) -> std::io::Result<()> {
pub fn gen_rand_testdata(path: &Path, size: usize) -> std::io::Result<()> {
let mut buf = BufWriter::new(File::create(path)?);
let mut a: Vec<u8> = vec![0; size];
@@ -58,8 +59,8 @@ mod tests {
fn gen_rand_testdata() {
use super::gen_rand_testdata;
let path0 = "/tmp/idk_test00";
let path1 = "/tmp/idk_test01";
let path0 = Path::new("/tmp/idk_test00");
let path1 = Path::new("/tmp/idk_test01");
let sz = 1024;
gen_rand_testdata(path0, sz).unwrap();