QT_VER=5.12.5 QT_DIR="/opt/Qt$QT_VER/5.12.5/gcc_64/bin" APPLICATION=/home/denali/Projects/application WORKING_DIR=$HOME/coco DENALI_SQUISH=denaliSquish REPORT=Report LOG=Logs UNITTEST_RESULT=0 REPORT_PATH=$WORKING_DIR/$REPORT LOG_PATH=$REPORT_PATH/$LOG function cleanup() { rm -frd $WORKING_DIR mkdir -p $WORKING_DIR mkdir -p $REPORT_PATH mkdir -p $LOG_PATH } function build_with_coverage() { echo " ------------------------------ Run qmake" echo $(pwd) $QT_DIR/qmake \ $APPLICATION/denali.pro \ -spec linux-g++ \ CONFIG+=qtquickcompiler \ CONFIG+="$1" \ CONFIG+=CodeCoverage \ TARGET="$1" echo " ------------------------------ Run make" /usr/bin/make \ LINK=csg++ AR=csar CXX=csg++ CC=csgcc -j4 \ 2> $LOG_PATH/build_for_"$1".err \ | tee $LOG_PATH/build_for_"$1".log && /usr/bin/make clean echo " ------------------------------ Cleaned for next build" } function coverageMerge() { echo " ------------------------------ Merging the excecution report databases" cmmerge \ -o denali.csmes \ $DENALI_SQUISH.csmes \ 2> $LOG_PATH/cmmerge.err \ | tee $LOG_PATH/cmmerge.log } function coverageImport() { echo " ------------------------------ Importing the execution report into the coverage database" cmcsexeimport \ -m $DENALI_SQUISH.csmes \ -t Squish \ -e $DENALI_SQUISH.csexe \ 2> $LOG_PATH/cmcsexeimport_squish.err \ | tee $LOG_PATH/cmcsexeimport_squish.log } function coverageReport() { echo " ------------------------------ Generating the coverage report" cmreport \ --csmes=$DENALI_SQUISH.csmes \ --html=$REPORT_PATH/Coverage/index \ 2> $LOG_PATH/cmreport.err \ | tee $LOG_PATH/cmreport.log } function copy_TestsResults_IntoServer() { echo " ------------------------------ Copy the reports to server" cp -rd $REPORT_PATH/* $REPORT_DIR sync;sync;sync; } if [ "$1" = "--build" ]; then cleanup cd $WORKING_DIR build_with_coverage $DENALI_SQUISH fi if [ "$1" = "--report" ]; then cd $WORKING_DIR #coverageMerge # no need to merge since we only running one version of the application coverageImport coverageReport fi if [ "$1" = "" ]; then echo "Usage:" echo "run.coco.sh " echo "--build build and instrment the applicaiotn from $HOME/Projects/application" echo "--report create the execution report of the ran applicaiton" fi