1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-28 07:23:43 +02:00

flashrom_tester: update syntax for --wp-range

TEST=cargo test

Signed-off-by: Daniel Campello <campello@chromium.org>
Change-Id: If17a40fba1f7d41e09e0163b353d1602c215c8db
Reviewed-on: https://review.coreboot.org/c/flashrom/+/52876
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Daniel Campello 2021-04-28 21:07:23 -06:00 committed by Edward O'Callaghan
parent 7367f77aa4
commit 32b8bab08c

View File

@ -90,8 +90,7 @@ fn flashrom_decode_opts(opts: FlashromOpt) -> Vec<String> {
if opts.wp_opt.range.is_some() {
let (x0, x1) = opts.wp_opt.range.unwrap();
params.push("--wp-range".to_string());
params.push(hex_string(x0));
params.push(hex_string(x1));
params.push(hex_range_string(x0, x1));
}
if opts.wp_opt.status {
params.push("--wp-status".to_string());
@ -209,8 +208,8 @@ fn dut_ctrl(args: &[&str]) -> Result<(Vec<u8>, Vec<u8>), FlashromError> {
Ok((output.stdout, output.stderr))
}
fn hex_string(v: i64) -> String {
format!("{:#08X}", v).to_string()
fn hex_range_string(s: i64, l: i64) -> String {
format!("{:#08X},{:#08X}", s, l).to_string()
}
#[cfg(test)]
@ -237,7 +236,7 @@ mod tests {
status: true,
..Default::default()
},
&["--wp-range", "0x000000", "0x0004D2", "--wp-status"],
&["--wp-range", "0x000000,0x0004D2", "--wp-status"],
);
test_wp_opt(
WPOpt {