test-release.sh: Defer test errors until the end

This makes the script run to the end and produce tarballs even on test
failures, and then highlights any errors afterwards.

(I first tried just storing the errors in a global variable, but that
didn't work as the "test_llvmCore" function invocation is actually
running as a sub-shell.)

Differential Revision: http://reviews.llvm.org/D11478

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243116 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Hans Wennborg
2015-07-24 16:16:09 +00:00
parent 15e1e7f179
commit b8f373eb60

View File

@@ -208,6 +208,16 @@ if [ $RC != "final" ]; then
fi fi
Package=$Package-$Triple Package=$Package-$Triple
# Errors to be highlighted at the end are written to this file.
echo -n > $LogDir/deferred_errors.log
function deferred_error() {
Phase="$1"
Flavor="$2"
Msg="$3"
echo "[${Flavor} Phase${Phase}] ${Msg}" | tee -a $LogDir/deferred_errors.log
}
# Make sure that a required program is available # Make sure that a required program is available
function check_program_exists() { function check_program_exists() {
local program="$1" local program="$1"
@@ -367,13 +377,17 @@ function test_llvmCore() {
ObjDir="$3" ObjDir="$3"
cd $ObjDir cd $ObjDir
${MAKE} -j $NumJobs -k check-all \ if ! ( ${MAKE} -j $NumJobs -k check-all \
2>&1 | tee $LogDir/llvm.check-Phase$Phase-$Flavor.log 2>&1 | tee $LogDir/llvm.check-Phase$Phase-$Flavor.log ) ; then
deferred_error $Phase $Flavor "check-all failed"
fi
if [ "$use_autoconf" = "yes" ]; then if [ "$use_autoconf" = "yes" ]; then
# In the cmake build, unit tests are run as part of check-all. # In the cmake build, unit tests are run as part of check-all.
${MAKE} -k unittests \ if ! ( ${MAKE} -k unittests 2>&1 | \
2>&1 | tee $LogDir/llvm.unittests-Phase$Phase-$Flavor.log tee $LogDir/llvm.unittests-Phase$Phase-$Flavor.log ) ; then
deferred_error $Phase $Flavor "unittests failed"
fi
fi fi
cd $BuildDir cd $BuildDir
@@ -538,4 +552,13 @@ else
echo "### Package: $Package.tar.xz" echo "### Package: $Package.tar.xz"
fi fi
echo "### Logs: $LogDir" echo "### Logs: $LogDir"
echo "### Errors:"
if [ -s "$LogDir/deferred_errors.log" ]; then
cat "$LogDir/deferred_errors.log"
exit 1
else
echo "None."
fi
exit 0 exit 0