forked from ondra/server-sdk
removed unnecessary code
This commit is contained in:
parent
08127bad50
commit
b15596b25f
@ -10,122 +10,96 @@ COVERAGE_DIR=$SOURCE_DIR"/build/testcc-info"
|
|||||||
HTML_RESULTS_DIR=$SOURCE_DIR"/build/testcc-html"
|
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++*"
|
COVERAGE_FILTER="*Qt*.framework* *Xcode.app* *.moc *moc_*.cpp */test/* *qrc_* ui_* *qt.headers */build/* *main*.* *c++*"
|
||||||
|
|
||||||
main() {
|
info "Getting .pro file"
|
||||||
info "Getting .pro file"
|
PRO_FILE=$(ls *.pro)
|
||||||
PRO_FILE=$(ls *.pro)
|
|
||||||
|
|
||||||
# Ensuring server-sdk wont be filtered out for server-sdk
|
# Ensuring server-sdk wont be filtered out for server-sdk
|
||||||
NAME=$( basename $PWD )
|
NAME=$( basename $PWD )
|
||||||
if [ "$NAME" != "server-sdk" ]; then
|
if [ "$NAME" != "server-sdk" ]; then
|
||||||
COVERAGE_FILTER+=" *server-sdk*"
|
COVERAGE_FILTER+=" *server-sdk*"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensuring 'src' dir exists
|
# Ensuring 'src' dir exists
|
||||||
if [ ! -d src ]; then
|
if [ ! -d src ]; then
|
||||||
fail "'src' dir does not exists. ${BLUE}Expecting 'src' dir with c++ source code${NC}"
|
fail "'src' dir does not exists. ${BLUE}Expecting 'src' dir with c++ source code${NC}"
|
||||||
else
|
else
|
||||||
pass "src dir exits"
|
pass "src dir exits"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensuring PRO_FILE exists
|
# Ensuring PRO_FILE exists
|
||||||
if [ ! -f $PRO_FILE ]; then
|
if [ ! -f $PRO_FILE ]; then
|
||||||
fail ".pro file does not exists: " $PRO_FILE
|
fail ".pro file does not exists: " $PRO_FILE
|
||||||
else
|
else
|
||||||
pass ".pro file: " $PRO_FILE
|
pass ".pro file: " $PRO_FILE
|
||||||
fi
|
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_DIR/$PRO_FILE "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 "{}" \;
|
||||||
|
|
||||||
info "Build"
|
info "Build"
|
||||||
make -j4 # build
|
make -j4 # build
|
||||||
|
|
||||||
info "Run unittests"
|
info "Run unittests"
|
||||||
make check test
|
make check test
|
||||||
|
|
||||||
|
|
||||||
echo "--------------------"
|
echo "--------------------"
|
||||||
echo "Source : $SRCDIR"
|
echo "Source : $SRCDIR"
|
||||||
echo "Build : $BUILDPATH"
|
echo "Build : $BUILDPATH"
|
||||||
echo "Makeflags : $MAKEFLAGS"
|
echo "Makeflags : $MAKEFLAGS"
|
||||||
echo "COVERAGE_DIR : $COVERAGE_DIR"
|
echo "COVERAGE_DIR : $COVERAGE_DIR"
|
||||||
echo "SOURCE_DIR : $SOURCE_DIR"
|
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 "--------------------"
|
||||||
|
|
||||||
#exit 0
|
#exit 0
|
||||||
|
|
||||||
info "Create dummy files to ensure not tested class are acounted"
|
info "Create dummy files to ensure not tested class are acounted"
|
||||||
find $BUILDPATH -name "*.gcno" -exec sh -c 'touch -a "${1%.gcno}.gcda"' _ {} \;
|
find $BUILDPATH -name "*.gcno" -exec sh -c 'touch -a "${1%.gcno}.gcda"' _ {} \;
|
||||||
mkdir -p $COVERAGE_DIR
|
mkdir -p $COVERAGE_DIR
|
||||||
|
|
||||||
info "Make dir 'codecoverage' clean"
|
info "Make dir 'codecoverage' clean"
|
||||||
rm -f $COVERAGE_DIR/*.*
|
rm -f $COVERAGE_DIR/*.*
|
||||||
rm -rf $HTML_RESULTS_DIR
|
rm -rf $HTML_RESULTS_DIR
|
||||||
|
|
||||||
|
|
||||||
info "Copy .gc?? file from $BUILDPATH into 'codecoverage' dir"
|
info "Copy .gc?? file from $BUILDPATH into 'codecoverage' dir"
|
||||||
find $BUILDPATH -name *.gc?? -exec cp "{}" $COVERAGE_DIR \;
|
find $BUILDPATH -name *.gc?? -exec cp "{}" $COVERAGE_DIR \;
|
||||||
|
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# RUN LCOV
|
# RUN LCOV
|
||||||
##########################
|
##########################
|
||||||
|
|
||||||
# ${1} is the directory containing the .gcno files (%{PROJBUILD} in Qt Creator)
|
# ${1} is the directory containing the .gcno files (%{PROJBUILD} in Qt Creator)
|
||||||
LCOV=lcov
|
LCOV=lcov
|
||||||
GENHTML=genhtml
|
GENHTML=genhtml
|
||||||
BROWSER="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
BROWSER="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
||||||
info "Generating initial code coverage info report"
|
info "Generating initial code coverage info report"
|
||||||
cd $BUILDPATH
|
cd $BUILDPATH
|
||||||
${LCOV} -d ${BUILDPATH} -c -o ${COVERAGE_DIR}/coverage.info
|
${LCOV} -d ${BUILDPATH} -c -o ${COVERAGE_DIR}/coverage.info
|
||||||
|
|
||||||
info "Filtering code coverage info report"
|
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 -o ${COVERAGE_DIR}/coverage-filtered.info
|
||||||
|
|
||||||
info "Creating html output"
|
info "Creating html output"
|
||||||
mkdir -p ${HTML_RESULTS_DIR}
|
mkdir -p ${HTML_RESULTS_DIR}
|
||||||
cd $BUILDPATH
|
cd $BUILDPATH
|
||||||
"${GENHTML}" -o "${HTML_RESULTS_DIR}" "${COVERAGE_DIR}/coverage-filtered.info"
|
"${GENHTML}" -o "${HTML_RESULTS_DIR}" "${COVERAGE_DIR}/coverage-filtered.info"
|
||||||
|
|
||||||
info "Reseting coverage counts"
|
info "Reseting coverage counts"
|
||||||
"${LCOV}" -d "${COVERAGE_DIR}" -z
|
"${LCOV}" -d "${COVERAGE_DIR}" -z
|
||||||
|
|
||||||
if [ "$1" == "open" ]; then
|
if [ "$1" == "open" ]; then
|
||||||
open "${HTML_RESULTS_DIR}/index.html" &
|
open "${HTML_RESULTS_DIR}/index.html" &
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
# ################
|
|
||||||
# Output funcitons
|
|
||||||
# ################
|
|
||||||
RED='\033[0;31m'
|
|
||||||
GREEN='\033[0;32m'
|
|
||||||
BLUE='\033[0;34m'
|
|
||||||
NC='\033[0m' # No Color
|
|
||||||
|
|
||||||
function info () {
|
|
||||||
echo -e "[${BLUE} $@ ${NC}]"
|
|
||||||
}
|
|
||||||
|
|
||||||
function pass() {
|
|
||||||
echo -e "[${GREEN}PASS${NC}] $@"
|
|
||||||
}
|
|
||||||
|
|
||||||
function fail() {
|
|
||||||
FAIL="true"; echo -e "[${RED}FAIL${NC}] $@"
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
# Run main function
|
|
||||||
main "$@"
|
|
||||||
|
|||||||
@ -7,58 +7,29 @@ SOURCE_DIR=$PWD
|
|||||||
BUILD_DIR=$SOURCE_DIR"/build"
|
BUILD_DIR=$SOURCE_DIR"/build"
|
||||||
DOC_DIR=$BUILD_DIR"/doc"
|
DOC_DIR=$BUILD_DIR"/doc"
|
||||||
|
|
||||||
main() {
|
|
||||||
if [ ! -d src ]; then
|
|
||||||
fail "src dir does not exists"
|
|
||||||
else
|
|
||||||
pass "src dir exits"
|
|
||||||
fi
|
|
||||||
|
|
||||||
doc "$@"
|
if [ ! -d src ]; then
|
||||||
}
|
fail "src dir does not exists"
|
||||||
|
else
|
||||||
function doc() {
|
pass "src dir exits"
|
||||||
info "Generation documentation"
|
fi
|
||||||
mkdir -p $BUILD_DIR
|
|
||||||
cd $BUILD_DIR
|
|
||||||
if [ ! -d "m.css" ] ; then
|
|
||||||
info "Cloning m.css"; git clone git://github.com/mosra/m.css;
|
|
||||||
fi
|
|
||||||
cd m.css/documentation
|
|
||||||
|
|
||||||
info "Installing jinja2 and Pygments"
|
|
||||||
pip3 install jinja2 Pygments
|
|
||||||
|
|
||||||
info "Generating doxygen"
|
|
||||||
if [ "$1" == "clean" ]; then rm -fr $DOC_DIR; fi
|
|
||||||
|
|
||||||
./doxygen.py --debug $SOURCE_DIR/doc/Doxyfile-mcss
|
|
||||||
if [ "$1" == "open" ]; then
|
|
||||||
open $DOC_DIR/html/index.html
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# ################
|
|
||||||
# Output funcitons
|
|
||||||
# ################
|
|
||||||
RED='\033[0;31m'
|
|
||||||
GREEN='\033[0;32m'
|
|
||||||
BLUE='\033[0;34m'
|
|
||||||
NC='\033[0m' # No Color
|
|
||||||
|
|
||||||
function info () {
|
|
||||||
echo -e "[${BLUE} $@ ${NC}]"
|
|
||||||
}
|
|
||||||
|
|
||||||
function pass() {
|
|
||||||
echo -e "[${GREEN}PASS${NC}] $@"
|
|
||||||
}
|
|
||||||
|
|
||||||
function fail() {
|
|
||||||
FAIL="true"; echo -e "[${RED}FAIL${NC}] $@"
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Run main function
|
info "Generation documentation"
|
||||||
main "$@"
|
mkdir -p $BUILD_DIR
|
||||||
|
cd $BUILD_DIR
|
||||||
|
if [ ! -d "m.css" ] ; then
|
||||||
|
info "Cloning m.css"; git clone git://github.com/mosra/m.css;
|
||||||
|
fi
|
||||||
|
cd m.css/documentation
|
||||||
|
|
||||||
|
info "Installing jinja2 and Pygments"
|
||||||
|
pip3 install jinja2 Pygments
|
||||||
|
|
||||||
|
info "Generating doxygen"
|
||||||
|
if [ "$1" == "clean" ]; then rm -fr $DOC_DIR; fi
|
||||||
|
|
||||||
|
./doxygen.py --debug $SOURCE_DIR/doc/Doxyfile-mcss
|
||||||
|
if [ "$1" == "open" ]; then
|
||||||
|
open $DOC_DIR/html/index.html
|
||||||
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user