Edward O'Callaghan submitted this change.

View Change


Approvals: build bot (Jenkins): Verified Edward O'Callaghan: Looks good to me, approved
flashrom_tester: Drop dediprog, ec, and servo targets

None of these targets have been maintained or used for several years:

dediprog:
- Wasn't accepted by the argument filter in main.rs.

ec:
- Is incompatible with most tests because the EC only supports one
protection range.

servo:
- Has been broken for >3 years because it uses the programmer string
"ft2231_spi:type=servo-v2", where "ft2231" should be "ft2232".

BUG=b:239357853
BRANCH=none
TEST=flashrom_tester on dedede

Change-Id: Iee94f6bb5ff8c5451acb8bcaabf28119006d0ef5
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/69921
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
---
M util/flashrom_tester/flashrom/src/cmd.rs
M util/flashrom_tester/flashrom/src/lib.rs
M util/flashrom_tester/src/main.rs
M util/flashrom_tester/src/tester.rs
4 files changed, 33 insertions(+), 51 deletions(-)

diff --git a/util/flashrom_tester/flashrom/src/cmd.rs b/util/flashrom_tester/flashrom/src/cmd.rs
index 458f054..f24a2c9 100644
--- a/util/flashrom_tester/flashrom/src/cmd.rs
+++ b/util/flashrom_tester/flashrom/src/cmd.rs
@@ -391,35 +391,6 @@
Ok((stdout.into(), stderr.into()))
}

-pub fn dut_ctrl_toggle_wp(en: bool) -> Result<(Vec<u8>, Vec<u8>), FlashromError> {
- let args = if en {
- ["fw_wp_en:off", "fw_wp:on"]
- } else {
- ["fw_wp_en:on", "fw_wp:off"]
- };
- dut_ctrl(&args)
-}
-
-fn dut_ctrl(args: &[&str]) -> Result<(Vec<u8>, Vec<u8>), FlashromError> {
- let output = match Command::new("dut-control").args(args).output() {
- Ok(x) => x,
- Err(e) => return Err(format!("Failed to run dut-control: {}", e).into()),
- };
- if !output.status.success() {
- // There is two cases on failure;
- // i. ) A bad exit code,
- // ii.) A SIG killed us.
- match output.status.code() {
- Some(code) => {
- return Err(format!("Exited with error code: {}", code).into());
- }
- None => return Err("Process terminated by a signal".into()),
- }
- }
-
- Ok((output.stdout, output.stderr))
-}
-
fn hex_range_string(s: i64, l: i64) -> String {
format!("{:#08X},{:#08X}", s, l)
}
diff --git a/util/flashrom_tester/flashrom/src/lib.rs b/util/flashrom_tester/flashrom/src/lib.rs
index 90e40e2..6b0cca3 100644
--- a/util/flashrom_tester/flashrom/src/lib.rs
+++ b/util/flashrom_tester/flashrom/src/lib.rs
@@ -41,7 +41,7 @@

use std::{error, fmt, path::Path};

-pub use cmd::{dut_ctrl_toggle_wp, FlashromCmd};
+pub use cmd::FlashromCmd;
pub use flashromlib::FlashromLib;

pub use libflashrom::{
@@ -51,28 +51,19 @@

#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum FlashChip {
- EC,
HOST,
- SERVO,
- DEDIPROG,
}

impl FlashChip {
pub fn from(s: &str) -> Result<FlashChip, &str> {
match s {
- "ec" => Ok(FlashChip::EC),
"host" => Ok(FlashChip::HOST),
- "servo" => Ok(FlashChip::SERVO),
- "dediprog" => Ok(FlashChip::DEDIPROG),
_ => Err("cannot convert str to enum"),
}
}
pub fn to(fc: FlashChip) -> &'static str {
match fc {
- FlashChip::EC => "ec",
FlashChip::HOST => "host",
- FlashChip::SERVO => "ft2231_spi:type=servo-v2",
- FlashChip::DEDIPROG => "dediprog",
}
}

@@ -89,8 +80,7 @@
/// disabled.
pub fn can_control_hw_wp(&self) -> bool {
match self {
- FlashChip::HOST | FlashChip::EC => true,
- FlashChip::SERVO | FlashChip::DEDIPROG => false,
+ FlashChip::HOST => true,
}
}
}
diff --git a/util/flashrom_tester/src/main.rs b/util/flashrom_tester/src/main.rs
index 129d1a9..44429ba 100644
--- a/util/flashrom_tester/src/main.rs
+++ b/util/flashrom_tester/src/main.rs
@@ -83,7 +83,7 @@
.arg(
Arg::with_name("ccd_target_type")
.required(true)
- .possible_values(&["host", "ec", "servo"]),
+ .possible_values(&["host"]),
)
.arg(
Arg::with_name("print-layout")
diff --git a/util/flashrom_tester/src/tester.rs b/util/flashrom_tester/src/tester.rs
index 1fa44a8..4629c2e 100644
--- a/util/flashrom_tester/src/tester.rs
+++ b/util/flashrom_tester/src/tester.rs
@@ -96,19 +96,10 @@
}

pub fn run_test<T: TestCase>(&mut self, test: T) -> TestResult {
- let use_dut_control = self.chip_type == FlashChip::SERVO;
- if use_dut_control && flashrom::dut_ctrl_toggle_wp(false).is_err() {
- error!("failed to dispatch dut_ctrl_toggle_wp()!");
- }
-
let name = test.get_name();
info!("Beginning test: {}", name);
let out = test.run(self);
info!("Completed test: {}; result {:?}", name, out);
-
- if use_dut_control && flashrom::dut_ctrl_toggle_wp(true).is_err() {
- error!("failed to dispatch dut_ctrl_toggle_wp()!");
- }
out
}


To view, visit change 69921. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Iee94f6bb5ff8c5451acb8bcaabf28119006d0ef5
Gerrit-Change-Number: 69921
Gerrit-PatchSet: 4
Gerrit-Owner: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Evan Benn <evanbenn@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged