Skip to main content

failpoint

Macro failpoint 

Source
macro_rules! failpoint {
    ($name:expr) => { ... };
    ($name:expr, $closure:expr) => { ... };
}
Expand description

Synchronous failpoint injection site.

With the failpoints feature on, forwards to fail::fail_point! so a test can arm a panic, an error return, a pause, or a sleep at the named site. With it off, both forms expand to () — zero code, and fail is not linked. The expansion routes through $crate::fail, so consumers only need a dependency on this crate (with the feature forwarded), never on fail itself.

The single-argument form supports panic, pause, sleep(ms), and print. The closure form additionally supports return / return(string) and must yield the enclosing function’s exact return type — see docs/failpoint-testing.md.