travis fix: only output last 1000 lines on error

This commit is contained in:
Job Evers-Meltzer 2016-08-08 10:02:46 -05:00
parent 774246d16f
commit cbb6acd75c

View file

@ -31,6 +31,9 @@ BUILD_DEPENDENCIES=true
BUILD_LBRYCRD=true BUILD_LBRYCRD=true
TIMEOUT=false TIMEOUT=false
THREE_MB=3145728 THREE_MB=3145728
# this flag gets set to False if
# the script exits due to a timeout
OUTPUT_LOG=true
while getopts :crldoth:w:d: FLAG; do while getopts :crldoth:w:d: FLAG; do
case $FLAG in case $FLAG in
@ -116,6 +119,7 @@ function exit_at_45() {
fi fi
if [ "$TIMEOUT" = true ] && (( TIME > TIMEOUT_SECS )); then if [ "$TIMEOUT" = true ] && (( TIME > TIMEOUT_SECS )); then
echo 'Exiting at 45 minutes to allow the cache to populate' echo 'Exiting at 45 minutes to allow the cache to populate'
OUTPUT_LOG=false
exit 1 exit 1
fi fi
fi fi
@ -159,11 +163,11 @@ function background() {
function cleanup() { function cleanup() {
rv=$? rv=$?
# cat the log file if it exists # cat the log file if it exists
if [ -f "$2" ]; then if [ -f "$2" ] && [ "${OUTPUT_LOG}" = true ]; then
echo echo
echo "Output of log file $2" echo "Output of log file $2"
echo echo
tail -c $THREE_MB "$1" tail -n 1000 "$2"
echo echo
fi fi
# delete the build directory # delete the build directory
@ -175,14 +179,15 @@ function cleanup() {
function cat_and_exit() { function cat_and_exit() {
rv=$? rv=$?
# cat the log file if it exists # cat the log file if it exists
if [ -f "$1" ]; then if [ -f "$1" ] && [ "${OUTPUT_LOG}" = true ]; then
echo echo
echo "Output of log file $1" echo "Output of log file $1"
echo echo
# log size is limited to 4MB on travis # This used to be the last 3MB but outputing that
# so hopefully the last 3MB is enough # caused problems on travis.
# Hopefully the last 1000 lines is enough
# to debug whatever went wrong # to debug whatever went wrong
tail -c $THREE_MB "$1" tail -n 1000 "$1"
echo echo
fi fi
exit $rv exit $rv