The "check" target is a bit rigid in automake, since it depends on its behavior for other things.
The easiest solution seems to customize the test driver, since it's the one responsible for redirecting the output to log files. I'm assuming you are using the default test driver, so open it up around line 111 or so, and you should see something like this:
# Report outcome to console.
echo "${col}${res}${std}: $test_name"
Just append those lines somewhere after that (like at the end of the script):
if test $estatus != 0
then
sed -e "s/^/$log_file:\t/" $log_file # but a cat is fine too
fi
Remember to add this customized test driver to your source control.
For the record, here's something that won't work: defining a check-local
rule that runs cat $TEST_LOGS
from the makefile itself won't work because automake stops as soon as the test fail, and you can only hook up check-local
, which is run only if check-TESTS
succeeds.