#!/bin/bash # Local example $./run.unittest.sh :0 5.12.5 /media/sf_VMSHARE echo " ------------------------------ Definisions " #Setting up Display number if [[ "$1" = "" ]]; then DISPLAY_NO=:0 #:10.0 else DISPLAY_NO=$1 fi #setup Qt dir version if [[ "$2" = "" ]]; then QT_VER="" else QT_VER=$2 fi #Setting up server folder if [[ "$3" = "" ]]; then SERVER_DIR="/media/XDrive" else SERVER_DIR=$3 fi SQUISH_SERVER_PORT=4322 BUID_DIR=build QT_DIR="/opt/Qt$QT_VER/5.12.5/gcc_64" SQUISH_DIR="/opt/squishqt" COCO_DIR="/opt/SquishCoco" REMOTE_DIR="$SERVER_DIR/Users/Bamboo-Projects/DEN_UI" REPORT_DIR="$timeStamp-BuildNo-$buildNumber-$buildPlan" REPORT=Report LOG=Logs export PATH=$PATH:$QT_DIR/bin/:$QT_DIR/lib export PATH=$PATH:$COCO_DIR/bin/:$COCO_DIR/wrapper/bin/ export LD_LIBRARY_PATH=$QT_DIR/lib export DISPLAY=$DISPLAY_NO export SQUISH_GUI_COVERAGE=1 echo " ------------------------------ Create the Report output/log folder" mkdir -p $REPORT/$LOG echo " ------------------------------ Clone Denali " if [[ "$RUN_FOR_LOCAL" = "" ]]; then git clone ssh://git@dvm-linux02:7999/ui/application.git else cp -r ../../Project/application application fi echo " ------------------------------ Build Application " mkdir $BUID_DIR cd $BUID_DIR echo " ------------------------------ Configure The Project for Coverage" # Coco Build - Instrumentation $QT_DIR/bin/qmake ../application/denali.pro -spec linux-g++ CONFIG+=qtquickcompiler CONFIG+=CodeCoverage /usr/bin/make LINK=csg++ AR=csar CXX=csg++ CC=csgcc -j4 cd .. echo " ------------------------------ Clone the Test Suites" if [[ "$RUN_FOR_LOCAL" = "" ]]; then git clone ssh://git@dvm-linux02:7999/ui/testsuites.git else cp -r ../../Project/testsuites testsuites fi echo " ------------------------------ Starting the Squish Server" $SQUISH_DIR/bin/squishserver addAUT $(pwd)/$BUID_DIR/denali --port=$SQUISH_SERVER_PORT 1>$REPORT/$LOG/squishqtserver.log 2>$REPORT/$LOG/squishqtserver.err & echo " ------------------------------ Starting tests" $SQUISH_DIR/bin/squishrunner --testsuite testsuites --exitCodeOnFail 13 --reportgen html,$REPORT/UnitTest 1>$REPORT/$LOG/squishqtrunner.log 2>$REPORT/$LOG/squishqtrunner.err UNITTEST_RESULT=$? echo " ------------------------------ Importing the excecution report into the coverage database" cmcsexeimport -p merge -m $BUID_DIR/denali.csmes -t UnitTest01 $BUID_DIR/denali.csexe 1>$REPORT/$LOG/cmcsexeimport.log 2>$REPORT/$LOG/cmcsexeimport.err echo " ------------------------------ Generating the coverage report" cmreport --csmes=$BUID_DIR/denali.csmes --html=$REPORT/Coverage/index 1>$REPORT/$LOG/cmreport.log 2>$REPORT/$LOG/cmreport.err echo " ------------------------------ Copy the reports to server" mkdir -p $REMOTE_DIR/$REPORT_DIR cp -rd Report/* $REMOTE_DIR/$REPORT_DIR sync;sync;sync; echo " ------------------------------ Stoping the Squish Server" $SQUISH_DIR/bin/squishserver --port=$SQUISH_SERVER_PORT --stop if [[ "$StopOnUnitTestError" = "" ]]; then exit $UNITTEST_RESULT else exit 0 fi