Edward O'Callaghan has submitted this change. ( https://review.coreboot.org/c/flashrom/+/69403 )
(
5 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: flashrom_tester: Log some cros lsb-release information ......................................................................
flashrom_tester: Log some cros lsb-release information
os-release does not quite have as much information so use lsb-release.
BUG=b:258289727 BRANCH=None TEST=flashrom_tester --libflashrom host Lock
Change-Id: If3452ead9e02e0ddeaa0fdf4852d7c17a8ab7650 Signed-off-by: Evan Benn evanbenn@chromium.org Reviewed-on: https://review.coreboot.org/c/flashrom/+/69403 Reviewed-by: Edward O'Callaghan quasisec@chromium.org Reviewed-by: Peter Marheine pmarheine@chromium.org Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M util/flashrom_tester/src/cros_sysinfo.rs M util/flashrom_tester/src/tester.rs M util/flashrom_tester/src/tests.rs 3 files changed, 35 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Edward O'Callaghan: Looks good to me, approved Peter Marheine: Looks good to me, but someone else must approve
diff --git a/util/flashrom_tester/src/cros_sysinfo.rs b/util/flashrom_tester/src/cros_sysinfo.rs index e047f8e..37e1ec6 100644 --- a/util/flashrom_tester/src/cros_sysinfo.rs +++ b/util/flashrom_tester/src/cros_sysinfo.rs @@ -34,6 +34,7 @@ //
use std::ffi::OsStr; +use std::fs; use std::io::Result as IoResult; use std::process::{Command, Stdio};
@@ -58,3 +59,12 @@ pub fn bios_info() -> IoResult<String> { dmidecode_dispatch(&["-q", "-t0"]) } + +pub fn release_description() -> IoResult<String> { + for l in fs::read_to_string("/etc/lsb-release")?.lines() { + if l.starts_with("CHROMEOS_RELEASE_DESCRIPTION") { + return Ok(l.to_string()); + } + } + Err(std::io::ErrorKind::NotFound.into()) +} diff --git a/util/flashrom_tester/src/tester.rs b/util/flashrom_tester/src/tester.rs index bedccaf..d19e45c 100644 --- a/util/flashrom_tester/src/tester.rs +++ b/util/flashrom_tester/src/tester.rs @@ -348,6 +348,7 @@ pub struct ReportMetaData { pub chip_name: String, pub os_release: String, + pub cros_release: String, pub system_info: String, pub bios_info: String, } @@ -451,6 +452,7 @@ println!(); println!(" %---------------------------%"); println!(" os release: {}", meta_data.os_release); + println!(" cros release: {}", meta_data.cros_release); println!(" chip name: {}", meta_data.chip_name); println!(" system info: \n{}", meta_data.system_info); println!(" bios info: \n{}", meta_data.bios_info); diff --git a/util/flashrom_tester/src/tests.rs b/util/flashrom_tester/src/tests.rs index 5cbe9d2..e6968c8 100644 --- a/util/flashrom_tester/src/tests.rs +++ b/util/flashrom_tester/src/tests.rs @@ -134,12 +134,15 @@ }
let os_release = sys_info::os_release().unwrap_or("<Unknown OS>".to_string()); + let cros_release = cros_sysinfo::release_description() + .unwrap_or("<Unknown or not a ChromeOS release>".to_string()); let system_info = cros_sysinfo::system_info().unwrap_or("<Unknown System>".to_string()); let bios_info = cros_sysinfo::bios_info().unwrap_or("<Unknown BIOS>".to_string());
let meta_data = tester::ReportMetaData { chip_name, os_release, + cros_release, system_info, bios_info, };