Reputation: 10215
When I build an R package under TravisCI, the last 13 lines are printed out when a test fails. To debug a problem that only occurs under Travis, I need more lines.
Where can I set the number of lines shown in the log?
Added later:
https://github.com/hadley/testthat/commit/f037f463edcccd403502308fd86e32914c6d0d0f
Looks like it is a testthat feature, but I did not understand how to switch it off.
Upvotes: 2
Views: 102
Reputation: 173577
It appears that the "number of trailing lines of test output to reproduce in the log" when running R CMD check
can be controlled by the environment variable _R_CHECK_TESTS_NLINES_
which is documented in the R Internals here.
The default value of this environment variable is 13, but if set to 0, "all lines except the R preamble are reproduced".
This answer was prompted by a blog post covering this solution by Yihui Xie.
Upvotes: 3
Reputation: 368261
You need something like this at the end of your travis.yml
:
after_failure:
- ./run.sh dump_logs
(where run.sh
is my maintained fork of the initial R-Travis).
That script (just like the travis.sh
it came from) have this code:
DumpSysinfo() {
echo "Dumping system information."
R -e '.libPaths(); sessionInfo(); installed.packages()'
}
DumpLogsByExtension() {
if [[ -z "$1" ]]; then
echo "dump_logs_by_extension requires exactly one argument, got: $@"
exit 1
fi
extension=$1
shift
package=$(find . -maxdepth 1 -name "*.Rcheck" -type d)
if [[ ${#package[@]} -ne 1 ]]; then
echo "Could not find package Rcheck directory, skipping log dump."
exit 0
fi
for name in $(find "${package}" -type f -name "*${extension}"); do
echo ">>> Filename: ${name} <<<"
cat ${name}
done
}
DumpLogs() {
echo "Dumping test execution logs."
DumpLogsByExtension "out"
DumpLogsByExtension "log"
DumpLogsByExtension "fail"
}
and I am sure you can take it from here. The 'new new' Travis surely has a setup for it too.
Upvotes: 1