From 0516a452c1e1a92be26c64a1c3905da68594fd80 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 30 Jun 2020 12:37:00 +0200 Subject: [PATCH] BUILD: explicitely stop build when compilation/linking issues Signed-off-by: Raphael Defosseux --- cmake_targets/build_oai | 1 + cmake_targets/tools/build_helper | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 91f33ea625..88b8811575 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -959,6 +959,7 @@ function main() { wait else echo_info "10. Bypassing the Tests ..." + echo_success "BUILD SHOULD BE SUCCESSFUL" fi } diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 5a59b9a8cc..b8f0125b10 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -175,8 +175,21 @@ check_warnings() { fi } +#check_errors: +# print error message if the compilation had errors +#argument: +# $1: log file +check_errors() { + #we look for 'warning:' in the compilation log file + error_count=`grep "error:" "$1" | wc -l` + if [ $error_count -gt 0 ]; then + echo_error "ERROR: $error_count error. See $1" + fi +} + compilations() { cd $OPENAIR_DIR/cmake_targets/$1/build + echo_info "Log file for compilation is being written to: $dlog/$2.$REL.txt" set +e { if [ "$BUILD_COVERITY_SCAN" == "1" ]; then @@ -193,15 +206,22 @@ compilations() { $COV_SCAN_PREFIX make -j`nproc` $2 fi fi - + ret=$? } > $dlog/$2.$REL.txt 2>&1 set -e - echo_info "Log file for compilation has been written to: $dlog/$2.$REL.txt" + if [[ $ret -ne 0 ]]; then + check_warnings "$dlog/$2.$REL.txt" + check_errors "$dlog/$2.$REL.txt" + echo_error "$2 compilation failed" + exit 1 + fi if [ -s $3 ] ; then cp $3 $4 echo_success "$2 compiled" check_warnings "$dlog/$2.$REL.txt" else + check_warnings "$dlog/$2.$REL.txt" + check_errors "$dlog/$2.$REL.txt" echo_error "$2 compilation failed" exit 1 fi