tlist: remove type arg from tlist_top(), tlist_tail() With the type canary, it's unnecessary. Though the implementation is a bit more awkward since they longer map directly through to list_top/tail.
failtest: save and restore file state inside child (on-demand) We currently save all files in the parent, and restore them once the child is gone. That doesn't work in a case where the child manipulates a file the parent doesn't currently have open, so switch to a model where the child cleans itself up, using the already-existing cleanup callbacks. This means that we need to undo much more, especially restoring file offsets. We also need to handle the case where we've already closed the file, and now we're cleaning up. As a bonus, we now handle open() with O_TRUNC properly. The cleanup function now has two modes: one simply frees (so valgrind doesn't complain about failtest leaking so the user can see real leaks in their programs), the other restores things so the parent sees no changes.
failtest: catch mmap. mmap can also fail on out-of-memory, and for the coming change to the way we save and restore files we want to know about them anyway.
failtest: internally eliminate duplicate calls. If we can get a backtrace, we can automatically eliminate identical failures. Surprisingly backtrace() is quite fast, but the savings for the (naively-written) rbtree tests are impressive. ccanlint -v time drops from 43 seconds to 6 seconds.
failtest: use a linked list for history, not an array. This avoids a silly realloc, but more importantly it gets us closer to being runtime extensible, as each history element can be a different size.
failtest: use 64 bit offsets if available. We have to be consistent with the caller, so turn on 64 bit offsets if available for both the caller and us.
various: add LICENSE comments.
failtest: failtest_has_failed() Allows tests to explicitly avoid continuing when a failure has been injected.
failtest: include config.h first It's now important, since it defines _GNU_SOURCE.
failtest: hook can return FAIL_PROBE tdb2 has various places where it recovers from failure (eg. falling back when it can't open /dev/urandom, or allocation for error logging). We want to test those paths, but doing so thoroughly causes cominatorial explosion. Add FAIL_PROBE for such cases: in this case it goes only 3 more calls deep.
failtest: record close events We trap them, might as well put them in history. This also makes tracking open file descriptors more robust.
failtest: rely on the save/restore of files, don't use write cleanup.
failtest: generic cleanup hooks Each function in the history stores a cleanup function, rather than storing extra structures. In particular, we save writes and file offsets using this.
failtest: capture pread/pwrite
failtest: fcntl handling Catch fcntl, particularly fcntl locks.
failtest: new module. A module designed to help test "never fails" functions like malloc.