SPEC-3484: Use the new gcovr-wrapper
[src/qa-testdefinitions.git] / common / scripts / application-lifecycle.sh
index 2674530..3488680 100755 (executable)
@@ -123,7 +123,7 @@ inspect_wgt() {
                fi
                # the file naming convention is servicename.wgt
                # but some didnt respect it
-               export WGTSERVICENAME=$(grep 'id=.*' config.xml | cut -d= -f2 | cut -d'"' -f2)
+               export WGTSERVICENAME=$(grep 'id=.*' config.xml | sed 's,^.*id=,id=,' | cut -d= -f2 | cut -d'"' -f2)
                if [ -z "$WGTSERVICENAME" ];then
                        echo "WARN: failed to find name in config.xml, fallback to filename"
                        export WGTSERVICENAME="$WGTNAME"
@@ -391,9 +391,19 @@ do
                inspect_wgt $WGTNAME-debug.wgt $WGTNAME
                do_release_test $WGTNAME $WGTNAME-debug.wgt
        fi
-       if [ -e $WGTNAME-coverage.wgt ];then
-               inspect_wgt $WGTNAME-coverage.wgt $WGTNAME
-               echo "DEBUG: coverage not handled yet"
+       if [ -e "$WGTNAME-coverage.wgt" ];then
+               gcovr-wrapper "$WGTNAME-coverage.wgt" > coverage.result
+               RET=$?
+               cat coverage.result
+               if [ $RET -eq 0 ];then
+                       lava-test-case "run-test-$WGTNAME-coverage" --result pass
+                       LINES_PERCENT=$(grep -o '^lines.*%' coverage.result | cut -d ' ' -f2 | cut -d% -f1)
+                       lava-test-case "run-test-$WGTNAME-coverage-lines" --result pass --measurement "$LINES_PERCENT"
+                       BRANCHES_PERCENT=$(grep -o '^branches.*%' coverage.result | cut -d ' ' -f2 | cut -d% -f1)
+                       lava-test-case "run-test-$WGTNAME-coverage-branches" --result pass --measurement "$BRANCHES_PERCENT"
+               else
+                       lava-test-case "run-test-$WGTNAME-coverage" --result fail
+               fi
        fi
 done