Index: build/AlarmMapping.py =================================================================== diff -u -r5b70008c91abdda20b58c7354fc03960b717bae5 -rc28bb75d80a72b195cbe5625ff302aab40f04aeb --- build/AlarmMapping.py (.../AlarmMapping.py) (revision 5b70008c91abdda20b58c7354fc03960b717bae5) +++ build/AlarmMapping.py (.../AlarmMapping.py) (revision c28bb75d80a72b195cbe5625ff302aab40f04aeb) @@ -42,7 +42,7 @@ 40 : "Dialysis outlet pump failed motor off check.\nMeasured speed while commanded off." 41 : "Dialysis outlet pump failed motor direction check.\nMeasured vs commanded." 42 : "Dialysis outlet pump failed rotor speed check.\nMismatch with rotor and motor speeds." - 43 : "DG main primary heater FPGA fault." + 43 : "HD blood leak self test fault." 44 : "User interface communication timeout." 45 : "HD too many bad communications CRC." 46 : "System message that required acknowledgment was not acknowledged." @@ -62,8 +62,8 @@ 60 : "HD valve not functional." 61 : "HD valve current out of range." 62 : "HD valve position out of target." - 63 : "HD blood leak FPGA fault." - 64 : "DG barometric pressure sensor out of range." + 63 : "FPGA reports failure reading arterial pressure sensor." + 64 : "FPGA reports failure reading venous pressure sensor." 65 : "HD requests DG command with invalid parameter fault." 66 : "HD blood leak sensor set point set failure." 67 : "HD blood pump occlusion self-test failure alarm." @@ -73,7 +73,7 @@ 71 : "HD venous pressure self-test failure alarm." 72 : "HD No load cell data message receive at least once every 2 seconds." 73 : "HD No dialysate temperature data message receive at least once every 2 seconds." - 74 : "DG inlet UV reactor is on with no flow." + 74 : "HD blood leak detector self-test transmit timeout." 75 : "HD syringe pump self-test failure alarm." 76 : "HD monitored voltage is out of range." 77 : "DG monitored voltage is out of range." @@ -83,13 +83,13 @@ 81 : "HD syringe pump over travel error." 82 : "HD syringe pump DAC write failure." 83 : "HD syringe pump is running while the BP is off." - 84 : "DG set RTC year is invalid." + 84 : "HD venous pressure sensor not being read." 85 : "HD pump track latch opened alarm." - 86 : "HD set RTC year is invalid." + 86 : "HD BP occlusion sensor not being read." 87 : "DG heating invalid calibration record." 88 : "DG concentrate pumps hall sensor out of range." - 89 : "DG outlet UV reactor on with no flow." - 90 : "DG load cells A1/B1 FPGA fault." + 89 : "HD BP occlusion sensor error." + 90 : "DG load cells FPGA read error." 91 : "HD No dialysate flow data receive in the last 3 seconds." 92 : "DG conductivity sensor bad status." 93 : "DG outlet primary conductivity out of range." @@ -107,12 +107,12 @@ 105 : "DG invalid calibration CRC." 106 : "DG dialysate flow sensor invalid calibration record." 107 : "HD reports DG restarted fault." - 108 : "HD syringe pump ADC FPGA fault." + 108 : "HD syringe pump ADC error." 109 : "HD syringe pump volume check error." 110 : "HD syringe pump speed check error." 111 : "HD syringe pump not stopped in off state error." - 112 : "DG load cells A1/B1 FPGA fault." - 113 : "DG Drain pump current out of range." + 112 : "HD blood leak zero command transmit timeout." + 113 : "HD blood leak zero command fault." 114 : "HD venous air bubble detector self-test failure." 115 : "DG temperature sensor out of range." 116 : "DG temperature sensor ADC fault." @@ -168,7 +168,7 @@ 166 : "HD in treatment re-circ sub-mode for too long." 167 : "HD cartridge door opened alarm." 168 : "HD active reservoir depletion timeout." - 169 : "DG Dialysate flow rate out of maximum range." + 169 : "Dialysate flow rate out of range." 170 : "HD syringe empty alarm." 171 : "HD syringe pump occlusion alarm." 172 : "HD syringe pump not enough Heparin alarm." @@ -179,7 +179,7 @@ 177 : "DG software fault.\nSoftware found itself in an unexpected state." 178 : "HD communication timeout." 179 : "DG FPGA communication down for too long." - 180 : "DG RO flow out of maximum range." + 180 : "DG load cell ADC error." 181 : "DG load cells weight out of range for tare." 182 : "DG load cells invalid calibration." 183 : "DG invalid load cell value." @@ -195,8 +195,8 @@ 193 : "HD dialysate temperature out of low safety range." 194 : "DG RO pump duty cycle out of range." 195 : "DG RO pump pressure out of range." - 196 : "DG CPi/CPo sensors FPGA fault." - 197 : "DG CD1/CD2 sensors FPGA fault." + 196 : "DG temperature sensor error bit fault." + 197 : "DG temperature sensors FPGA fault." 198 : "RO flow too low while primary heater is on." 199 : "Dialysate flow too low while trimmer heater is on." 200 : "DG thermistors/sensors temperature out of range." @@ -221,8 +221,8 @@ 219 : "HD syringe pump syringe removed alarm." 220 : "DG THd sensors FPGA fault." 221 : "HD Saline bag is empty." - 222 : "HD occlusion sensor FPGA fault." - 223 : "HD arterial sensor FPGA fault." + 222 : "HD dialysate temperature too high alarm." + 223 : "HD dialysate temperature too low alarm." 224 : "Treatment stopped by user action." 225 : "HD end of treatment warning." 226 : "HD prime completed low priority alarm." @@ -279,7 +279,7 @@ 277 : "HD BP occlusion sensor is reading out of range." 278 : "HD active reservoir weight out of range." 279 : "DG dialysate drain time out." - 280 : "DG drain pump direction invalid." + 280 : "HD arterial pressure sensor read timeout error." 281 : "Acid concentration bottle low volume alarm." 282 : "Bicarbonate concentration bottle low volume alarm." 283 : "DG load cells weight out of range." @@ -289,7 +289,7 @@ 287 : "HD processor clock speed checks against FPGA clock failure." 288 : "HD load cells primary/back up drift out of range." 289 : "DG dialysate or concentrate caps not closed." - 290 : "HD venous pressure sensor FPGA fault." + 290 : "DG flow too low while heater is on." 291 : "HD processor is in Disinfect Flush mode." 292 : "HD processor is in Disinfect Heat mode." 293 : "HD processor is in Disinfect Chemical mode." @@ -298,20 +298,14 @@ 296 : "DG TDi sensors FPGA fault." 297 : "DG TRo sensors FPGA fault." 298 : "DG baro sensor FPGA fault." - 299 : "DG invalid serial number." - 300 : "HD invalid serial number." + 299 : "DG disinfect has been expired." + 300 : "DG service time interval has elapsed." 301 : "DG primary heater power voltage out of range." 302 : "DG processor RAM error." - 303 : "DG drain pump direction FPGA fault." + 303 : "HD service time interval has elapsed." 304 : "HD invalid usage record." 305 : "HD processor RAM error." - 306 : "HD air trap over-fill alarm." - 307 : "HD AC power lost second alarm." - 308 : "DG CPi conductivity sensor invalid character received." - 309 : "DG CPo conductivity sensor invalid character received." - 310 : "DG CD1 conductivity sensor invalid character received." - 311 : "DG CD2 conductivity sensor invalid character received." - 312 : "Total number of alarms." + 306 : "Total number of alarms." } # dictionary of rejection reason from application source code. @@ -363,9 +357,6 @@ 43 : "REQUEST_REJECT_REASON_SYRINGE_NOT_PRESENT" # Syringe is not present. 44 : "REQUEST_REJECT_REASON_DG_DIALYSATE_CAP_OPEN" # Dialysate cap open. 45 : "REQUEST_REJECT_REASON_DG_CONCENTRATE_CAP_OPEN" # Concentrate cap open. - 46 : "REQUEST_REJECT_REASON_DG_DISINFECT_HAS_BEEN_EXPIRED" # DG disinfect has been expired. - 47 : "REQUEST_REJECT_REASON_DG_SERVICE_IS_DUE" # DG service is due. - 48 : "REQUEST_REJECT_REASON_HD_SERVICE_IS_DUE" # HD service is due. - 49 : "NUM_OF_REQUEST_REJECT_REASONS" # Number of settings change reject codes. + 46 : "NUM_OF_REQUEST_REJECT_REASONS" # Number of settings change reject codes. } Index: local/run.coco.sh =================================================================== diff -u -r23d228183fb3bea51cdefa7979f20345b4198dbd -rc28bb75d80a72b195cbe5625ff302aab40f04aeb --- local/run.coco.sh (.../run.coco.sh) (revision 23d228183fb3bea51cdefa7979f20345b4198dbd) +++ local/run.coco.sh (.../run.coco.sh) (revision c28bb75d80a72b195cbe5625ff302aab40f04aeb) @@ -1,119 +1,276 @@ +#!/bin/bash +# cmcsexeimport --csmes coco/tst_models/tst_models.csmes --title tst_models --csexe coco/tst_models/tst_models.csexe 2>coco/log/tst_models_cmcsexeimport.err | tee coco/tst_models/tst_models_cmcsexeimport.log +# cmreport --csmes=tst_models/tst_models.csmes --html=Report/index 2>coco/log/tst_models_cmreport.err | tee coco/tst_models/tst_models_cmreport.log + +ERR_TESTSUITE=10000 +ERR_COCO_SERVER_CONNECTION=1001 +ERR_CANBUS_SETUP=1002 + +COCO_SERVER=192.168.10.41 QT_VER=5.12.5 -QT_DIR="/opt/Qt$QT_VER/5.12.5/gcc_64/bin" +QT_PATH="/opt/Qt$QT_VER/$QT_VER/gcc_64/bin" -APPLICATION=/home/denali/Projects/application -WORKING_DIR=$HOME/coco +QT_TESTS_LIST_FILE=tst_names.lst +QT_TESTS_LIST_PATH=$HOME/Projects/scripts/local/ + +APPLICATION_DIR=application +TESTSUITE_DIR=testsuites + +WORKING_DIR=coco +LOG_DIR=logs +BUILD_DIR=build +MERGE_DIR=merge +REPORT_DIR=report DENALI_SQUISH=denaliSquish -REPORT=Report -LOG=Logs -UNITTEST_RESULT=0 -REPORT_PATH=$WORKING_DIR/$REPORT -LOG_PATH=$REPORT_PATH/$LOG -COCO_SERVER=192.168.10.41 +PROJECT_PATH=$HOME/Projects/ +WORKING_PATH=$HOME/coco +REPORT_PATH=$WORKING_PATH/$REPORT_DIR +LOG_PATH=$WORKING_PATH/$LOG_DIR +BUILD_PATH=$WORKING_PATH/$BUILD_DIR +MERGE_PATH=$WORKING_PATH/$MERGE_DIR +AUT_PATH="$BUILD_PATH/$DENALI_SQUISH" +APPLICATION_PATH=$PROJECT_PATH/$APPLICATION_DIR +TESTSUITE_PATH=$PROJECT_PATH/$TESTSUITE_DIR -function check_server() { -ping 192.168.100.41 -c 2 -W 1 -if [ -n "$?" ]; then - echo "Coco Lic Server unreachable" - exit 1000 -fi + +VCAN_SCRIPT=$PROJECT_PATH/scripts/setupCAN/setupVCAN.sh +SQUISH_SERVER=/opt/squishqt/bin/squishserver +SQUISH_RUNNER=/opt/squishqt/bin/squishrunner + +REPORT_COCO=$REPORT_PATH/coco +REPORT_SQUISH=$REPORT_PATH/squish +REPORT_QTTEST=$REPORT_PATH/qttest + +##### ---------- HELPER ----------------------------------------------------------------------------------------------- +function generate_alarm_mapping() { + echo " ------------------------------ Generating the alarms mapping" + # alarmMapping must run in the application folder. + pushd $APPLICATION_PATH + ./alarmMapping.sh + popd } -function cleanup() { - rm -frd $WORKING_DIR - create_folders + +##### ---------- SERVER ----------------------------------------------------------------------------------------------- +##### ---------- SERVER COCO ------------------------------------------------------------------------------------------ +function server_coco_check() { + ping "$COCO_SERVER" -c 2 -W 1 + if [ "$?" != "0" ]; then + echo " ------------------------------ Coco Lic Server unreachable" + exit $ERR_COCO_SERVER_CONNECTION + fi } -function create_folders() { - mkdir -p $WORKING_DIR - mkdir -p $REPORT_PATH + +##### ---------- SERVER SQUISH ---------------------------------------------------------------------------------------- +function server_squish_start() { + echo " ------------------------------ Starting the Squish Server" + # configuring the server + $SQUISH_SERVER \ + --config addAUT $DENALI_SQUISH \ + $AUT_PATH/ \ + 2> $LOG_PATH/squishqtserver.err \ + | tee $LOG_PATH/squishqtserver.log + + # running the server + $SQUISH_SERVER & # must have '&' +} + + +function server_squish_run() { + echo " ------------------------------ Starting tests" + $SQUISH_RUNNER \ + --testsuite $TESTSUITE_PATH \ + --exitCodeOnFail $ERR_TESTSUITE \ + --reportgen html,$REPORT_SQUISH \ + 2> $LOG_PATH/squishqtrunner.err \ + | tee $LOG_PATH/squishqtrunner.log +} + + +function server_squish_stop() { + echo " ------------------------------ Stopping the Squish Server" + $SQUISH_SERVER --stop +} + + +##### ---------- INIT ------------------------------------------------------------------------------------------------- +function cleanup_directories() { + rm -frd $WORKING_PATH + mkdir -p $WORKING_PATH mkdir -p $LOG_PATH + mkdir -p $MERGE_PATH + mkdir -p $REPORT_PATH + mkdir -p $REPORT_COCO + mkdir -p $REPORT_SQUISH + mkdir -p $REPORT_QTTEST } -function build_with_coverage() { - echo "Run qmake" + +##### ---------- TESTS ------------------------------------------------------------------------------------------------ +function tests_copy_list() { + cp $QT_TESTS_LIST_PATH/$QT_TESTS_LIST_FILE $WORKING_PATH +} + + +function tests_read_list() { + QT_TESTS_LIST=() + + echo " ------------------------------ Test List:" + while read -r line + do + test=`echo $line | sed -e 's/^[[:space:]]*//' | sed -e '/^#/d'` + if [ "$test" != "" ]; then + QT_TESTS_LIST+=($test) + echo " - $test" + fi + done < "$QT_TESTS_LIST_FILE" +} + + +function tests_setup() { + if [ $($VCAN_SCRIPT) -eq 0 ];then + echo " ------------------------------ Canbus setup failed" + exit $ERR_CANBUS_SETUP + fi +} + +function tests_run() { + for test in ${QT_TESTS_LIST[@]};do + pushd $BUILD_PATH/$test + if [ "$test" == "$DENALI_SQUISH" ]; then + server_squish_start + server_squish_run + server_squish_stop + else + $BUILD_PATH/$test/$test \ + 2> $LOG_PATH/$test.err \ + | tee $REPORT_QTTEST/$test.report + fi + popd + done +} + +##### ---------- COVERAGE --------------------------------------------------------------------------------------------- +function coverage_build() { + echo " ------------------------------ Run qmake" echo $(pwd) - $QT_DIR/qmake \ - $APPLICATION/denali.pro \ + + $QT_PATH/qmake \ + $APPLICATION_PATH/denali.pro \ -spec linux-g++ \ - CONFIG+=qtquickcompiler \ CONFIG+="$1" \ CONFIG+=CodeCoverage \ - TARGET="$1" + TARGET="$BUILD_PATH/$1/$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 && + 2> "$LOG_PATH/build_$1".err \ + | tee "$LOG_PATH/build_$1".log /usr/bin/make clean - echo "Cleaned for next build" + rm *.csmes + echo " ------------------------------ Cleaned for next build" } -function coverageMerge() { - echo "Merging the excecution report databases" + +function coverage_merge() { + echo " ------------------------------ Merging the excecution report databases" + local csmes="" + for test in ${QT_TESTS_LIST[@]};do + csmes+="$BUILD_PATH/$test/$test.csmes " + done + cmmerge \ - -o denali.csmes \ - $DENALI_SQUISH.csmes \ - 2> $LOG_PATH/cmmerge.err \ - | tee $LOG_PATH/cmmerge.log + -o $MERGE_PATH/$MERGE_DIR.csmes \ + $csmes \ + 2> $LOG_PATH/$MERGE_DIR.err \ + | tee $LOG_PATH/$MERGE_DIR.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 coverage_import() { + echo " ------------------------------ Importing the execution report into the coverage database" + local csexe="" + for test in ${QT_TESTS_LIST[@]};do + echo $BUILD_PATH/$test/$test.csexe + cmcsexeimport \ + --csmes=$MERGE_PATH/$MERGE_DIR.csmes \ + --title=$test \ + --csexe=$BUILD_PATH/$test/$test.csexe \ + 2> $LOG_PATH/import_$test.err \ + | tee $LOG_PATH/import_$test.log + done } -function coverageReport() { + +function coverage_report() { REPORT_TYPE="html" - REPORT_CMD="--html=$REPORT_PATH/index" + REPORT_CMD="--html=$REPORT_COCO/index" if [[ "$1" == "csv" ]]; then - REPORT_TYPE="csv" - REPORT_FILE=report_out.csv - REPORT_CMD="--csv-excel=$REPORT_FILE" + REPORT_TYPE="csv" + REPORT_FILE=report_out.csv + REPORT_CMD="--csv-excel=$REPORT_FILE" fi - echo "Generating the coverage report <$REPORT_TYPE>" + echo " ------------------------------ Generating the coverage report <$REPORT_TYPE>" cmreport \ - --csmes=$DENALI_SQUISH.csmes \ + --csmes=$MERGE_PATH/$MERGE_DIR.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" -} + 2> $LOG_PATH/report.err \ + | tee $LOG_PATH/report.log -function copy_TestsResults_IntoServer() { - echo "Copy the reports to server" - cp -rd $REPORT_PATH/* $REPORT_DIR - sync;sync;sync; + if [[ "$1" == "csv" ]]; then + mv report_out.csv report/ + fi + echo " ------------------------------ Out file location : $(pwd)/$REPORT_COCO/$REPORT_FILE" } -if [ "$1" = "--build" ]; then - cleanup - cd $WORKING_DIR - build_with_coverage $DENALI_SQUISH + +##### ---------- MAIN ------------------------------------------------------------------------------------------------- +if [ "$1" == "--build" ]; then + server_coco_check + cleanup_directories + cd $WORKING_PATH + tests_copy_list + tests_read_list + generate_alarm_mapping + for test in ${QT_TESTS_LIST[@]};do + coverage_build $test + done 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" + +if [ "$1" == "--run" ]; then + cd $WORKING_PATH + tests_read_list + tests_run fi -if [ "$1" = "" ]; then + +if [ "$1" == "--merge" ]; then + server_coco_check + cd $WORKING_PATH + tests_read_list + coverage_merge + coverage_import +fi + + +if [ "$1" == "--report" ]; then + server_coco_check + cd $WORKING_PATH + coverage_report "$2" +fi + + +if [ "$1" == "" ]; then echo "Usage:" echo "run.coco.sh " - echo "--build build and instrment the applicaiotn from $HOME/Projects/application" + 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" fi - Index: local/tst_names.lst =================================================================== diff -u --- local/tst_names.lst (revision 0) +++ local/tst_names.lst (revision c28bb75d80a72b195cbe5625ff302aab40f04aeb) @@ -0,0 +1,10 @@ +denaliSquish +tst_logging +tst_initializations +tst_canbus +tst_utilities +tst_acknow +tst_messaging +tst_models +tst_views +tst_threads Index: setupCAN/setupVCAN.sh =================================================================== diff -u -r5534b56f246b0597a37f08f145f4d61ae8340e4d -rc28bb75d80a72b195cbe5625ff302aab40f04aeb --- setupCAN/setupVCAN.sh (.../setupVCAN.sh) (revision 5534b56f246b0597a37f08f145f4d61ae8340e4d) +++ setupCAN/setupVCAN.sh (.../setupVCAN.sh) (revision c28bb75d80a72b195cbe5625ff302aab40f04aeb) @@ -1,8 +1,23 @@ #!/bin/bash + CAN=can0 if [ "$1" != "" ]; then CAN=$1 fi -sudo modprobe vcan -sudo ip link add dev $CAN type vcan -sudo ip link set $CAN up + +function canbusExists() { + if [ -z "$(ip link | grep $CAN)" ]; then + echo 0 + else + echo 1 + fi +} + +if [ $(canbusExists) -eq 0 ]; then + sudo modprobe vcan + sudo ip link add dev $CAN type vcan + sudo ip link set $CAN up +fi + +echo $(canbusExists) +