mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 22:52:34 +02:00
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>
This commit is contained in:
parent
ff5beeef40
commit
8b0250b32b
@ -391,35 +391,6 @@ fn flashrom_dispatch<S: AsRef<OsStr>>(
|
||||
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)
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ mod flashromlib;
|
||||
|
||||
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 @@ pub use libflashrom::{
|
||||
|
||||
#[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 @@ impl FlashChip {
|
||||
/// disabled.
|
||||
pub fn can_control_hw_wp(&self) -> bool {
|
||||
match self {
|
||||
FlashChip::HOST | FlashChip::EC => true,
|
||||
FlashChip::SERVO | FlashChip::DEDIPROG => false,
|
||||
FlashChip::HOST => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ fn main() {
|
||||
.arg(
|
||||
Arg::with_name("ccd_target_type")
|
||||
.required(true)
|
||||
.possible_values(&["host", "ec", "servo"]),
|
||||
.possible_values(&["host"]),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("print-layout")
|
||||
|
@ -96,19 +96,10 @@ impl<'a> TestEnv<'a> {
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user