Index: build/unittest.sh =================================================================== diff -u -rb1f51d4766e06f3b7dee8e536ea997dab83242eb -r74d2bff6a51d414044dc8e1bae79f70a78d6b943 --- build/unittest.sh (.../unittest.sh) (revision b1f51d4766e06f3b7dee8e536ea997dab83242eb) +++ build/unittest.sh (.../unittest.sh) (revision 74d2bff6a51d414044dc8e1bae79f70a78d6b943) @@ -209,6 +209,7 @@ function check_TestResults() { + failedUnitTests=() targetedCoverage=100 cd $REPORT_DIR @@ -226,9 +227,14 @@ # Check if the coverage percentage is less than 100% if [[ $percentage -lt $targetedCoverage ]] then - echo "Coverage test failed" - exit 1 - fi + echo "Coverage test failed!" + echo "Coverage Test, Failed, $percentage%" >> $STATUS_REPORT + exit 1 + else + echo "Coverage test passed!" + echo "Coverage Test, Passed, $percentage%" >> $STATUS_REPORT + fi + echo "" >> $STATUS_REPORT cd $REPORT_DIR cd UnitTest @@ -238,19 +244,46 @@ for file in ${logFiles[@]} do - echo $file >> $STATUS_REPORT # 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}' | grep -o -E '[0-9]') + failures=$(cat $file | awk '/\yTotals\y/' | awk '/,/ {print $4}' | grep -o -E '[0-9]+') + skipped=$(cat $file | awk '/\yTotals\y/' | awk '/,/ {print $6}' | grep -o -E '[0-9]+') + blackListed=$(cat $file | awk '/\yTotals\y/' | awk '/,/ {print $6}' | grep -o -E '[0-9]+') + + # FOR TEST ONLY REMOVE + echo "$file, $failures, $skipped, $blackListed" # 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 + failedUnitTests+=("$file, Failed Cases, $failures") fi + # Check if the number of skipped tests is greater than 0 + if [[ $skipped -gt 0 ]] + then + failedUnitTests+=("$file, Skipped Cases, $skipped") + fi + # Check if the number of blacklisted tests is greater than 0 + if [[ $blackListed -gt 0 ]] + then + failedUnitTests+=("$file, BlackListed Cases, $blackListed") + fi done + # If the list is not empty, the test has failed + if [[ ! -z ${failedUnitTests[@]} ]] + then + echo "Unit Test, Failed" >> $STATUS_REPORT + for test in ${failedUnitTests[@]} + do + echo $test >> $STATUS_REPORT + done + exit 1 + else + echo "Unit Test, Passed" >> $STATUS_REPORT + fi + echo "" >> $STATUS_REPORT } function copy_TestsResults() { cp $LOG_PATH/QtTest*.log $REPORT_PATH/UnitTest/