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 create_folders } function create_folders() { 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() { REPORT_TYPE="html" REPORT_CMD="--html=$REPORT_PATH/index" if [[ "$1" == "csv" ]]; then REPORT_TYPE="csv" REPORT_FILE=report_out.csv REPORT_CMD="--csv-excel=$REPORT_FILE" fi echo "Generating the coverage report <$REPORT_TYPE>" cmreport \ --csmes=$DENALI_SQUISH.csmes \ $REPORT_CMD \ 2> $LOG_PATH/cmreport.err \ | tee $LOG_PATH/cmreport.log mv report_out.csv Report/ echo "Out file location : $(pwd)/Report/$REPORT_FILE" } 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 create_folders cd $WORKING_DIR #coverageMerge # no need to merge since we only running one version of the application coverageImport coverageReport "$2" 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" echo " report type html:default, csv" fi