Travis: Move logic into local functions.

Run ccache and build from the same block to control the result code.
Set CLING_BUILD_TIMEOUT in timeout. (+1 squashed commit)
Add ability to view / export CCACHE_LOGFILE.

Signed-off-by: Vassil Vassilev <vvasilev@cern.ch>
This commit is contained in:
Roman Zulak 2016-08-16 00:00:31 -04:00 committed by sftnight
parent 260393e99c
commit f7983e7751
2 changed files with 39 additions and 11 deletions

View File

@ -211,7 +211,19 @@ install:
fi
# Implement a platform-independent timeout function.
function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; }
function timeout() {
perl -e 'alarm shift; exec @ARGV' "$@";
RESULT=$?
if [ $RESULT -eq 142 ]; then
# Timout occured, pass that on to after_failure so as not to dump logs
export CLING_BUILD_TIMEOUT=1
fi
return $RESULT
}
# If we timeout, objects can be corrupted in the cache, causing link errors
# Turn this on to get the mapping to the cache.o to delete
# export CCACHE_LOGFILE="$CLING_USER_ROOT/ccache.log"
if [ ! -f $CMAKE ]; then
mkdir -pv $CLING_BUILD_DEPS/cmake
@ -225,6 +237,17 @@ before_script:
script:
- |
# Save our build result and propogate it to Travis
# When build succeeds, but ccache fails that should return an error
function run_ccache() {
ccache -s
CCACHE_RSLT="$?"
if [ "$1" -eq 0 ]; then
return $CCACHE_RSLT
fi
return $1
}
if [ -z $TRAVIS_TAG ]; then
if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
# Move the tag to newest master
@ -237,16 +260,7 @@ script:
tools/packaging/cpt.py --tarball-tag=$TRAVIS_TAG --with-cling-url=https://github.com/$TRAVIS_REPO_SLUG
fi
### Fail if build not complete, but mark it as such for later
RESULT=$?
if [ $RESULT -ne 0 ]; then
if [ $RESULT -eq 142 ]; then
export CLING_BUILD_TIMEOUT=1
fi
exit $RESULT
fi
- ccache -s
run_ccache "$?"
notifications:
email:
@ -282,6 +296,11 @@ deploy:
repo: $TRAVIS_REPO_SLUG
after_failure:
- |
if [ -n "$CCACHE_LOGFILE" ]; then
echo "ccache log stored to:"
cat "$CCACHE_LOGFILE" | curl -sT - chunk.io
fi
- |
if [ "$CLING_BUILD_TIMEOUT" != "1" ]; then
echo "Dumping env."

View File

@ -425,8 +425,17 @@ def compile(arg):
else:
box_draw('Configure Cling with CMake')
# Don't pollute the CCACHE_LOGFILE with CMake config
CCACHE_LOGFILE = os.environ.get('CCACHE_LOGFILE', None)
if CCACHE_LOGFILE:
del os.environ['CCACHE_LOGFILE']
exec_subprocess_call((CMAKE or 'cmake') + ' ' + cmake_config_flags, LLVM_OBJ_ROOT)
# Start the logging, we currently don't log libcpp being built above
if CCACHE_LOGFILE:
os.environ['CCACHE_LOGFILE'] = CCACHE_LOGFILE
box_draw('Building Cling (using {0} cores)'.format(cores))
make_command = 'make -j{0} cling'.format(cores)
if args['verbose']: