Skip to main content

tsoracle_server/
failpoint.rs

1//! Per-crate failpoint wrapper. See `docs/failpoint-testing.md` for the
2//! conventions enforced here: source sites never reference `fail::` directly;
3//! they go through `crate::failpoint!`.
4//!
5//! With `feature = "failpoints"` off, both forms expand to `()` and the
6//! `fail` crate is not in the build graph.
7
8#[cfg(feature = "failpoints")]
9#[macro_export]
10macro_rules! failpoint {
11    ($name:expr) => {
12        fail::fail_point!($name)
13    };
14    ($name:expr, $closure:expr) => {
15        fail::fail_point!($name, $closure)
16    };
17}
18
19#[cfg(not(feature = "failpoints"))]
20#[macro_export]
21macro_rules! failpoint {
22    ($name:expr) => {
23        ()
24    };
25    ($name:expr, $closure:expr) => {
26        ()
27    };
28}