updating scripts

This commit is contained in:
Filip Bucek 2019-11-06 13:20:48 +01:00
parent e04bddeb13
commit 1468ddf54d
3 changed files with 12 additions and 24 deletions

View File

@ -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

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; 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

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; 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}] $@"
}