Add background service synchronization mechanism for testing

To avoid code that waits some arbitrary amount of time for background
services to do asynchronous work (e.g. maildelivery delivering pending
mail or branchtracker updating a branch) and thus risks test flakes
due to timing issues, add a mechanism using which tests can wait for
a given background service to return to an idle state.

The mechanism is fairly simple: create a file named <pidfile_path>.busy,
send SIGUSR1 to the service process, and then wait for the .busy file to
be deleted.

Alternatively, SIGUSR2 can be sent to force the service to also run its
maintenance tasks before reporting that it's idle.  This is not currently
used, but will be useful for testing specific maintenance tasks.
Check background service logs for errors when testing

After each test, check and report any errors (or warnings) written to
any background service's log.