unittest: make check use a qa/log dir for logging

This patch is using the qa/log directory to store the output
of the check. In case of success, the directory is deleted.
In case of failure, the directory remains in place.

I've tried output in a temporary directory outside of the tree. But I did not find how to clean it correctly.

This should fixes #910.