tests: create a new HOME directory for each test

Create a new temporary directory in each test, and use it for HOME.
This way, tests will not stomp on each other's feet.

Also, respect TMPDIR so /tmp is not hardcoded with no way to change it.