fixing scripts ( not emmiting error when error )

fixed also cppcheck ( missing includes )
This commit is contained in:
Filip Bucek 2019-11-06 09:11:13 +01:00
parent 9fbf448eeb
commit c6a8bf75e4
4 changed files with 9 additions and 5 deletions

View File

@ -7,4 +7,7 @@ SUBDIRS += \
OTHER_FILES += \ OTHER_FILES += \
.gitlab-ci.yml .gitlab-ci.yml \
scripts/* \
doc/Doxy* \
doc/pages/* \

View File

@ -3,7 +3,7 @@
# @see https://intoli.com/blog/exit-on-errors-in-bash-scripts/ # @see https://intoli.com/blog/exit-on-errors-in-bash-scripts/
set -e set -e
trap 'LASTRES=$?; LAST=$BASH_COMMAND; if [[ LASTRES -ne 0 ]]; then fail "Command: \"$LAST\" exited with exit code: $LASTRES"; elif [ "$FAIL" -eq "1" ]; then fail finished with error; else pass "finished";fi' EXIT trap 'LASTRES=$?; LAST=$BASH_COMMAND; if [[ LASTRES -ne 0 ]]; then fail "Command: \"$LAST\" exited with exit code: $LASTRES"; elif [ "$FAIL" -eq "1" ]; then fail finished with error; exit 1; else pass "finished";fi' EXIT
SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
DIRNAME="${SRCDIR##*/}" DIRNAME="${SRCDIR##*/}"

View File

@ -3,17 +3,18 @@
# @see https://intoli.com/blog/exit-on-errors-in-bash-scripts/ # @see https://intoli.com/blog/exit-on-errors-in-bash-scripts/
set -e set -e
trap 'LASTRES=$?; LAST=$BASH_COMMAND; if [[ LASTRES -ne 0 ]]; then fail "Command: \"$LAST\" exited with exit code: $LASTRES"; elif [ "$FAIL" -eq "1" ]; then fail finished with error; else pass "finished";fi' EXIT trap 'LASTRES=$?; LAST=$BASH_COMMAND; if [[ LASTRES -ne 0 ]]; then fail "Command: \"$LAST\" exited with exit code: $LASTRES"; elif [ "$FAIL" -eq "1" ]; then fail finished with error; exit 1; else pass "finished";fi' EXIT
SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
DIRNAME="${SRCDIR##*/}" DIRNAME="${SRCDIR##*/}"
exclude_dir=build exclude_dir=build
check_dir=$SRCDIR/../src check_dir=$SRCDIR/../src
suppress="--suppress=missingInclude --suppress=unusedFunction"
FAIL=0 FAIL=0
main() { main() {
{ ERROR="$( { cppcheck $check_dir --suppress=missingIncludeSystem --suppress=unusedFunction --enable=all -i $exclude_dir; } 2>&1 1>&3 3>&- )"; } 3>&1; { ERROR="$( { cppcheck $check_dir $suppress --enable=all -i $exclude_dir; } 2>&1 1>&3 3>&- )"; } 3>&1;
if [ ! -z "$ERROR" ]; then if [ ! -z "$ERROR" ]; then
echo "----------------------------------" echo "----------------------------------"

View File

@ -3,7 +3,7 @@
# @see https://intoli.com/blog/exit-on-errors-in-bash-scripts/ # @see https://intoli.com/blog/exit-on-errors-in-bash-scripts/
set -e set -e
trap 'LASTRES=$?; LAST=$BASH_COMMAND; if [[ LASTRES -ne 0 ]]; then fail "Command: \"$LAST\" exited with exit code: $LASTRES"; elif [ "$FAIL" -eq "1" ]; then fail finished with error; else pass "finished";fi' EXIT trap 'LASTRES=$?; LAST=$BASH_COMMAND; if [[ LASTRES -ne 0 ]]; then fail "Command: \"$LAST\" exited with exit code: $LASTRES"; elif [ "$FAIL" -eq "1" ]; then fail finished with error; exit 1; else pass "finished";fi' EXIT
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
DIR_NAME="${CURRENT_DIR##*/}" DIR_NAME="${CURRENT_DIR##*/}"