mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-04 07:15:18 +02:00
CHROMIUM: avl_tool: more gracefully handle termination by SIGINT
Since interrupting the test process may be dangerous (leaving the flash in an inconsistent state), we'll catch SIGINT and print a warning the first time, also using it as a signal that we should stop at a convenient time. Any following SIGINT will be handled as normal (killing the process). BUG=b:143251344 TEST=Run tool and verify it exits after a test with a single ^C, exits immediately given two. BRANCH=None Original-Cq-Depend: chromium:2059548 Original-Change-Id: Ib8a7799cba6dbca57dc7f1d3c87521f132c21818 Original-Signed-off-by: Peter Marheine <pmarheine@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/flashrom/+/2050050 Original-Tested-by: Edward O'Callaghan <quasisec@chromium.org> Original-Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Change-Id: If43aea0580fcc7e698daad2ffe085a3c9da5bc41 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/49915 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:

committed by
Edward O'Callaghan

parent
4e31838eb1
commit
32aa933b1d
@ -40,6 +40,7 @@ use flashrom::{FlashChip, Flashrom, FlashromCmd};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::fs::File;
|
||||
use std::io::{BufRead, Write};
|
||||
use std::sync::atomic::AtomicBool;
|
||||
|
||||
const LAYOUT_FILE: &'static str = "/tmp/layout.file";
|
||||
|
||||
@ -82,6 +83,7 @@ pub fn generic<'a, TN: Iterator<Item = &'a str>>(
|
||||
print_layout: bool,
|
||||
output_format: OutputFormat,
|
||||
test_names: Option<TN>,
|
||||
terminate_flag: Option<&AtomicBool>,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let p = path.to_string();
|
||||
let cmd = FlashromCmd { path: p, fc };
|
||||
@ -142,7 +144,7 @@ pub fn generic<'a, TN: Iterator<Item = &'a str>>(
|
||||
|
||||
// ------------------------.
|
||||
// Run all the tests and collate the findings:
|
||||
let results = tester::run_all_tests(fc, &cmd, tests);
|
||||
let results = tester::run_all_tests(fc, &cmd, tests, terminate_flag);
|
||||
|
||||
// Any leftover filtered names were specified to be run but don't exist
|
||||
for leftover in filter_names.iter().flatten() {
|
||||
|
Reference in New Issue
Block a user