Index: build/unittest.sh =================================================================== diff -u -rf50c927937dfdf781f4f47ad07c9eac540ff01dc -r72d6e46e60ba586d5b8676efd0ffadd8205fafc0 --- build/unittest.sh (.../unittest.sh) (revision f50c927937dfdf781f4f47ad07c9eac540ff01dc) +++ build/unittest.sh (.../unittest.sh) (revision 72d6e46e60ba586d5b8676efd0ffadd8205fafc0) @@ -195,11 +195,41 @@ } function check_TestResults() { - if [ -z "$StopOnUnitTestError" ]; then - exit $UNITTEST_RESULT - else - exit 0 - fi + + cd $REMOTE_DIR"/"$REPORT_DIR + + cd Coverage/index_html + + # 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]+)') + + echo "Code Coverage is $coveragePercent%" + + cd .. + + cd UnitTest + + # In the unit test folder, get the all the .log files + logFiles=$(find . -type f -iname "*.log") + + for file in ${logFiles[@]} + 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}') + # Remove ./ from the file name + file=${file##*/} + echo "$file has $failures failed cases" + done + + + #if [ -z "$StopOnUnitTestError" ]; then + # exit $UNITTEST_RESULT + #else + # exit 0 + #fi } function copy_TestsResults() { cp $LOG_PATH/QtTest*.log $REPORT_PATH/UnitTest/