use crate::error::ChildFate;
use crate::test_child::Console;
#[cfg(target_os = "linux")]
use crate::test_groups::{tracer_group, Group};
use crate::tokio::child::child_drop_tests::released_blocker;
use crate::tokio::child::Child;
fn blocker() -> (Child, crate::tokio::ChildStdin) {
let mut cmd = crate::test_child::tokio_command(Console::Hidden);
cmd.args(crate::test_child::BLOCKER_ARGV.iter().copied());
cmd.stdin(crate::Stdio::pipe()).expect("set stdin pipe");
cmd.stdout(crate::Stdio::null()).expect("set stdout");
let mut child = cmd.spawn().expect("spawn");
let stdin = child.stdin().expect("piped stdin");
(child, stdin)
}
struct Root {
#[cfg(target_os = "linux")]
pidfd: std::os::fd::OwnedFd,
#[cfg(target_os = "macos")]
pid: u32,
}
impl Root {
fn of(child: &Child) -> Root {
let pid = child.pid();
#[cfg(target_os = "linux")]
{
let pid = rustix::process::Pid::from_raw(pid as i32).expect("a positive pid");
Root {
pidfd: rustix::process::pidfd_open(pid, rustix::process::PidfdFlags::empty()).expect("pidfd_open"),
}
}
#[cfg(target_os = "macos")]
Root { pid }
}
fn reaped(&self) -> bool {
let mut info: libc::siginfo_t = unsafe { std::mem::zeroed() };
#[cfg(target_os = "linux")]
let (idtype, id) = {
use std::os::fd::AsRawFd as _;
(libc::P_PIDFD, self.pidfd.as_raw_fd() as libc::id_t)
};
#[cfg(target_os = "macos")]
let (idtype, id) = (libc::P_PID, self.pid as libc::id_t);
loop {
let rc = unsafe { libc::waitid(idtype, id, &mut info, libc::WEXITED | libc::WNOHANG | libc::WNOWAIT) };
if rc == 0 {
return false;
}
let e = std::io::Error::last_os_error();
match e.raw_os_error() {
Some(libc::ECHILD) => return true,
Some(libc::EINTR) => {}
_ => panic!("waitid on the root: {e}"),
}
}
}
}
#[skuld::test]
async fn tokio_armed_drop_reaps_before_returning() {
{
let (child, teardown) = released_blocker();
let root = Root::of(&child);
drop(child);
assert!(root.reaped(), "the armed drop must reap the root before it returns");
teardown.assert_killed();
}
{
let (mut child, teardown) = released_blocker();
assert_eq!(
child.tear_down_now(crate::containment::dispatch::TeardownCaller::Drop),
ChildFate::Reaped
);
teardown.assert_killed();
}
let (mut child, teardown) = released_blocker();
let root = Root::of(&child);
assert_eq!(child.tear_down_awaiting().await, ChildFate::Reaped);
assert!(
root.reaped(),
"the awaited teardown must reap the root before it returns"
);
teardown.assert_killed();
}
#[skuld::test]
async fn an_awaited_teardown_that_cannot_watch_the_exit_reaps_as_the_drop_does() {
let (mut child, teardown) = released_blocker();
let root = Root::of(&child);
let _refused = super::fault::fail_reap_watch();
assert_eq!(child.tear_down_awaiting().await, ChildFate::Reaped);
assert!(root.reaped(), "the teardown must reap the root");
teardown.assert_killed();
}
fn dropped_and_reaped_on(rt: &::tokio::runtime::Runtime, local: bool) -> bool {
let body = async {
let (child, teardown) = released_blocker();
let root = Root::of(&child);
drop(child);
let reaped = root.reaped();
teardown.assert_killed();
reaped
};
if local {
::tokio::task::LocalSet::new().block_on(rt, body)
} else {
rt.block_on(body)
}
}
#[skuld::test]
fn tokio_armed_drop_on_a_current_thread_runtime_reaps() {
let rt = ::tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.expect("current_thread runtime");
assert!(dropped_and_reaped_on(&rt, false));
}
#[skuld::test]
fn tokio_armed_drop_in_a_local_set_on_a_multi_thread_runtime_reaps() {
let rt = ::tokio::runtime::Builder::new_multi_thread()
.worker_threads(1)
.enable_all()
.build()
.expect("multi-thread runtime");
assert!(dropped_and_reaped_on(&rt, true));
}
#[cfg(target_os = "linux")]
#[skuld::test]
async fn tokio_armed_drop_of_a_tree_with_a_dying_descendant_removes_the_leaf() {
use super::child_drop_tests::linux;
use crate::containment::cgroup::fault as leaf_fault;
use crate::containment::cgroup::test_support::FakeLeaf;
crate::tokio::test_runtime::assert_current_thread();
let name = "cosca-armed-drop-dying-member";
let (fake, leaf) = linux::fake_leaf(name, true);
let events = fake.events.clone();
let _release = leaf_fault::set_before_drain_block(move || FakeLeaf::set_populated(&events, false));
let (child, teardown) = released_blocker();
let (steps, levels) = linux::dropped(linux::contained_by(child, leaf), name);
assert!(!fake.leaf.exists(), "the drained leaf must be removed: {steps:?}");
assert_eq!(levels, Vec::<log::Level>::new(), "{steps:?}");
teardown.assert_killed();
}
#[cfg(target_os = "linux")]
#[skuld::test]
async fn tokio_armed_drop_warns_once_when_the_reap_waits_past_1s(#[fixture(tracer_group)] _group: &Group) {
use crate::test_support::foreign_tracer::{self, await_blocked_or_finished, Holder, REAP};
crate::log_capture::install();
let (child, stdin) = foreign_tracer::spawn_tokio_tracee().await;
let pid = child.pid();
let root = Root::of(&child);
let mut tracer = foreign_tracer::spawn_helper(pid);
let needle = format!("async child {pid}");
let mark = crate::log_capture::mark();
let (holder, warns) = std::thread::scope(|s| {
let (tid_tx, tid_rx) = std::sync::mpsc::channel();
let dropper = s.spawn(move || {
tid_tx
.send(rustix::thread::gettid().as_raw_nonzero().get())
.expect("report the tid");
let _warn = super::fault::warn_slow_teardowns();
let teardown = crate::child::spawn::fault::release_between_kill_and_wait(stdin);
drop(child);
teardown.assert_killed();
});
let tid = tid_rx.recv().expect("the dropper's tid");
let holder = await_blocked_or_finished(tid);
let warns: Vec<_> = crate::log_capture::records_since(mark, &needle)
.into_iter()
.filter(|text| text.contains("still waiting"))
.collect();
tracer.send(REAP);
tracer.expect("reaped");
dropper.join().expect("the dropper");
(holder, warns)
});
assert_eq!(
holder,
Holder::Blocked,
"the drop returned while the tracer still held the zombie"
);
assert_eq!(warns.len(), 1, "one warn before the blocking wait: {warns:?}");
assert!(root.reaped(), "the drop reaps the root once the tracer lets go");
assert_eq!(
crate::log_capture::levels_since(mark, "still waiting"),
[log::Level::Warn],
"exactly one warn, at warn"
);
}
#[cfg(target_os = "linux")]
#[skuld::test]
async fn tokio_armed_drop_whose_tree_kill_fails_does_not_wait_for_the_drain() {
use std::cell::{Cell, RefCell};
use std::rc::Rc;
use super::child_drop_tests::linux;
use crate::containment::cgroup::fault as leaf_fault;
use crate::containment::cgroup::test_support::FakeLeaf;
crate::tokio::test_runtime::assert_current_thread();
let name = "cosca-armed-drop-failed-tree-kill";
let (fake, leaf) = linux::fake_leaf(name, true);
let (child, stdin) = blocker();
let teardown = crate::child::spawn::fault::record_teardown_reaps();
let failing = Rc::new(RefCell::new(Some(leaf_fault::fail_kill_writes_releasing_at_wait(
move || drop(stdin),
))));
let waited = Rc::new(Cell::new(false));
let release = Rc::new(RefCell::new(None));
let (path, events) = (fake.leaf.clone(), fake.events.clone());
let (until_rmdir, armed_at_rmdir) = (Rc::clone(&failing), Rc::clone(&release));
let (flag, drain_events) = (Rc::clone(&waited), fake.events.clone());
leaf_fault::set_rmdir_hook(move |_| {
if let Some(failing) = until_rmdir.borrow_mut().take() {
drop(failing);
let (flag, events) = (Rc::clone(&flag), drain_events.clone());
*armed_at_rmdir.borrow_mut() = Some(leaf_fault::set_before_drain_block(move || {
flag.set(true);
FakeLeaf::set_populated(&events, false);
}));
}
FakeLeaf::rmdir(&path, &events)
});
let root = Root::of(&child);
let mark = crate::log_capture::mark();
let (steps, levels) = linux::dropped(linux::contained_by(child, leaf), name);
drop(failing.borrow_mut().take());
assert!(root.reaped(), "the root's own kill landed, so it is reaped: {steps:?}");
teardown.assert_killed();
assert!(!waited.get(), "nothing may wait for the drain: {steps:?}");
assert!(fake.leaf.exists(), "the undrained leaf is left behind: {steps:?}");
assert_eq!(
crate::log_capture::levels_since(mark, "still waiting"),
Vec::<log::Level>::new(),
"{steps:?}"
);
assert!(
levels.contains(&log::Level::Warn),
"the leaf left behind is named: {steps:?}"
);
}
#[cfg(target_os = "linux")]
#[skuld::test]
async fn tokio_armed_drop_whose_tree_kill_fails_after_a_landed_kill_waits_for_the_drain() {
use super::child_drop_tests::linux;
use crate::containment::cgroup::fault as leaf_fault;
use crate::containment::cgroup::test_support::FakeLeaf;
crate::tokio::test_runtime::assert_current_thread();
let name = "cosca-armed-drop-failed-write-after-landed-kill";
let (fake, leaf) = linux::fake_leaf(name, true);
let events = fake.events.clone();
let _release = leaf_fault::set_before_drain_block(move || FakeLeaf::set_populated(&events, false));
let (child, teardown) = released_blocker();
let mut child = linux::contained_by(child, leaf);
child.kill_tree().expect("the first kill lands");
assert_eq!(fake.kill_written(), b"1", "the handle's kill landed");
let _drop_kill_fails = leaf_fault::fail_next_kill_write();
let mark = crate::log_capture::mark();
let (steps, _) = linux::dropped(child, name);
teardown.assert_killed();
assert!(
!fake.leaf.exists(),
"the landed kill bounds the drain, so the leaf is removed: {steps:?}"
);
assert_eq!(
crate::log_capture::levels_since(mark, "contained-tree teardown did not fully succeed"),
[log::Level::Warn],
"the drop's failed write is still warned of"
);
}
#[cfg(target_os = "linux")]
#[skuld::test]
async fn an_awaited_teardown_whose_tree_kill_fails_gives_up_the_leaf_without_waiting() {
use super::child_drop_tests::linux;
use crate::containment::cgroup::fault as leaf_fault;
use crate::containment::cgroup::test_support::FakeLeaf;
crate::tokio::test_runtime::assert_current_thread();
let name = "cosca-awaited-teardown-failed-tree-kill";
let (fake, leaf) = linux::fake_leaf(name, true);
let events = fake.events.clone();
let _release = leaf_fault::set_before_drain_block(move || FakeLeaf::set_populated(&events, false));
let _tree_kill_fails = leaf_fault::fail_next_kill_write();
let (child, released) = released_blocker();
let root = Root::of(&child);
let mut child = linux::contained_by(child, leaf);
let mark = crate::log_capture::mark();
child.tear_down_awaiting().await;
leaf_fault::take_rmdir_hook();
released.assert_killed();
assert!(root.reaped(), "the root's own kill landed, so it is reaped");
assert_eq!(fake.kill_written(), b"", "the failed kill is not written again");
assert!(
fake.leaf.exists(),
"the leaf the failed kill left running is left behind"
);
let warns = crate::log_capture::records_since(mark, "cgroup.kill failed");
assert_eq!(warns.len(), 1, "the failed kill is warned once: {warns:?}");
}
#[cfg(target_os = "linux")]
#[skuld::test]
async fn tokio_armed_drop_warns_once_when_the_drain_is_slow() {
use super::child_drop_tests::linux;
crate::tokio::test_runtime::assert_current_thread();
let name = "cosca-armed-drop-slow-drain";
let child = reaped_blocker().await;
let (fake, leaf) = linux::fake_leaf(name, true);
let needle = format!("async child {}", child.pid());
let mark = crate::log_capture::mark();
let (warned_at_release, release) = release_from_the_blocking_wait(&fake, name, needle, mark);
let _warn = super::fault::warn_slow_teardowns_after(std::time::Duration::ZERO);
let (steps, _) = linux::dropped(linux::contained_by(child, leaf), name);
drop(release.borrow_mut().take());
assert_eq!(
warned_at_release.get(),
Some(1),
"the drop must wait for the drain past its warn, with one warn naming the leaf by then: {steps:?}"
);
assert!(!fake.leaf.exists(), "the drained leaf is removed: {steps:?}");
assert_eq!(
crate::log_capture::levels_since(mark, "still waiting"),
[log::Level::Warn],
"exactly one warn"
);
}
#[cfg(target_os = "linux")]
#[skuld::test]
fn a_failed_run_to_completion_helper_awaits_its_teardown() {
use std::cell::Cell;
use std::rc::Rc;
use super::child_drop_tests::linux;
use crate::containment::cgroup::fault as leaf_fault;
use crate::containment::cgroup::test_support::FakeLeaf;
let rt = ::tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.expect("current_thread runtime");
let name = "cosca-awaited-teardown";
let (fake, leaf) = linux::fake_leaf(name, true);
let released_by = Rc::new(Cell::new(None));
let (path, events, by) = (fake.leaf.clone(), fake.events.clone(), Rc::clone(&released_by));
leaf_fault::set_rmdir_hook(move |_| {
if by.get().is_none() {
by.set(Some("the leaf's rmdir"));
FakeLeaf::set_populated(&events, false);
}
FakeLeaf::rmdir(&path, &events)
});
let (blocking_tx, blocking_rx) = ::tokio::sync::oneshot::channel();
let _wake = leaf_fault::set_before_drain_block(move || {
_ = blocking_tx.send(());
});
let (events, by) = (fake.events.clone(), Rc::clone(&released_by));
let other_task = async move {
if blocking_rx.await.is_ok() && by.get().is_none() {
by.set(Some("another task"));
FakeLeaf::set_populated(&events, false);
}
};
let (error, teardown) = rt.block_on(async {
let (child, teardown) = released_blocker();
let mut child = linux::contained_by(child, leaf);
let failed =
crate::tokio::command::after_the_spawn(crate::error::Error::Io(std::io::Error::other("pump")), &mut child);
(::tokio::join!(failed, other_task).0, teardown)
});
leaf_fault::take_rmdir_hook();
teardown.assert_killed();
assert_eq!(
released_by.get(),
Some("another task"),
"the runtime must run another task while the teardown waits"
);
assert!(!fake.leaf.exists(), "the drained leaf is removed");
match error {
crate::error::Error::MayHaveStarted { fate, .. } => assert_eq!(fate, ChildFate::Reaped),
other => panic!("expected MayHaveStarted, got {other:?}"),
}
}
#[cfg(target_os = "linux")]
#[skuld::test]
fn a_dropped_awaited_teardown_finishes_as_the_drop_would() {
use super::child_drop_tests::linux;
use crate::containment::cgroup::fault as leaf_fault;
use crate::containment::cgroup::test_support::FakeLeaf;
let rt = ::tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.expect("current_thread runtime");
let name = "cosca-dropped-awaited-teardown";
let (fake, leaf) = linux::fake_leaf(name, true);
let events = fake.events.clone();
let _release = leaf_fault::set_before_drain_block(move || FakeLeaf::set_populated(&events, false));
let _tree_kill_fails = leaf_fault::fail_next_kill_write();
let pending = super::fault::pend_awaited_reap();
let mark = crate::log_capture::mark();
let (root, released) = rt.block_on(async {
let (child, released) = released_blocker();
let root = Root::of(&child);
let mut child = linux::contained_by(child, leaf);
let mut teardown = std::pin::pin!(child.tear_down_awaiting());
::tokio::select! {
biased;
_ = &mut teardown => panic!("the awaited reap never completes"),
() = std::future::ready(()) => {}
}
(root, released)
});
leaf_fault::take_rmdir_hook();
released.assert_killed();
assert!(pending.taken(), "the teardown must have been awaiting the reap");
assert_eq!(
crate::log_capture::levels_since(mark, "contained-tree teardown did not fully succeed"),
[log::Level::Warn],
"the dropped teardown must still emit the drop's report"
);
assert!(root.reaped(), "the dropped teardown must reap the root");
assert_eq!(fake.kill_written(), b"", "the failed kill is not written again");
assert!(
fake.leaf.exists(),
"the leaf the failed kill left running is left behind"
);
let warns = crate::log_capture::records_since(mark, "cgroup.kill failed");
assert_eq!(warns.len(), 1, "the failed kill is warned once: {warns:?}");
}
#[cfg(target_os = "linux")]
#[skuld::test]
fn a_teardown_dropped_during_the_drain_warns_once() {
use super::child_drop_tests::linux;
use crate::containment::cgroup::fault as leaf_fault;
let rt = ::tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.expect("current_thread runtime");
let name = "cosca-teardown-dropped-in-drain";
let (fake, leaf) = linux::fake_leaf(name, true);
let mark = crate::log_capture::mark();
let _warn = super::fault::warn_slow_teardowns_after(std::time::Duration::ZERO);
let (draining_tx, draining_rx) = ::tokio::sync::oneshot::channel();
let _draining = leaf_fault::set_before_drain_block(move || {
_ = draining_tx.send(());
});
let (fate, warned_at_release, release, killed) = rt.block_on(async {
let (child, killed) = released_blocker();
let needle = format!("async child {}", child.pid());
let (warned_at_release, release) = release_from_the_blocking_wait(&fake, name, needle, mark);
let mut child = linux::contained_by(child, leaf);
let teardown = child.tear_down_awaiting();
let fate = ::tokio::select! {
biased;
fate = teardown => Some(fate),
_ = draining_rx => None,
};
(fate, warned_at_release, release, killed)
});
leaf_fault::take_rmdir_hook();
drop(release.borrow_mut().take());
killed.assert_killed();
assert_eq!(fate, None, "the teardown must still be awaiting the drain");
assert_eq!(
warned_at_release.get(),
Some(1),
"the dropped teardown must wait for the drain past its warn, with one warn naming the leaf by then"
);
assert!(!fake.leaf.exists(), "the drained leaf is removed");
assert_eq!(
crate::log_capture::levels_since(mark, "still waiting"),
[log::Level::Warn],
"exactly one warn"
);
}
#[cfg(target_os = "linux")]
#[skuld::test]
fn a_teardown_whose_drain_watch_fails_warns_once() {
use super::child_drop_tests::linux;
use crate::containment::cgroup::fault as leaf_fault;
let rt = ::tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
.expect("current_thread runtime");
let name = "cosca-teardown-drain-watch-fails";
let (fake, leaf) = linux::fake_leaf(name, true);
let mark = crate::log_capture::mark();
let _warn = super::fault::warn_slow_teardowns_after(std::time::Duration::ZERO);
let _watch_fails = super::fault::fail_drain_watch();
let (fate, warned_at_release, release, killed) = rt.block_on(async {
let (child, killed) = released_blocker();
let needle = format!("async child {}", child.pid());
let (warned_at_release, release) = release_from_the_blocking_wait(&fake, name, needle, mark);
let mut child = linux::contained_by(child, leaf);
(child.tear_down_awaiting().await, warned_at_release, release, killed)
});
leaf_fault::take_rmdir_hook();
drop(release.borrow_mut().take());
killed.assert_killed();
assert_eq!(fate, ChildFate::Reaped);
assert_eq!(
warned_at_release.get(),
Some(1),
"the teardown must wait for the drain past its warn, with one warn naming the leaf by then"
);
assert!(!fake.leaf.exists(), "the drained leaf is removed");
assert_eq!(
crate::log_capture::levels_since(mark, "still waiting"),
[log::Level::Warn],
"exactly one warn"
);
}
#[cfg(target_os = "linux")]
async fn reaped_blocker() -> Child {
let (mut child, stdin) = blocker();
drop(stdin);
child.wait().await.expect("the blocker exits once its stdin closes");
child
}
#[cfg(target_os = "linux")]
#[allow(clippy::type_complexity, reason = "a test helper's two shared cells")]
fn release_from_the_blocking_wait(
fake: &crate::containment::cgroup::test_support::FakeLeaf,
name: &'static str,
needle: String,
mark: usize,
) -> (
std::rc::Rc<std::cell::Cell<Option<usize>>>,
std::rc::Rc<std::cell::RefCell<Option<crate::oneshot_hook::Armed>>>,
) {
use std::cell::{Cell, RefCell};
use std::rc::Rc;
use crate::containment::cgroup::fault as leaf_fault;
use crate::containment::cgroup::test_support::FakeLeaf;
let warned_at_release = Rc::new(Cell::new(None));
let release: Rc<RefCell<Option<crate::oneshot_hook::Armed>>> = Rc::default();
let (path, events) = (fake.leaf.clone(), fake.events.clone());
let (seen, armed) = (Rc::clone(&warned_at_release), Rc::clone(&release));
leaf_fault::set_rmdir_hook(move |_| {
if armed.borrow().is_none() {
let (seen, events, needle) = (Rc::clone(&seen), events.clone(), needle.clone());
*armed.borrow_mut() = Some(leaf_fault::set_before_drain_block(move || {
let warns = crate::log_capture::records_since(mark, &needle)
.into_iter()
.filter(|text| text.contains("still waiting") && text.contains(name))
.count();
seen.set(Some(warns));
FakeLeaf::set_populated(&events, false);
}));
}
FakeLeaf::rmdir(&path, &events)
});
(warned_at_release, release)
}
#[cfg(target_os = "linux")]
#[skuld::test]
async fn tokio_armed_drop_whose_drain_pump_cannot_start_warns_once() {
use super::child_drop_tests::linux;
use crate::containment::cgroup::fault as leaf_fault;
crate::tokio::test_runtime::assert_current_thread();
let name = "cosca-armed-drop-pump-refused";
let child = reaped_blocker().await;
let (fake, leaf) = linux::fake_leaf(name, true);
let needle = format!("async child {}", child.pid());
let mark = crate::log_capture::mark();
let (warned_at_release, release) = release_from_the_blocking_wait(&fake, name, needle, mark);
let _warn = super::fault::warn_slow_teardowns_after(std::time::Duration::ZERO);
let _no_pump = leaf_fault::fail_pump_starts();
let (steps, _) = linux::dropped(linux::contained_by(child, leaf), name);
drop(release.borrow_mut().take());
assert_eq!(
warned_at_release.get(),
Some(1),
"one warn naming the leaf, out before its member was released: {steps:?}"
);
assert!(!fake.leaf.exists(), "the drained leaf is removed: {steps:?}");
}
#[cfg(target_os = "macos")]
#[skuld::test]
async fn macos_tokio_armed_drop_warns_once_when_the_reap_is_slow() {
use std::cell::RefCell;
use std::rc::Rc;
use crate::os_process::child::PeekOutcome;
use crate::wait::exit_only::seams::{assert_peeks_exhausted, force_peeks, Forced};
crate::log_capture::install();
let (child, _stdin) = blocker();
let pid = child.pid();
let root = Root::of(&child);
let mark = crate::log_capture::mark();
let forced: Rc<RefCell<Option<Forced>>> = Rc::default();
let _look = super::fault::set_before_reap_look({
let forced = Rc::clone(&forced);
move || *forced.borrow_mut() = Some(force_peeks([Ok(PeekOutcome::Running), Ok(PeekOutcome::Running)]))
});
let _warn = super::fault::warn_slow_teardowns_after(std::time::Duration::ZERO);
drop(child);
assert_peeks_exhausted();
drop(forced.borrow_mut().take());
let warns: Vec<_> = crate::log_capture::records_since(mark, &format!("async child {pid}"))
.into_iter()
.filter(|text| text.contains("still waiting"))
.collect();
assert_eq!(warns.len(), 1, "one warn, and the wait goes on: {warns:?}");
assert!(root.reaped(), "the drop reaps the root past its warn");
}
#[cfg(target_os = "linux")]
#[skuld::test]
fn a_test_warns_past_the_production_threshold_only_with_a_guard() {
assert_eq!(super::slow_teardown_after(), None);
{
let _production = super::fault::warn_slow_teardowns();
assert_eq!(super::slow_teardown_after(), Some(std::time::Duration::from_secs(1)));
}
{
let _zero = super::fault::warn_slow_teardowns_after(std::time::Duration::ZERO);
assert_eq!(super::slow_teardown_after(), Some(std::time::Duration::ZERO));
}
assert_eq!(super::slow_teardown_after(), None);
}