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 += \
.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/
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 )"
DIRNAME="${SRCDIR##*/}"

View File

@ -3,17 +3,18 @@
# @see https://intoli.com/blog/exit-on-errors-in-bash-scripts/
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 )"
DIRNAME="${SRCDIR##*/}"
exclude_dir=build
check_dir=$SRCDIR/../src
suppress="--suppress=missingInclude --suppress=unusedFunction"
FAIL=0
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
echo "----------------------------------"

View File

@ -3,7 +3,7 @@
# @see https://intoli.com/blog/exit-on-errors-in-bash-scripts/
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 )"
DIR_NAME="${CURRENT_DIR##*/}"