tests: respect $HOME if possible

This way it is possible to clutter the real $HOME of the user.