I noticed that according to the doc tests.log should contain stdout as well as stderr. But it doesn't because stdout isn't flushed. I removed buffering completely to avoid having to call fflush twice.
Backport of secp256k1 PR685.
Depends on D5433.
It slightly varies from the PR by only printing the logs in the event of
a failure.
There is no need to explicitly cat the logs with the cmake build because
they are already printed by the test runner in case of failure.
Before: https://travis-ci.org/Fabcien/secp256k1/jobs/658610743
After: https://travis-ci.org/Fabcien/secp256k1/jobs/658631083