Integrate gcov support into Qt build system.
To instrument a Qt application or library with the gcov coverage tool, do `CONFIG+=gcov' in the application .pro file. To instrument Qt itself with gcov, use the `-gcov' configure option. Change-Id: If24e91d95318609b0df1a76ed6d679bd92bcaab2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This commit is contained in:
parent
82e976d52c
commit
4780e5326f
2
.gitignore
vendored
2
.gitignore
vendored
@ -61,6 +61,8 @@ Makefile*
|
|||||||
*.pro.user*
|
*.pro.user*
|
||||||
*.qmlproject.user*
|
*.qmlproject.user*
|
||||||
*.gcov
|
*.gcov
|
||||||
|
*.gcda
|
||||||
|
*.gcno
|
||||||
bin/Qt*.dll
|
bin/Qt*.dll
|
||||||
bin/assistant*
|
bin/assistant*
|
||||||
bin/designer*
|
bin/designer*
|
||||||
|
6
configure
vendored
6
configure
vendored
@ -1518,6 +1518,11 @@ while [ "$#" -gt 0 ]; do
|
|||||||
QTCONFIG_CONFIG="$QTCONFIG_CONFIG testcocoon"
|
QTCONFIG_CONFIG="$QTCONFIG_CONFIG testcocoon"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
gcov)
|
||||||
|
if [ "$VAL" = "yes" ]; then
|
||||||
|
QTCONFIG_CONFIG="$QTCONFIG_CONFIG gcov"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
platform)
|
platform)
|
||||||
PLATFORM="$VAL"
|
PLATFORM="$VAL"
|
||||||
# keep compatibility with old platform names
|
# keep compatibility with old platform names
|
||||||
@ -3438,6 +3443,7 @@ Configure options:
|
|||||||
-qtlibinfix <infix> Renames all libQt*.so to libQt*<infix>.so.
|
-qtlibinfix <infix> Renames all libQt*.so to libQt*<infix>.so.
|
||||||
|
|
||||||
-testcocoon ........ Instrument Qt with the TestCocoon code coverage tool.
|
-testcocoon ........ Instrument Qt with the TestCocoon code coverage tool.
|
||||||
|
-gcov .............. Instrument Qt with the GCov code coverage tool.
|
||||||
|
|
||||||
-D <string> ........ Add an explicit define to the preprocessor.
|
-D <string> ........ Add an explicit define to the preprocessor.
|
||||||
-I <string> ........ Add an explicit include path.
|
-I <string> ........ Add an explicit include path.
|
||||||
|
31
mkspecs/features/gcov.prf
Normal file
31
mkspecs/features/gcov.prf
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#
|
||||||
|
# Tested with gcov 4.8.1
|
||||||
|
# http://gcc.gnu.org/onlinedocs/gcc-4.8.1/gcc/Gcov.html
|
||||||
|
|
||||||
|
# To instrument a Qt application or library with the gcov coverage
|
||||||
|
# tool, do `CONFIG+=gcov' in the application .pro file.
|
||||||
|
#
|
||||||
|
# To instrument Qt itself with gcov, use the `-gcov' configure
|
||||||
|
# option.
|
||||||
|
|
||||||
|
# The .gcno file is generated when the source file is compiled.
|
||||||
|
# The .gcda file is generated when a program is executed.
|
||||||
|
|
||||||
|
# Example how to generate the html output after you've run the program or test
|
||||||
|
#
|
||||||
|
# lcov --capture --directory . --output-file coverage-gcov.info --no-external
|
||||||
|
# lcov --output-file coverage-gcov.info --remove coverage-gcov.info '*.moc*' '.*rcc*' '*3rdparty*'
|
||||||
|
# genhtml coverage-gcov.info --output-directory doc/coverage
|
||||||
|
|
||||||
|
# If you want to use gcov directly, you most likely need to manually move the .gcda and .gcno files
|
||||||
|
# along with the program.
|
||||||
|
#
|
||||||
|
# mv .obj/debug-shared/tst_example.gc* .
|
||||||
|
# gcov -b -c tst_example.cpp
|
||||||
|
|
||||||
|
QMAKE_CFLAGS += -fprofile-arcs -ftest-coverage
|
||||||
|
QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
|
||||||
|
QMAKE_OBJECTIVE_CFLAGS += -fprofile-arcs -ftest-coverage
|
||||||
|
QMAKE_LFLAGS += -fprofile-arcs -ftest-coverage
|
||||||
|
|
||||||
|
QMAKE_CLEAN += $(OBJECTS_DIR)*.gcno and $(OBJECTS_DIR)*.gcda
|
Loading…
Reference in New Issue
Block a user