From b41bb5622c08edb33cd83aa05973513db3869af0 Mon Sep 17 00:00:00 2001 From: Evan Benn Date: Tue, 23 Aug 2022 12:43:47 +1000 Subject: flashrom_tester: Add _into_file to function names Rename Flashrom trait function names to reflect that the data is read to/from a file provided as an argument. BUG=None BRANCH=None TEST=cargo test; cargo check Change-Id: I0015c9bf64349a5512dbdb0ef6f3dad38aa2fd8e Signed-off-by: Evan Benn Reviewed-on: https://review.coreboot.org/c/flashrom/+/66956 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan --- util/flashrom_tester/src/tester.rs | 12 +++++++----- util/flashrom_tester/src/tests.rs | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'util/flashrom_tester/src') diff --git a/util/flashrom_tester/src/tester.rs b/util/flashrom_tester/src/tester.rs index f1498b11..e701763a 100644 --- a/util/flashrom_tester/src/tester.rs +++ b/util/flashrom_tester/src/tester.rs @@ -78,8 +78,8 @@ impl<'a> TestEnv<'a> { }; info!("Stashing golden image for verification/recovery on completion"); - out.cmd.read(&out.original_flash_contents)?; - out.cmd.verify(&out.original_flash_contents)?; + out.cmd.read_into_file(&out.original_flash_contents)?; + out.cmd.verify_from_file(&out.original_flash_contents)?; info!("Generating random flash-sized data"); rand_util::gen_rand_testdata(&out.random_data, rom_sz as usize) @@ -124,14 +124,16 @@ impl<'a> TestEnv<'a> { /// Return true if the current Flash contents are the same as the golden image /// that was present at the start of testing. pub fn is_golden(&self) -> bool { - self.cmd.verify(&self.original_flash_contents).is_ok() + self.cmd + .verify_from_file(&self.original_flash_contents) + .is_ok() } /// Do whatever is necessary to make the current Flash contents the same as they /// were at the start of testing. pub fn ensure_golden(&mut self) -> Result<(), FlashromError> { self.wp.set_hw(false)?.set_sw(false)?; - self.cmd.write(&self.original_flash_contents)?; + self.cmd.write_from_file(&self.original_flash_contents)?; Ok(()) } @@ -146,7 +148,7 @@ impl<'a> TestEnv<'a> { /// /// Returns Err if they are not the same. pub fn verify(&self, contents_path: &str) -> Result<(), FlashromError> { - self.cmd.verify(contents_path)?; + self.cmd.verify_from_file(contents_path)?; Ok(()) } } diff --git a/util/flashrom_tester/src/tests.rs b/util/flashrom_tester/src/tests.rs index ed912e95..7d746b5d 100644 --- a/util/flashrom_tester/src/tests.rs +++ b/util/flashrom_tester/src/tests.rs @@ -243,7 +243,8 @@ fn elog_sanity_test(env: &mut TestEnv) -> TestResult { env.ensure_golden()?; const ELOG_RW_REGION_NAME: &str = "RW_ELOG"; - env.cmd.read_region(ELOG_FILE, ELOG_RW_REGION_NAME)?; + env.cmd + .read_region_into_file(ELOG_FILE, ELOG_RW_REGION_NAME)?; // Just checking for the magic numer // TODO: improve this test to read the events -- cgit v1.2.3