Cleanup debug info
This commit is contained in:
parent
55958820bf
commit
f784e1b821
1 changed files with 20 additions and 27 deletions
|
@ -2,12 +2,11 @@ use std::fs;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use async_log::span;
|
|
||||||
use bakare::repository::Repository;
|
use bakare::repository::Repository;
|
||||||
use bakare::test::{assertions::*, source::TempSource};
|
use bakare::test::{assertions::*, source::TempSource};
|
||||||
use bakare::{backup, restore};
|
use bakare::{backup, restore};
|
||||||
use nix::sys::wait::{waitpid, WaitStatus};
|
use nix::sys::wait::{waitpid, WaitStatus};
|
||||||
use nix::unistd::{fork, getpid, ForkResult};
|
use nix::unistd::{fork, ForkResult};
|
||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -47,7 +46,6 @@ where
|
||||||
{
|
{
|
||||||
let task_numbers = (0..parallel_backups_number).collect::<Vec<_>>();
|
let task_numbers = (0..parallel_backups_number).collect::<Vec<_>>();
|
||||||
let mut child_pids = vec![];
|
let mut child_pids = vec![];
|
||||||
span!("[{}] acquiring children for parent", getpid(), {
|
|
||||||
for task_number in &task_numbers {
|
for task_number in &task_numbers {
|
||||||
match unsafe { fork() } {
|
match unsafe { fork() } {
|
||||||
Ok(ForkResult::Parent { child }) => {
|
Ok(ForkResult::Parent { child }) => {
|
||||||
|
@ -61,20 +59,16 @@ where
|
||||||
Err(_) => panic!("fork failed"),
|
Err(_) => panic!("fork failed"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
span!("[{}] waiting for {} children", getpid(), child_pids.len(), {
|
|
||||||
for pid in child_pids {
|
for pid in child_pids {
|
||||||
log::debug!("[{}] waiting for a child {} to exit", getpid(), pid);
|
|
||||||
let status = waitpid(Some(pid), None)?;
|
let status = waitpid(Some(pid), None)?;
|
||||||
match status {
|
match status {
|
||||||
WaitStatus::Exited(pid, code) => {
|
WaitStatus::Exited(pid, code) => {
|
||||||
assert!(code == 0, "failed the wait for {} with code {}", pid, code);
|
assert!(code == 0, "failed the wait for {} with code {}", pid, code);
|
||||||
}
|
}
|
||||||
WaitStatus::Signaled(pid, _, _) => assert!(false, "failed with signal for {}", pid),
|
WaitStatus::Signaled(pid, _, _) => panic!("failed with signal for {}", pid),
|
||||||
_ => panic!("unknown state"),
|
_ => panic!("unknown state"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
Ok(task_numbers)
|
Ok(task_numbers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,4 +105,3 @@ fn setup_logger() {
|
||||||
fn file_id(i: usize, j: usize) -> String {
|
fn file_id(i: usize, j: usize) -> String {
|
||||||
format!("{}-{}", i, j)
|
format!("{}-{}", i, j)
|
||||||
}
|
}
|
||||||
// TODO handle stale leftover locks
|
|
||||||
|
|
Loading…
Reference in a new issue