mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 06:23:18 +02:00
flashrom_tester: Rewrite IOOpts to support more operations
flashrom cli supports include regions for all of read write and verify, as well as omitting the read/write/verify file if an include region with file is specified. Use an enum to allow only one operation at a time. Unify the read and write region implementations. BUG=b:235916336 BRANCH=None TEST=None Change-Id: I1cb46bb1b26949fd9c19949c43708a8b652e00da Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/71973 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
This commit is contained in:

committed by
Edward O'Callaghan

parent
69bbe7986c
commit
72e62750c8
@ -283,12 +283,11 @@ fn partial_lock_test(section: LayoutNames) -> impl Fn(&mut TestEnv) -> TestResul
|
||||
env.wp.set_hw(true)?;
|
||||
|
||||
// Check that we cannot write to the protected region.
|
||||
let rws = flashrom::ROMWriteSpecifics {
|
||||
layout_file: Some(&env.layout_file),
|
||||
write_file: Some(env.random_data_file()),
|
||||
name_file: Some(wp_section_name),
|
||||
};
|
||||
if env.cmd.write_file_with_layout(&rws).is_ok() {
|
||||
if env
|
||||
.cmd
|
||||
.write_from_file_region(env.random_data_file(), wp_section_name, &env.layout_file)
|
||||
.is_ok()
|
||||
{
|
||||
return Err(
|
||||
"Section should be locked, should not have been overwritable with random data"
|
||||
.into(),
|
||||
@ -301,12 +300,11 @@ fn partial_lock_test(section: LayoutNames) -> impl Fn(&mut TestEnv) -> TestResul
|
||||
// Check that we can write to the non protected region.
|
||||
let (non_wp_section_name, _, _) =
|
||||
utils::layout_section(env.layout(), section.get_non_overlapping_section());
|
||||
let rws = flashrom::ROMWriteSpecifics {
|
||||
layout_file: Some(&env.layout_file),
|
||||
write_file: Some(env.random_data_file()),
|
||||
name_file: Some(non_wp_section_name),
|
||||
};
|
||||
env.cmd.write_file_with_layout(&rws)?;
|
||||
env.cmd.write_from_file_region(
|
||||
env.random_data_file(),
|
||||
non_wp_section_name,
|
||||
&env.layout_file,
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user