Index: build/unittest.sh =================================================================== diff -u -r132bce6618c8c631a2283443c7b6063e8cb3837d -r518ac0bd444954829f8434f644a3d86fdb2c28a4 --- build/unittest.sh (.../unittest.sh) (revision 132bce6618c8c631a2283443c7b6063e8cb3837d) +++ build/unittest.sh (.../unittest.sh) (revision 518ac0bd444954829f8434f644a3d86fdb2c28a4) @@ -39,7 +39,7 @@ # --- setup local or server Environment DISPLAY_NO=:10.0 QT_VER="" - SERVER_DIR="/media/BambooProjects" + #SERVER_DIR="/media/BambooProjects" DENALI_SQUISH=denaliSquish @@ -211,6 +211,7 @@ function check_TestResults() { + targetedCoverage=100 #cd $REMOTE_DIR"/"$REPORT_DIR cd $REPORT_DIR @@ -219,10 +220,16 @@ # In the index.html, get the Coverage section (exact pattern) # Parse everything that is from .*prg0 to the tag # In the parsed section, get everything from .*prg2"> to % and convert it to float values (i.e 42.76) - coveragePercent=$(cat index.html | awk '/\yCoverage\y/' | sed -e 's/.*prg0//' -e 's/<\/PRE>.*//' | \ - sed -e 's/.*prg2">//' -e 's/%.*//' | grep -o -E '[0-9]+([.][0-9]+)') + percentage=$(cat index.html | awk '/\yCoverage\y/' | sed -e 's/.*prg0//' -e 's/<\/PRE>.*//' | \ + sed -e 's/.*prg2">//' -e 's/%.*//' | grep -o -E '[0-9]+([.][0-9]+)') echo "Code Coverage is $coveragePercent%" + # Check if the coverage percentage is less than 100% + if [[ $percentage -lt $targetedCoverage ]] + then + echo "Coverage test failed" + exit 1 + fi #cd $REMOTE_DIR"/"$REPORT_DIR cd $REPORT_DIR @@ -236,10 +243,15 @@ do # Inside each log file, find the exact pattern of Totals # Find the commas and print the 4th one which is the number of failed cases - failures=$(cat $file | awk '/\yTotals\y/' | awk '/,/ {print $4}') + failures=$(cat $file | awk '/\yTotals\y/' | awk '/,/ {print $4}' | grep -o -E '[0-9]') # Remove ./ from the file name file=${file##*/} echo "$file has $failures failed cases" + # Check if the number of failures is greater than 0 + if [[ $failures -gt 0 ]] + then + exit 1 + fi done