These tests are purely based on my expectations from reading the documentation provided on Oracle's website. It covers the following scenarios:
- trivial_test: Basically functions, iterates in order.
- early_term_test: Early termination works, and returns the non-0 return value from the callback.
- gap_test: Tests that fdwalk will infact skip over gaps if some intermediate fds have been closed.
- rlim_test: Ensure that we're not being artifically limited to walking fds lower than the RLIMIT_NOFILE specified.
- concur_test: Tests that fdwalk(3) is walking over a snapshot of the fd space from when it started.
- same_thr_test: Ditto that, except open the extra fds in the same thread instead of a concurrent thread
- empty_test: empty fd table should result in no callback, and return 0
The rlimit test isn't strictly necessary, but it was inspired by the Oracle documentation pointing out that closefrom doesn't actually behave like their example because it's not limiting itself to closing only those under RLIMIT_NOFILE. It's really just testing that we're not artificially limited by an rlimit in what we can walk.