We need to be able to test some more restart behavior that depends on
knowing specifically where we're at (inside the event loop or outside of the
event loop). Truncate the pidfile until the process is restarted to give
the test a clean marker rather than having to add arbitrary delays and
hoping for the best.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
rather than having to add arbitrary delays and hoping for the best.
From my reading, the test is still kinda doing that - daemon will sleep for 1s in between restarts by default, so that gives you a short window to check for a truncated pidfile. Were you going to take advantage of this change in other tests?
I think this change is probably ok, but I don't quite understand the justification.
usr.sbin/daemon/daemon.c | ||
---|---|---|
538 | Is there a specific reason we don't just unlink the child pidfile? | |
854 | This could reasonably live in libutil, but it's simple enough that this is fine for now. |
usr.sbin/daemon/daemon.c | ||
---|---|---|
538 | The pidfile API takes a lock on the pidfile while we have it open- I wanted to avoid opening the opportunity for another daemon(8) to pop in and take the path since this is pretty much just an aide for testing. |