Tests: add waitforfile() and waitforsocket() functions. This functions add ability to wait for external daemons to start before running tests.