Add a check to fail the job if compiling takes too long.

The intent behind this is that, if there most likely wouldn't be enough time left to complete the unit tests anyway, then just fail the job after compiling so the cache can be updated.  Otherwise, if the unit tests were run and the job timed out, then the cache would not be uploaded at all and the next time the job ran it would be from scratch again.

(cherry-picked from commit 5d970e40cd)
This commit is contained in:
pentarctagon 2018-04-14 01:17:44 -05:00 committed by Jyrki Vesterinen
parent b2cca08257
commit 83a2457dd8

View file

@ -19,11 +19,12 @@ BOOST_TEST="${11}"
LTO="${12}"
SAN="${13}"
# only enable strict builds when no optimizations are done
if [ "$EXTRA_FLAGS_RELEASE" == "-O0" ]; then
STRICT="true"
build_timeout=35
else
STRICT="false"
build_timeout=40
fi
echo "Using configuration:"
@ -50,6 +51,8 @@ if [ "$NLS" == "true" ]; then
scons translations build=release --debug=time nls=true jobs=2
fi
else
build_start=$(date +%s)
if [ "$TOOL" == "cmake" ]; then
echo "max_size = 200M" > $HOME/.ccache/ccache.conf
echo "compiler_check = content" >> $HOME/.ccache/ccache.conf
@ -74,6 +77,12 @@ else
exit $BUILD_RET
fi
build_end=$(date +%s)
if (( build_end-build_start > 60*build_timeout )); then
echo "Insufficient time remaining to execute unit tests. Exiting now to allow caching to occur. Please restart the job."
exit 1
fi
# needed since docker returns the exit code of the final command executed, so a failure needs to be returned if any unit tests fail
EXIT_VAL=0