summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf5
-rw-r--r--application-manager.pro49
-rw-r--r--doc/installation.qdoc8
-rw-r--r--qmake-features/am-coverage.prf24
4 files changed, 35 insertions, 51 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 6e80bc40..5b85deb4 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -5,3 +5,8 @@ MODULE_VERSION = 1.9.9
SOURCE_DIR=$$PWD
BUILD_DIR=$$shadowed($$PWD)
QMAKEFEATURES=$$SOURCE_DIR/qmake-features
+
+# Load the am-coverage feature in every pro file
+# This makes sure we compile everything with coverage data
+# when the coverage target gets executed
+CONFIG += am-coverage
diff --git a/application-manager.pro b/application-manager.pro
index 8b04ae3a..2284162b 100644
--- a/application-manager.pro
+++ b/application-manager.pro
@@ -98,34 +98,33 @@ OTHER_FILES += \
qmake-features/*.prf \
sync.profile
+GCOV_EXCLUDE = /usr/* \
+ $$[QT_INSTALL_PREFIX]/* \
+ $$[QT_INSTALL_PREFIX/src]/* \
+ tests/* \
+ moc_* \
+ examples/* \
+ $$OUT_PWD/* \
+
+
+!prefix_build: GCOV_EXCLUDE += $$clean_path($$[QT_INSTALL_PREFIX]/../*) $$clean_path($$[QT_INSTALL_PREFIX/src]/../*)
+
+for (f, GCOV_EXCLUDE) {
+ GCOV_EXCLUDE_STR += $$shell_quote($$f)
+}
+
global-check-coverage.target = check-coverage
global-check-coverage.depends = coverage
global-check-coverage.commands = ( \
find . -name \"*.gcov-info\" -print0 | xargs -0 rm -f && \
- cd tests && make check-coverage && cd .. && \
- cd src/common-lib && make check-coverage && cd ../.. && \
- cd src/crypto-lib && make check-coverage && cd ../.. && \
- cd src/installer-lib && make check-coverage && cd ../.. && \
- cd src/manager-lib && make check-coverage && cd ../.. && \
- lcov -o temp.gcov-info `find . -name "*.gcov-info" | xargs -n1 echo -a` && \
- lcov -o application-manager.gcov-info -r temp.gcov-info \"/usr/*\" \"$$[QT_INSTALL_PREFIX]/*\" \"$$[QT_INSTALL_PREFIX/src]/*\" \"tests/*\" \"moc_*\" && \
- rm -f temp.gcov-info && \
- genhtml -o coverage -s -f --legend --no-branch-coverage --demangle-cpp application-manager.gcov-info && echo \"\\n\\nCoverage info is available at file://`pwd`/coverage/index.html\" \
-)
-global-check-branch-coverage.target = check-branch-coverage
-global-check-branch-coverage.depends = coverage
-global-check-branch-coverage.commands = ( \
- find . -name \"*.gcov-info\" -print0 | xargs -0 rm -f && \
- cd tests && make check-branch-coverage && cd .. && \
- cd src/common-lib && make check-branch-coverage && cd ../.. && \
- cd src/crypto-lib && make check-branch-coverage && cd ../.. && \
- cd src/installer-lib && make check-branch-coverage && cd ../.. && \
- cd src/manager-lib && make check-branch-coverage && cd ../.. && \
- lcov --rc lcov_branch_coverage=1 -o temp.gcov-info `find . -name "*.gcov-info" | xargs -n1 echo -a` && \
- lcov --rc lcov_branch_coverage=1 -o application-manager.gcov-info -r temp.gcov-info \"/usr/*\" \"$$[QT_INSTALL_PREFIX]/*\" \"$$[QT_INSTALL_PREFIX/src]/*\" \"tests/*\" \"moc_*\" && \
- rm -f temp.gcov-info && \
- genhtml -o branch-coverage -s -f --legend --branch-coverage --rc lcov_branch_coverage=1 --demangle-cpp application-manager.gcov-info && echo \"\\n\\nBranch-Coverage info is available at file://`pwd`/branch-coverage/index.html\" \
+ lcov -c -i -d . --rc lcov_branch_coverage=1 --rc geninfo_auto_base=1 -o base.gcov-info && \
+ cd tests && make check && cd .. && \
+ lcov -c -d . --rc lcov_branch_coverage=1 --rc geninfo_auto_base=1 -o test.gcov-info && \
+ lcov --rc lcov_branch_coverage=1 -o temp.gcov-info `find . -name \"*.gcov-info\" | xargs -n1 echo -a` && \
+ lcov --rc lcov_branch_coverage=1 -o application-manager.gcov-info -r temp.gcov-info $$GCOV_EXCLUDE_STR && \
+ rm -f base.gcov-info test.gcov-info temp.gcov-info && \
+ genhtml -o branch-coverage -s -f --legend --branch-coverage --rc lcov_branch_coverage=1 --demangle-cpp application-manager.gcov-info && echo \"\\n\\nCoverage info is available at file://`pwd`/branch-coverage/index.html\" \
)
-QMAKE_EXTRA_TARGETS -= sub-check-coverage sub-check-branch-coverage
-QMAKE_EXTRA_TARGETS *= global-check-coverage global-check-branch-coverage
+QMAKE_EXTRA_TARGETS -= sub-check-coverage
+QMAKE_EXTRA_TARGETS *= global-check-coverage
diff --git a/doc/installation.qdoc b/doc/installation.qdoc
index d55633c5..0f4a899e 100644
--- a/doc/installation.qdoc
+++ b/doc/installation.qdoc
@@ -198,18 +198,14 @@ compiling.
\chapter Generating Code-Coverage Data
Instead of doing a normal build, you can also create a coverage build by running \c{make coverage}.
+As every compile step needs to be instrumented with special compiler flags, you need to make sure
+to run \c{make clean} before.
Using a build like this enables you to generate HTML coverage reports simply by executing:
\badcode
make check-coverage
\endcode
-or
-
-\badcode
-make check-branch-coverage
-\endcode
-
in the build directory. The command-line output will tell you the url to the generated report.
\chapter System Setup
diff --git a/qmake-features/am-coverage.prf b/qmake-features/am-coverage.prf
index 4ca3f4ce..b642b4a9 100644
--- a/qmake-features/am-coverage.prf
+++ b/qmake-features/am-coverage.prf
@@ -1,14 +1,9 @@
# generate code coverage information using gcov/lcov/genhtml
-
CONFIG(debug,debug|release) {
equals(TEMPLATE, "subdirs") {
sub-coverage.target = coverage
sub-coverage.CONFIG = recursive
- sub-check-coverage.target = check-coverage
- sub-check-coverage.CONFIG = recursive
- sub-check-branch-coverage.target = check-branch-coverage
- sub-check-branch-coverage.CONFIG = recursive
- QMAKE_EXTRA_TARGETS += sub-coverage sub-check-coverage sub-check-branch-coverage
+ QMAKE_EXTRA_TARGETS += sub-coverage
} else {
coverage_pre.commands += @echo && echo "Building with coverage support..." && echo $(eval CXXFLAGS += -O0 -fprofile-arcs -ftest-coverage)$(eval LFLAGS += -O0 -fprofile-arcs -ftest-coverage)
@@ -16,19 +11,8 @@ CONFIG(debug,debug|release) {
coverage.commands = @echo && echo "Finished building with coverage support." && echo
build_pass|!debug_and_release:coverage.depends = coverage_pre all
- equals(TEMPLATE, "lib") {
- CLEAR_AND_RUN="true"
- } else {
- CLEAR_AND_RUN="lcov -z -d . -b . && $$COVERAGE_RUNTIME ./$(TARGET)"
- }
-
- check-coverage.commands = @echo && echo "Checking coverage..." && $$CLEAR_AND_RUN && lcov -c -d . -b . -o $(TARGET).gcov-info
- check-coverage.depends = coverage
-
- check-branch-coverage.commands = @echo && echo "Checking branch coverage..." && $$CLEAR_AND_RUN && lcov -c -d . -b . -o $(TARGET).gcov-info --rc lcov_branch_coverage=1
- check-branch-coverage.depends = coverage
-
- QMAKE_CLEAN += $(OBJECTS_DIR)/*.gcda $(OBJECTS_DIR)/*.gcno $(TARGET).gcov-info
- QMAKE_EXTRA_TARGETS *= coverage_pre coverage check-coverage check-branch-coverage
+ QMAKE_EXTRA_TARGETS *= coverage_pre coverage
}
}
+
+QMAKE_CLEAN += $(OBJECTS_DIR)/*.gcda $(OBJECTS_DIR)/*.gcno $(TARGET).gcov-info