mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-04 19:16:23 +00:00
Merge pull request #9345 from c3d/bug/9342-agent-test-errors
agent: Fix errors in `make check`
This commit is contained in:
commit
dfa8832406
@ -569,7 +569,7 @@ pub fn parse_mount_table(mountinfo_path: &str) -> Result<Vec<Info>> {
|
|||||||
let reader = BufReader::new(file);
|
let reader = BufReader::new(file);
|
||||||
let mut infos = Vec::new();
|
let mut infos = Vec::new();
|
||||||
|
|
||||||
for (_index, line) in reader.lines().enumerate() {
|
for line in reader.lines() {
|
||||||
let line = line?;
|
let line = line?;
|
||||||
|
|
||||||
//Example mountinfo format:
|
//Example mountinfo format:
|
||||||
|
@ -180,7 +180,7 @@ pub fn get_mount_fs_type_from_file(mount_file: &str, mount_point: &str) -> Resul
|
|||||||
let re = Regex::new(format!("device .+ mounted on {} with fstype (.+)", mount_point).as_str())?;
|
let re = Regex::new(format!("device .+ mounted on {} with fstype (.+)", mount_point).as_str())?;
|
||||||
|
|
||||||
// Read the file line by line using the lines() iterator from std::io::BufRead.
|
// Read the file line by line using the lines() iterator from std::io::BufRead.
|
||||||
for (_index, line) in content.lines().enumerate() {
|
for line in content.lines() {
|
||||||
if let Some(capes) = re.captures(line) {
|
if let Some(capes) = re.captures(line) {
|
||||||
if capes.len() > 1 {
|
if capes.len() > 1 {
|
||||||
return Ok(capes[1].to_string());
|
return Ok(capes[1].to_string());
|
||||||
@ -225,7 +225,7 @@ pub fn get_cgroup_mounts(
|
|||||||
|
|
||||||
// #subsys_name hierarchy num_cgroups enabled
|
// #subsys_name hierarchy num_cgroups enabled
|
||||||
// fields[0] fields[1] fields[2] fields[3]
|
// fields[0] fields[1] fields[2] fields[3]
|
||||||
'outer: for (_, line) in reader.lines().enumerate() {
|
'outer: for line in reader.lines() {
|
||||||
let line = line?;
|
let line = line?;
|
||||||
|
|
||||||
let fields: Vec<&str> = line.split('\t').collect();
|
let fields: Vec<&str> = line.split('\t').collect();
|
||||||
|
@ -1746,7 +1746,7 @@ fn is_signal_handled(proc_status_file: &str, signum: u32) -> bool {
|
|||||||
// read lines start with SigBlk/SigIgn/SigCgt and check any match the signal mask
|
// read lines start with SigBlk/SigIgn/SigCgt and check any match the signal mask
|
||||||
reader
|
reader
|
||||||
.lines()
|
.lines()
|
||||||
.flatten()
|
.map_while(Result::ok)
|
||||||
.filter(|line| {
|
.filter(|line| {
|
||||||
line.starts_with("SigBlk:")
|
line.starts_with("SigBlk:")
|
||||||
|| line.starts_with("SigIgn:")
|
|| line.starts_with("SigIgn:")
|
||||||
|
@ -144,15 +144,12 @@ mod tests {
|
|||||||
|
|
||||||
tx.send(true).expect("failed to request shutdown");
|
tx.send(true).expect("failed to request shutdown");
|
||||||
|
|
||||||
loop {
|
select! {
|
||||||
select! {
|
_ = handle => {
|
||||||
_ = handle => {
|
println!("INFO: task completed");
|
||||||
println!("INFO: task completed");
|
},
|
||||||
break;
|
_ = &mut timeout => {
|
||||||
},
|
panic!("signal thread failed to stop");
|
||||||
_ = &mut timeout => {
|
|
||||||
panic!("signal thread failed to stop");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user