diff --git a/scripts/codecoverage.sh b/scripts/codecoverage.sh index 4750c65..ccc2f0c 100755 --- a/scripts/codecoverage.sh +++ b/scripts/codecoverage.sh @@ -3,37 +3,25 @@ # @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" == "true" ]; then fail finished with error; exit 1; 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##*/}" SOURCE_DIR=$PWD PRO_FILE=$(find . -d 1 -type f -name "*.pro") -BUILDPATH=$SOURCE_DIR"/../build/testcc" -COVERAGE_DIR=$SOURCE_DIR"/../build/testcc-info" -HTML_RESULTS_DIR=$SOURCE_DIR"/../build/testcc-html" -COVERAGE_FILTER="*Qt*.framework* *Xcode.app* *.moc *moc_*.cpp */test/* *qrc_* ui_* *qt.headers */build/* *main*.* *c++* */server-sdk/*" +BUILDPATH=$SOURCE_DIR"/build/testcc" +COVERAGE_DIR=$SOURCE_DIR"/build/testcc-info" +HTML_RESULTS_DIR=$SOURCE_DIR"/build/testcc-html" +COVERAGE_FILTER="*Qt*.framework* *Xcode.app* *.moc *moc_*.cpp */test/* *qrc_* ui_* *qt.headers */build/* *main*.* *c++*" + main() { - setup testcc "$@" } -function setup() { - mkdir -p $BUILDPATH - - GIT=`git -C "$SRCDIR" describe --tags --always` - GITSTATUS=`git status --porcelain` - GITMOD="" - if [ ! -z "$GITSTATUS" ]; then - GITMOD="-modified" - fi -} - - function testcc() { if [ ! -d src ]; then fail "src dir does not exists" @@ -103,7 +91,7 @@ function testcc() { ${LCOV} -d ${BUILDPATH} -c -o ${COVERAGE_DIR}/coverage.info info "Filtering code coverage info report" - ${LCOV} -r ${COVERAGE_DIR}/coverage.info $COVERAGE_FILTER -o ${COVERAGE_DIR}/coverage-filtered.info + ${LCOV} -r ${COVERAGE_DIR}/coverage.info $COVERAGE_FILTER $ENV_COVERAGE_FILTER -o ${COVERAGE_DIR}/coverage-filtered.info info "Creating html output" mkdir -p ${HTML_RESULTS_DIR} @@ -135,7 +123,7 @@ function pass() { } function fail() { - FAIL=1; echo -e "[${RED}FAIL${NC}] $@" + FAIL="true"; echo -e "[${RED}FAIL${NC}] $@" } # Run main function diff --git a/scripts/cppcheck.sh b/scripts/cppcheck.sh index 74a8ab6..9846b85 100755 --- a/scripts/cppcheck.sh +++ b/scripts/cppcheck.sh @@ -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; exit 1; 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" == "true" ]; then fail finished with error; exit 1; else pass "finished";fi' EXIT CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" DIRNAME="${CURRENT_DIR##*/}" @@ -49,7 +49,7 @@ function pass() { } function fail() { - FAIL=1; echo -e "[${RED}FAIL${NC}] $@" + FAIL="true"; echo -e "[${RED}FAIL${NC}] $@" } # Run main function diff --git a/scripts/doc.sh b/scripts/doc.sh index 1949268..ce34688 100755 --- a/scripts/doc.sh +++ b/scripts/doc.sh @@ -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; exit 1; 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" == "true" ]; 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##*/}" @@ -61,7 +61,7 @@ function pass() { } function fail() { - FAIL=1; echo -e "[${RED}FAIL${NC}] $@" + FAIL="true"; echo -e "[${RED}FAIL${NC}] $@" }