selftests/run_coverage
#!/bin/bash
# Execute all unittests with coverage and report code coverage.
#
# Copyright: Red Hat Inc.
# License: GPLv2
# Author: Lukas Doktor <ldoktor@redhat.com>
CANDIDATES="coverage3 coverage coverage2"
COVERAGE="$(which $CANDIDATES 2>/dev/null| head -n 1)"
if [ "x$COVERAGE" == "x" ]; then
echo "No coverage utility found, looked for: $CANDIDATES"
exit -1
fi
echo "Using coverage utility: $COVERAGE"
$COVERAGE erase
rm -f .coverage.*
$COVERAGE run selftests/check.py --skip=static-checks
$COVERAGE combine
echo
$COVERAGE report -m --include "avocado/core/*"
echo
$COVERAGE report -m --include "avocado/utils/*"
echo
$COVERAGE report -m --include "avocado/plugins/*"
echo
$COVERAGE report -m --include "optional_plugins/*"
echo
$COVERAGE report
$COVERAGE xml