Use the same logic to determine when Tor is working in the test suite as in Tails itself.

The idea is to avoid spamming the Tor control port during bootstrap,
since we've seen problems with that already.
When restarting Tor at background snapshot restore time, delete Tor log.

Otherwise, the log grepping we do in wait_until_tor_is_working will success
in all cases, while Tor is not necessarily ready yet.