updating scripts

This commit is contained in:
Filip Bucek 2019-11-06 13:01:11 +01:00
parent c439d1263d
commit 39deb493a7
3 changed files with 40 additions and 13 deletions

View File

@ -3,16 +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; 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 )" SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
DIRNAME="${SRCDIR##*/}" DIRNAME="${SRCDIR##*/}"
SOURCE_DIR=$PWD
PRO_FILE=$(find . -d 1 -type f -name "*.pro")
BUILDPATH=$SRCDIR"/../build/testcc" BUILDPATH=$SOURCE_DIR"/../build/testcc"
COVERAGE_DIR=$SRCDIR"/../build/testcc-info" COVERAGE_DIR=$SOURCE_DIR"/../build/testcc-info"
SOURCE_CODE=$SRCDIR"/.." HTML_RESULTS_DIR=$SOURCE_DIR"/../build/testcc-html"
HTML_RESULTS_DIR=$SRCDIR"/../build/testcc-html" COVERAGE_FILTER="*Qt*.framework* *Xcode.app* *.moc *moc_*.cpp */test/* *qrc_* ui_* *qt.headers */build/* *main*.* *c++* */server-sdk/*"
COVERAGE_FILTER="*Qt*.framework* *Xcode.app* *.moc *moc_*.cpp */test/* *qrc_* ui_* */invsdk/* *qt.headers */build/* *main*.* *c++*"
main() { main() {
@ -33,12 +35,25 @@ function setup() {
function testcc() { function testcc() {
if [ ! -d src ]; then
fail "src dir does not exists"
else
pass "src dir exits"
fi
if [ ! -f $PRO_FILE ]; then
fail ".pro file does not exists: " $PRO_FILE
else
pass ".pro file: " $PRO_FILE
fi
info "Creating: $BUILDPATH" info "Creating: $BUILDPATH"
mkdir -p $BUILDPATH mkdir -p $BUILDPATH
cd $BUILDPATH cd $BUILDPATH
info "Generate makefile with coverage option" info "Generate makefile with coverage option"
qmake $SOURCE_CODE/server-sdk.pro "QMAKE_CXXFLAGS += --coverage" "QMAKE_LFLAGS += --coverage" qmake $SOURCE_DIR/$PRO_FILE "QMAKE_CXXFLAGS += --coverage" "QMAKE_LFLAGS += --coverage"
info "Remove previous *.gcda files" info "Remove previous *.gcda files"
find $BUILDPATH -name *.gcda -exec rm "{}" \; find $BUILDPATH -name *.gcda -exec rm "{}" \;
@ -55,7 +70,7 @@ function testcc() {
echo "Build : $BUILDPATH" echo "Build : $BUILDPATH"
echo "Makeflags : $MAKEFLAGS" echo "Makeflags : $MAKEFLAGS"
echo "COVERAGE_DIR : $COVERAGE_DIR" echo "COVERAGE_DIR : $COVERAGE_DIR"
echo "SOURCE_CODE : $SOURCE_CODE" echo "SOURCE_DIR : $SOURCE_DIR"
echo "HTML_RESULTS_DIR : $HTML_RESULTS_DIR" echo "HTML_RESULTS_DIR : $HTML_RESULTS_DIR"
echo "COVERAGE_FILTER : $COVERAGE_FILTER" echo "COVERAGE_FILTER : $COVERAGE_FILTER"
echo "--------------------" echo "--------------------"

View File

@ -5,15 +5,22 @@ 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" -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 )" CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
DIRNAME="${SRCDIR##*/}" DIRNAME="${CURRENT_DIR##*/}"
SOURCE_DIR=$PWD
exclude_dir=build exclude_dir=build
check_dir=$SRCDIR/../src check_dir=$CURRENT_DIR/../src
suppress="--suppress=missingInclude --suppress=unusedFunction" suppress="--suppress=missingInclude --suppress=unusedFunction"
FAIL=0 FAIL=0
main() { main() {
if [ ! -d src ]; then
fail "src dir does not exists"
else
pass "src dir exits"
fi
{ ERROR="$( { cppcheck $check_dir $suppress --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

View File

@ -8,13 +8,18 @@ trap 'LASTRES=$?; LAST=$BASH_COMMAND; if [[ LASTRES -ne 0 ]]; then fail "Command
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##*/}"
FAIL=0 FAIL=0
SOURCE_DIR=$CURRENT_DIR"/.." SOURCE_DIR=$PWD
BUILD_DIR=$SOURCE_DIR"/build" BUILD_DIR=$SOURCE_DIR"/build"
DOC_DIR=$BUILD_DIR"/doc" DOC_DIR=$BUILD_DIR"/doc"
main() { main() {
if [ ! -d src ]; then
fail "src dir does not exists"
else
pass "src dir exits"
fi
doc "$@" doc "$@"
} }