|
1 # |
|
2 ############################################################################# |
|
3 ## |
|
4 ## Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
5 ## All rights reserved. |
|
6 ## Contact: Nokia Corporation (developer.feedback@nokia.com) |
|
7 ## |
|
8 ## This file is part of the UI Extensions for Mobile. |
|
9 ## |
|
10 ## GNU Lesser General Public License Usage |
|
11 ## This file may be used under the terms of the GNU Lesser General Public |
|
12 ## License version 2.1 as published by the Free Software Foundation and |
|
13 ## appearing in the file LICENSE.LGPL included in the packaging of this file. |
|
14 ## Please review the following information to ensure the GNU Lesser General |
|
15 ## Public License version 2.1 requirements will be met: |
|
16 ## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
17 ## |
|
18 ## In addition, as a special exception, Nokia gives you certain additional |
|
19 ## rights. These rights are described in the Nokia Qt LGPL Exception |
|
20 ## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
21 ## |
|
22 ## If you have questions regarding the use of this file, please contact |
|
23 ## Nokia at developer.feedback@nokia.com. |
|
24 ## |
|
25 ############################################################################# |
|
26 # |
|
27 |
|
28 coverage:!symbian { |
|
29 |
|
30 HB_COVERAGE_DIR = $${HB_BUILD_DIR}/coverage |
|
31 unix:HB_COVERAGE_EXCLUDE += \"/usr/*\" \"*/3rdparty/*\" \"*.moc\" \"moc_*.cpp\" \"qrc_*.cpp\" |
|
32 win32:HB_COVERAGE_EXCLUDE += "EXCLUDE+*/3rdparty/*,*/moc/*,*/rcc/*,*/unit/*" |
|
33 |
|
34 root { |
|
35 |
|
36 unix { |
|
37 pre_coverage.recurse = src |
|
38 measure_coverage.recurse = src |
|
39 post_coverage.recurse = src |
|
40 |
|
41 post_coverage.commands = @[ ! -e $${HB_COVERAGE_DIR}/*.cov ] |
|
42 post_coverage.commands += || ( rm -f $${HB_COVERAGE_DIR}/Hb.cov |
|
43 post_coverage.commands += && cat $${HB_COVERAGE_DIR}/*.cov > $${HB_COVERAGE_DIR}/Hb.cov |
|
44 post_coverage.commands += && genhtml --output-directory $${HB_COVERAGE_DIR}/html $${HB_COVERAGE_DIR}/Hb.cov |
|
45 # would open a browser automatically if wanted |
|
46 # post_coverage.commands += && xdg-open $${HB_BUILD_DIR}/coverage/html/index.html |
|
47 post_coverage.commands += && echo \"\nTest code coverage results stored to: $${HB_COVERAGE_DIR}\n\" ) |
|
48 } |
|
49 |
|
50 win32 { |
|
51 pre_coverage.commands = $(DEL_FILE) $$hbNativePath($${HB_COVERAGE_DIR}/MON.dat) > NUL 2>&1 |
|
52 |
|
53 measure_coverage.commands = ctcwrap -C $${HB_COVERAGE_EXCLUDE} -n $${HB_COVERAGE_DIR}/MON.sym -i m $(MAKE) test |
|
54 |
|
55 post_coverage.commands = post_coverage.commands = ctcpost $${HB_COVERAGE_DIR}/MON.sym $${HB_COVERAGE_DIR}/MON.dat -p $${HB_COVERAGE_DIR}/profile.txt $$escape_expand(\n\t) |
|
56 post_coverage.commands += ctc2html -i $${HB_COVERAGE_DIR}/profile.txt -o $${HB_COVERAGE_DIR} $$escape_expand(\n\t) |
|
57 post_coverage.commands += @echo "Test code coverage results stored to: $${HB_COVERAGE_DIR}" |
|
58 } |
|
59 |
|
60 measure_coverage.depends = pre_coverage |
|
61 unix:measure_coverage.depends = test |
|
62 post_coverage.depends = measure_coverage |
|
63 coverage.depends = post_coverage |
|
64 QMAKE_EXTRA_TARGETS *= coverage pre_coverage measure_coverage post_coverage |
|
65 |
|
66 } |
|
67 |
|
68 contains(TEMPLATE, .*subdirs$) { |
|
69 |
|
70 unix { |
|
71 pre_coverage.CONFIG += recursive |
|
72 measure_coverage.CONFIG += recursive |
|
73 post_coverage.CONFIG += recursive |
|
74 QMAKE_EXTRA_TARGETS *= pre_coverage measure_coverage post_coverage |
|
75 } |
|
76 |
|
77 } else:contains(TEMPLATE, .*lib$)|contains(TEMPLATE, .*app$) { |
|
78 |
|
79 unix { |
|
80 QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage |
|
81 QMAKE_LIBS += -lgcov |
|
82 |
|
83 pre_coverage.commands = @lcov --directory \$(OBJECTS_DIR) --zerocounters |
|
84 |
|
85 measure_coverage.commands = @[ ! -e *.gcda ] |
|
86 measure_coverage.commands += || ( mkdir -p $${HB_COVERAGE_DIR} |
|
87 measure_coverage.commands += && lcov --directory \$(OBJECTS_DIR) --capture --output-file $${HB_COVERAGE_DIR}/\$(QMAKE_TARGET).cov |
|
88 measure_coverage.commands += && lcov --remove $${HB_COVERAGE_DIR}/\$(QMAKE_TARGET).cov $${HB_COVERAGE_EXCLUDE} --output-file $${HB_COVERAGE_DIR}/\$(QMAKE_TARGET).cov ) |
|
89 |
|
90 QMAKE_EXTRA_TARGETS *= pre_coverage measure_coverage post_coverage |
|
91 } |
|
92 } |
|
93 } |