tikv / fail-rs

Fail points for rust
Apache License 2.0
332 stars 39 forks source link

Support customized logic for FAILPOINTS tasks #72

Open quark-zju opened 1 year ago

quark-zju commented 1 year ago

See also commit messages.

I'd like to add 2 primitives to construct interesting race conditions between processes:

There does not seem to be a generic/portable way to implement them. But with certain assumptions like $TESTING_TEMP is a directory that can be freely written to for communication, it is possible to implement above feature. This PR adds a way so applications can implement their needs and get the logic exposed via the FAILPOINTS environment variable.


Side note:

It almost seems that there are 2 different use-cases of fail:

The "callback" flexibility seems exclusive to library testing. This change closes the gap so application testing can get similar flexibility.