Index: local/run.coco.sh =================================================================== diff -u -r4e3988b004dcb061bb617b3de26dcfc8a4be8bed -r1db270567b3e1fae4d91304b53deedeec6049e82 --- local/run.coco.sh (.../run.coco.sh) (revision 4e3988b004dcb061bb617b3de26dcfc8a4be8bed) +++ local/run.coco.sh (.../run.coco.sh) (revision 1db270567b3e1fae4d91304b53deedeec6049e82) @@ -47,9 +47,9 @@ function generate_alarm_mapping() { echo " ------------------------------ Generating the alarms mapping" # alarmMapping must run in the application folder. - pushd $APPLICATION_PATH + pushd $APPLICATION_PATH # save current directory and switch to $APPLICATION_PATH /Projects/application ./alarmMapping.sh - popd + popd # restore previous directory } @@ -114,12 +114,16 @@ function tests_read_list() { - QT_TESTS_LIST=() + QT_TESTS_LIST=() # initialize empty array + # read a file $QT_TESTS_LIST_FILE. read each line echo " ------------------------------ Test List:" while read -r line do + # remove leading spaces, remove lines that starts with #, store result in test test=`echo $line | sed -e 's/^[[:space:]]*//' | sed -e '/^#/d'` + + # if test is not empty then add it to the array if [ "$test" != "" ]; then QT_TESTS_LIST+=($test) echo " - $test" @@ -175,6 +179,7 @@ function coverage_merge() { + # MMSS 1 Get all csmes reports from each test case echo " ------------------------------ Merging the excecution report databases" local csmes="" for test in ${QT_TESTS_LIST[@]};do @@ -226,7 +231,55 @@ } +function coverage_reports() { + echo "processing separate execution reports" > $LOG_PATH/$MERGE_DIR.err | tee $LOG_PATH/$MERGE_DIR.log + + ############################################################################################# + # + # in each Loop eteration do the following: + # 1) get csmes value + # 2) Using $scmes variable execute coverage import command "cmcsexeimport" + # 3) Using $cscmes execute coverage report command "cmreport" + # + ########################################################################################### + + for test in ${QT_TESTS_LIST[@]};do + csmes="$BUILD_PATH/$test/$test.csmes" + + # coverage import + echo $BUILD_PATH/$test/$test.csexe + cmcsexeimport --csmes=$csmes --title==$test --csexe=$BUILD_PATH/$test/$test.csexe \ + 2>> $LOG_PATH/import_$test.err | tee $LOG_PATH/import_$test.log + + fname=$(basename "$csmes") # remove path + REPORT_FILE="${fname%.*}" # remove extension + + REPORT_TYPE="html" + REPORT_CMD="--html=$REPORT_COCO/$REPORT_FILE" # .html + + echo "--------- Generating report $REPORT_FILE" + + if [[ "$1" == "csv" ]]; then + REPORT_TYPE="csv" + REPORT_FILE="${REPORT_FILE}.csv" + REPORT_CMD="--csv-excel=$REPORT_FILE" + fi + + echo " ------------------------------ Generating the coverage report <$REPORT_TYPE>" + + cmreport --csmes=$csmes $REPORT_CMD 2>> $LOG_PATH/report.err | tee $LOG_PATH/report.log + + if [[ "$1" == "csv" ]]; then + mv report_out.csv report/ + fi + + echo " ------------------------------ Out file location : $(pwd)/$REPORT_COCO/$REPORT_FILE" + done +} + + ##### ---------- MAIN ------------------------------------------------------------------------------------------------- + if [ "$1" == "--build" ]; then server_coco_check cleanup_directories @@ -250,7 +303,7 @@ if [ "$1" == "--merge" ]; then server_coco_check cd $WORKING_PATH - tests_read_list + tests_read_list # generate Q_TESTS_LIST coverage_merge coverage_import fi @@ -263,12 +316,25 @@ fi +if [ "$1" == "--reports" ]; then + server_coco_check + cd $WORKING_PATH + tests_read_list # generate Q_TESTS_LIST + + coverage_reports "$2" +fi + + if [ "$1" == "" ]; then echo "Usage:" echo "run.coco.sh " - echo "--build build and instrment the application and tests from $APPLICATION_PATH" - echo "--run run the tests" - echo "--merge merge the test results" - echo "--report create the execution report of the ran applicaiton" - echo " report type html:default, csv" + echo "--build Build and instrment the application and tests from $APPLICATION_PATH" + echo "--run run the tests" + echo "--merge merge the test results" + echo "--report Create the execution report of the ran applicaiton" + echo " Report type: html:default, csv" + echo "--reports Create seperate reports of the run applicaiton" + echo " Report type html:default, csv" fi + +