summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2018-08-06 17:07:07 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2019-01-24 15:51:13 +0000
commit3a5f86d78452714f2a57772f33f8e6c6b49b6f22 (patch)
treef7a6b66c73a76f87343a08c4b6456b6e7699ae99
parentf3de22b2117f083308a45cc3ed80979db421e274 (diff)
Add a feature to enable CodeCoverage analysis of testlib
Based on Asmo Saarela's advice (QTPM-686), adapted on advice from FrogLogic support and converted to a feature so that the selftest and testlib qmake config can be co-ordinated. Task-number: QTPM-1385 Change-Id: Icd706f086009e1e08b3f8c5cd553f792402e28c0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r--src/testlib/configure.json6
-rw-r--r--src/testlib/qtest.h25
-rw-r--r--src/testlib/qtestcase.cpp2
-rw-r--r--src/testlib/qtestlog.cpp5
-rw-r--r--src/testlib/selfcover.pri28
-rw-r--r--src/testlib/testlib.pro1
-rw-r--r--tests/auto/testlib/qabstractitemmodeltester/qabstractitemmodeltester.pro2
-rw-r--r--tests/auto/testlib/qsignalspy/qsignalspy.pro2
-rw-r--r--tests/auto/testlib/selftests/alive/alive.pro2
-rw-r--r--tests/auto/testlib/selftests/assert/assert.pro2
-rw-r--r--tests/auto/testlib/selftests/badxml/badxml.pro2
-rw-r--r--tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind.pro2
-rw-r--r--tests/auto/testlib/selftests/benchlibcounting/benchlibcounting.pro2
-rw-r--r--tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter.pro2
-rw-r--r--tests/auto/testlib/selftests/benchliboptions/benchliboptions.pro2
-rw-r--r--tests/auto/testlib/selftests/benchlibtickcounter/benchlibtickcounter.pro2
-rw-r--r--tests/auto/testlib/selftests/benchlibwalltime/benchlibwalltime.pro2
-rw-r--r--tests/auto/testlib/selftests/blacklisted/blacklisted.pro2
-rw-r--r--tests/auto/testlib/selftests/cmptest/cmptest.pro2
-rw-r--r--tests/auto/testlib/selftests/commandlinedata/commandlinedata.pro2
-rw-r--r--tests/auto/testlib/selftests/counting/counting.pro2
-rw-r--r--tests/auto/testlib/selftests/crashes/crashes.pro2
-rw-r--r--tests/auto/testlib/selftests/datatable/datatable.pro2
-rw-r--r--tests/auto/testlib/selftests/datetime/datetime.pro2
-rw-r--r--tests/auto/testlib/selftests/deleteLater/deleteLater.pro2
-rw-r--r--tests/auto/testlib/selftests/deleteLater_noApp/deleteLater_noApp.pro2
-rw-r--r--tests/auto/testlib/selftests/differentexec/differentexec.pro2
-rw-r--r--tests/auto/testlib/selftests/exceptionthrow/exceptionthrow.pro2
-rw-r--r--tests/auto/testlib/selftests/expectfail/expectfail.pro2
-rw-r--r--tests/auto/testlib/selftests/failcleanup/failcleanup.pro2
-rw-r--r--tests/auto/testlib/selftests/failinit/failinit.pro2
-rw-r--r--tests/auto/testlib/selftests/failinitdata/failinitdata.pro2
-rw-r--r--tests/auto/testlib/selftests/fetchbogus/fetchbogus.pro2
-rw-r--r--tests/auto/testlib/selftests/findtestdata/findtestdata.pro2
-rw-r--r--tests/auto/testlib/selftests/float/float.pro2
-rw-r--r--tests/auto/testlib/selftests/globaldata/globaldata.pro2
-rw-r--r--tests/auto/testlib/selftests/keyboard/keyboard.pro2
-rw-r--r--tests/auto/testlib/selftests/longstring/longstring.pro2
-rw-r--r--tests/auto/testlib/selftests/maxwarnings/maxwarnings.pro2
-rw-r--r--tests/auto/testlib/selftests/mouse/mouse.pro2
-rw-r--r--tests/auto/testlib/selftests/multiexec/multiexec.pro2
-rw-r--r--tests/auto/testlib/selftests/pairdiagnostics/pairdiagnostics.pro2
-rw-r--r--tests/auto/testlib/selftests/printdatatags/printdatatags.pro2
-rw-r--r--tests/auto/testlib/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro2
-rw-r--r--tests/auto/testlib/selftests/qexecstringlist/qexecstringlist.pro2
-rw-r--r--tests/auto/testlib/selftests/silent/silent.pro2
-rw-r--r--tests/auto/testlib/selftests/singleskip/singleskip.pro2
-rw-r--r--tests/auto/testlib/selftests/skip/skip.pro2
-rw-r--r--tests/auto/testlib/selftests/skipcleanup/skipcleanup.pro2
-rw-r--r--tests/auto/testlib/selftests/skipinit/skipinit.pro2
-rw-r--r--tests/auto/testlib/selftests/skipinitdata/skipinitdata.pro2
-rw-r--r--tests/auto/testlib/selftests/sleep/sleep.pro2
-rw-r--r--tests/auto/testlib/selftests/strcmp/strcmp.pro2
-rw-r--r--tests/auto/testlib/selftests/subtest/subtest.pro2
-rw-r--r--tests/auto/testlib/selftests/test/test.pro1
-rw-r--r--tests/auto/testlib/selftests/testlib/testlib.pro2
-rw-r--r--tests/auto/testlib/selftests/tuplediagnostics/tuplediagnostics.pro2
-rw-r--r--tests/auto/testlib/selftests/verbose1/verbose1.pro2
-rw-r--r--tests/auto/testlib/selftests/verbose2/verbose2.pro2
-rw-r--r--tests/auto/testlib/selftests/verifyexceptionthrown/verifyexceptionthrown.pro2
-rw-r--r--tests/auto/testlib/selftests/warnings/warnings.pro2
-rw-r--r--tests/auto/testlib/selftests/xunit/xunit.pro2
62 files changed, 177 insertions, 1 deletions
diff --git a/src/testlib/configure.json b/src/testlib/configure.json
index c464037205..df6132cdc2 100644
--- a/src/testlib/configure.json
+++ b/src/testlib/configure.json
@@ -5,6 +5,12 @@
],
"features": {
+ "testlib_selfcover": {
+ "label": "Coverage testing of testlib itself",
+ "purpose": "Gauges how thoroughly testlib's selftest exercises testlib's code",
+ "autoDetect": false,
+ "output": [ "publicFeature" ]
+ },
"itemmodeltester": {
"label": "Tester for item models",
"purpose": "Provides a utility to test item models.",
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index 3906eddb79..ebd94939ce 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -374,9 +374,30 @@ QT_END_NAMESPACE
# define QTEST_SET_MAIN_SOURCE_PATH QTest::setMainSourcePath(__FILE__);
#endif
+// Hooks for coverage-testing of QTestLib itself:
+#if QT_CONFIG(testlib_selfcover) && defined(__COVERAGESCANNER__)
+struct QtCoverageScanner
+{
+ QtCoverageScanner(const char *name)
+ {
+ __coveragescanner_clear();
+ __coveragescanner_testname(name);
+ }
+ ~QtCoverageScanner()
+ {
+ __coveragescanner_save();
+ __coveragescanner_testname("");
+ }
+};
+#define TESTLIB_SELFCOVERAGE_START(name) QtCoverageScanner _qtCoverageScanner(name);
+#else
+#define TESTLIB_SELFCOVERAGE_START(name)
+#endif
+
#define QTEST_APPLESS_MAIN(TestObject) \
int main(int argc, char *argv[]) \
{ \
+ TESTLIB_SELFCOVERAGE_START(TestObject) \
TestObject tc; \
QTEST_SET_MAIN_SOURCE_PATH \
return QTest::qExec(&tc, argc, argv); \
@@ -406,6 +427,7 @@ int main(int argc, char *argv[]) \
#define QTEST_MAIN(TestObject) \
int main(int argc, char *argv[]) \
{ \
+ TESTLIB_SELFCOVERAGE_START(#TestObject) \
QApplication app(argc, argv); \
app.setAttribute(Qt::AA_Use96Dpi, true); \
QTEST_DISABLE_KEYPAD_NAVIGATION \
@@ -421,6 +443,7 @@ int main(int argc, char *argv[]) \
#define QTEST_MAIN(TestObject) \
int main(int argc, char *argv[]) \
{ \
+ TESTLIB_SELFCOVERAGE_START(#TestObject) \
QGuiApplication app(argc, argv); \
app.setAttribute(Qt::AA_Use96Dpi, true); \
TestObject tc; \
@@ -433,6 +456,7 @@ int main(int argc, char *argv[]) \
#define QTEST_MAIN(TestObject) \
int main(int argc, char *argv[]) \
{ \
+ TESTLIB_SELFCOVERAGE_START(#TestObject) \
QCoreApplication app(argc, argv); \
app.setAttribute(Qt::AA_Use96Dpi, true); \
TestObject tc; \
@@ -445,6 +469,7 @@ int main(int argc, char *argv[]) \
#define QTEST_GUILESS_MAIN(TestObject) \
int main(int argc, char *argv[]) \
{ \
+ TESTLIB_SELFCOVERAGE_START(#TestObject) \
QCoreApplication app(argc, argv); \
app.setAttribute(Qt::AA_Use96Dpi, true); \
TestObject tc; \
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 9f0cdb0109..15e123bdb7 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -246,7 +246,7 @@ static void stackTrace()
static bool installCoverageTool(const char * appname, const char * testname)
{
-#ifdef __COVERAGESCANNER__
+#if defined(__COVERAGESCANNER__) && !QT_CONFIG(testlib_selfcover)
if (!qEnvironmentVariableIsEmpty("QT_TESTCOCOON_ACTIVE"))
return false;
// Set environment variable QT_TESTCOCOON_ACTIVE to prevent an eventual subtest from
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index 1268730cc6..e7150260e5 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -73,6 +73,10 @@ QT_BEGIN_NAMESPACE
static void saveCoverageTool(const char * appname, bool testfailed, bool installedTestCoverage)
{
#ifdef __COVERAGESCANNER__
+# if QT_CONFIG(testlib_selfcover)
+ __coveragescanner_teststate(QTestLog::failCount() > 0 ? "FAILED" :
+ QTestLog::passCount() > 0 ? "PASSED" : "SKIPPED");
+# else
if (!installedTestCoverage)
return;
// install again to make sure the filename is correct.
@@ -83,6 +87,7 @@ static void saveCoverageTool(const char * appname, bool testfailed, bool install
__coveragescanner_testname("");
__coveragescanner_clear();
unsetenv("QT_TESTCOCOON_ACTIVE");
+# endif // testlib_selfcover
#else
Q_UNUSED(appname);
Q_UNUSED(testfailed);
diff --git a/src/testlib/selfcover.pri b/src/testlib/selfcover.pri
new file mode 100644
index 0000000000..7de50ba6e6
--- /dev/null
+++ b/src/testlib/selfcover.pri
@@ -0,0 +1,28 @@
+# Configuration for testlib and its tests, to instrument with
+# FrogLogic's Squish CoCo (cf. testcocoon.prf, which handles similar
+# for general code; but testlib needs special handling).
+
+# Only for use when feature testlib_selfcover is enabled:
+!qtConfig(testlib_selfcover): return()
+
+# This enables verification that testlib itself is adequately tested,
+# as a grounds for trusting that testing with it is useful.
+# Exclude all non-testlib source from coverage instrumentation:
+COVERAGE_OPTIONS = --cs-exclude-file-abs-wildcard=$$QT_SOURCE_TREE/*
+COVERAGE_OPTIONS += --cs-include-file-abs-wildcard=*/src/testlib/*
+COVERAGE_OPTIONS += --cs-mcc # enable Multiple Condition Coverage
+COVERAGE_OPTIONS += --cs-mcdc # enable Multiple Condition / Decision Coverage
+# (recommended for ISO 26262 ASIL A, B and C -- highly recommended for ASIL D)
+# https://doc.froglogic.com/squish-coco/4.1/codecoverage.html#sec%3Amcdc
+
+QMAKE_CFLAGS += $$COVERAGE_OPTIONS
+QMAKE_CXXFLAGS += $$COVERAGE_OPTIONS
+QMAKE_LFLAGS += $$COVERAGE_OPTIONS
+
+# FIXME: relies on QMAKE_* being just the command-names, with no path prefix
+QMAKE_CC = cs$$QMAKE_CC
+QMAKE_CXX = cs$$QMAKE_CXX
+QMAKE_LINK = cs$$QMAKE_LINK
+QMAKE_LINK_SHLIB = cs$$QMAKE_LINK_SHLIB
+QMAKE_AR = cs$$QMAKE_AR
+QMAKE_LIB = cs$$QMAKE_LIB
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index 34bb581e02..f52a913a08 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -146,4 +146,5 @@ mac {
!qtHaveModule(network): HEADERSCLEAN_EXCLUDE += qtest_network.h
+include(selfcover.pri)
load(qt_module)
diff --git a/tests/auto/testlib/qabstractitemmodeltester/qabstractitemmodeltester.pro b/tests/auto/testlib/qabstractitemmodeltester/qabstractitemmodeltester.pro
index 306e8089f3..1aefc544d1 100644
--- a/tests/auto/testlib/qabstractitemmodeltester/qabstractitemmodeltester.pro
+++ b/tests/auto/testlib/qabstractitemmodeltester/qabstractitemmodeltester.pro
@@ -11,3 +11,5 @@ SOURCES += \
HEADERS += \
$${mtdir}/dynamictreemodel.h
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/qsignalspy/qsignalspy.pro b/tests/auto/testlib/qsignalspy/qsignalspy.pro
index 1578802bf8..5343a98c14 100644
--- a/tests/auto/testlib/qsignalspy/qsignalspy.pro
+++ b/tests/auto/testlib/qsignalspy/qsignalspy.pro
@@ -2,3 +2,5 @@ CONFIG += testcase
TARGET = tst_qsignalspy
SOURCES += tst_qsignalspy.cpp
QT = core testlib
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/alive/alive.pro b/tests/auto/testlib/selftests/alive/alive.pro
index d3df09b10d..bda0db2282 100644
--- a/tests/auto/testlib/selftests/alive/alive.pro
+++ b/tests/auto/testlib/selftests/alive/alive.pro
@@ -6,3 +6,5 @@ CONFIG -= debug_and_release_target
TARGET = alive
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/assert/assert.pro b/tests/auto/testlib/selftests/assert/assert.pro
index cfc6a0c6b3..0692b6bdf2 100644
--- a/tests/auto/testlib/selftests/assert/assert.pro
+++ b/tests/auto/testlib/selftests/assert/assert.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = assert
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/badxml/badxml.pro b/tests/auto/testlib/selftests/badxml/badxml.pro
index 7b3b0f701c..4e15886504 100644
--- a/tests/auto/testlib/selftests/badxml/badxml.pro
+++ b/tests/auto/testlib/selftests/badxml/badxml.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = badxml
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind.pro b/tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind.pro
index 6cbefe518c..12f068843e 100644
--- a/tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind.pro
+++ b/tests/auto/testlib/selftests/benchlibcallgrind/benchlibcallgrind.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = benchlibcallgrind
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/benchlibcounting/benchlibcounting.pro b/tests/auto/testlib/selftests/benchlibcounting/benchlibcounting.pro
index b495995eac..786511d057 100644
--- a/tests/auto/testlib/selftests/benchlibcounting/benchlibcounting.pro
+++ b/tests/auto/testlib/selftests/benchlibcounting/benchlibcounting.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = benchlibcounting
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter.pro b/tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter.pro
index 5e2b963491..98fa0e4567 100644
--- a/tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter.pro
+++ b/tests/auto/testlib/selftests/benchlibeventcounter/benchlibeventcounter.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = benchlibeventcounter
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/benchliboptions/benchliboptions.pro b/tests/auto/testlib/selftests/benchliboptions/benchliboptions.pro
index f4bcc92129..0b627ecb10 100644
--- a/tests/auto/testlib/selftests/benchliboptions/benchliboptions.pro
+++ b/tests/auto/testlib/selftests/benchliboptions/benchliboptions.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = benchliboptions
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/benchlibtickcounter/benchlibtickcounter.pro b/tests/auto/testlib/selftests/benchlibtickcounter/benchlibtickcounter.pro
index ce0ec7012c..f0741d5c26 100644
--- a/tests/auto/testlib/selftests/benchlibtickcounter/benchlibtickcounter.pro
+++ b/tests/auto/testlib/selftests/benchlibtickcounter/benchlibtickcounter.pro
@@ -6,3 +6,5 @@ CONFIG -= debug_and_release_target
TARGET = benchlibtickcounter
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/benchlibwalltime/benchlibwalltime.pro b/tests/auto/testlib/selftests/benchlibwalltime/benchlibwalltime.pro
index 0e689871ab..80d97a2422 100644
--- a/tests/auto/testlib/selftests/benchlibwalltime/benchlibwalltime.pro
+++ b/tests/auto/testlib/selftests/benchlibwalltime/benchlibwalltime.pro
@@ -6,3 +6,5 @@ CONFIG -= debug_and_release_target
TARGET = benchlibwalltime
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/blacklisted/blacklisted.pro b/tests/auto/testlib/selftests/blacklisted/blacklisted.pro
index 5bd22910b1..a8602ee266 100644
--- a/tests/auto/testlib/selftests/blacklisted/blacklisted.pro
+++ b/tests/auto/testlib/selftests/blacklisted/blacklisted.pro
@@ -5,3 +5,5 @@ mac: CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = blacklisted
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/cmptest/cmptest.pro b/tests/auto/testlib/selftests/cmptest/cmptest.pro
index 2d5dd071a9..f38f5ecce1 100644
--- a/tests/auto/testlib/selftests/cmptest/cmptest.pro
+++ b/tests/auto/testlib/selftests/cmptest/cmptest.pro
@@ -6,3 +6,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = cmptest
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/commandlinedata/commandlinedata.pro b/tests/auto/testlib/selftests/commandlinedata/commandlinedata.pro
index 056388333a..8032ba5a02 100644
--- a/tests/auto/testlib/selftests/commandlinedata/commandlinedata.pro
+++ b/tests/auto/testlib/selftests/commandlinedata/commandlinedata.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = commandlinedata
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/counting/counting.pro b/tests/auto/testlib/selftests/counting/counting.pro
index 8aa2fe5753..be3a5339b0 100644
--- a/tests/auto/testlib/selftests/counting/counting.pro
+++ b/tests/auto/testlib/selftests/counting/counting.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = counting
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/crashes/crashes.pro b/tests/auto/testlib/selftests/crashes/crashes.pro
index 25e24243d1..00fa07a415 100644
--- a/tests/auto/testlib/selftests/crashes/crashes.pro
+++ b/tests/auto/testlib/selftests/crashes/crashes.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = crashes
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/datatable/datatable.pro b/tests/auto/testlib/selftests/datatable/datatable.pro
index 72fa851ae6..12a1f697b1 100644
--- a/tests/auto/testlib/selftests/datatable/datatable.pro
+++ b/tests/auto/testlib/selftests/datatable/datatable.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = datatable
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/datetime/datetime.pro b/tests/auto/testlib/selftests/datetime/datetime.pro
index d65c59354f..1524281090 100644
--- a/tests/auto/testlib/selftests/datetime/datetime.pro
+++ b/tests/auto/testlib/selftests/datetime/datetime.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = datetime
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/deleteLater/deleteLater.pro b/tests/auto/testlib/selftests/deleteLater/deleteLater.pro
index 6847238b1d..9a10096461 100644
--- a/tests/auto/testlib/selftests/deleteLater/deleteLater.pro
+++ b/tests/auto/testlib/selftests/deleteLater/deleteLater.pro
@@ -5,3 +5,5 @@ CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = tst_deleteLater
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/deleteLater_noApp/deleteLater_noApp.pro b/tests/auto/testlib/selftests/deleteLater_noApp/deleteLater_noApp.pro
index f860a767cd..6f2b253c14 100644
--- a/tests/auto/testlib/selftests/deleteLater_noApp/deleteLater_noApp.pro
+++ b/tests/auto/testlib/selftests/deleteLater_noApp/deleteLater_noApp.pro
@@ -5,3 +5,5 @@ CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = tst_deleteLater_noApp
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/differentexec/differentexec.pro b/tests/auto/testlib/selftests/differentexec/differentexec.pro
index 7f148ba996..339962f609 100644
--- a/tests/auto/testlib/selftests/differentexec/differentexec.pro
+++ b/tests/auto/testlib/selftests/differentexec/differentexec.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = differentexec
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/exceptionthrow/exceptionthrow.pro b/tests/auto/testlib/selftests/exceptionthrow/exceptionthrow.pro
index fe89f6f3cd..5473ec32c3 100644
--- a/tests/auto/testlib/selftests/exceptionthrow/exceptionthrow.pro
+++ b/tests/auto/testlib/selftests/exceptionthrow/exceptionthrow.pro
@@ -6,3 +6,5 @@ CONFIG -= debug_and_release_target
CONFIG += exceptions
TARGET = exceptionthrow
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/expectfail/expectfail.pro b/tests/auto/testlib/selftests/expectfail/expectfail.pro
index c1849990f2..db383bee6a 100644
--- a/tests/auto/testlib/selftests/expectfail/expectfail.pro
+++ b/tests/auto/testlib/selftests/expectfail/expectfail.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = expectfail
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/failcleanup/failcleanup.pro b/tests/auto/testlib/selftests/failcleanup/failcleanup.pro
index 426d7cc45b..12da5920fb 100644
--- a/tests/auto/testlib/selftests/failcleanup/failcleanup.pro
+++ b/tests/auto/testlib/selftests/failcleanup/failcleanup.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = failcleanup
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/failinit/failinit.pro b/tests/auto/testlib/selftests/failinit/failinit.pro
index 6a30a5af68..46b1c3a6c4 100644
--- a/tests/auto/testlib/selftests/failinit/failinit.pro
+++ b/tests/auto/testlib/selftests/failinit/failinit.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = failinit
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/failinitdata/failinitdata.pro b/tests/auto/testlib/selftests/failinitdata/failinitdata.pro
index b608c67dbb..63b32cb6d6 100644
--- a/tests/auto/testlib/selftests/failinitdata/failinitdata.pro
+++ b/tests/auto/testlib/selftests/failinitdata/failinitdata.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = failinitdata
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/fetchbogus/fetchbogus.pro b/tests/auto/testlib/selftests/fetchbogus/fetchbogus.pro
index 33b306ca75..0fbb5e4c00 100644
--- a/tests/auto/testlib/selftests/fetchbogus/fetchbogus.pro
+++ b/tests/auto/testlib/selftests/fetchbogus/fetchbogus.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = fetchbogus
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/findtestdata/findtestdata.pro b/tests/auto/testlib/selftests/findtestdata/findtestdata.pro
index f04a640c59..7fbdaea3a3 100644
--- a/tests/auto/testlib/selftests/findtestdata/findtestdata.pro
+++ b/tests/auto/testlib/selftests/findtestdata/findtestdata.pro
@@ -7,3 +7,5 @@ CONFIG -= debug_and_release_target
RESOURCES = findtestdata.qrc
TARGET = findtestdata
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/float/float.pro b/tests/auto/testlib/selftests/float/float.pro
index 95980eeac8..479eb152c5 100644
--- a/tests/auto/testlib/selftests/float/float.pro
+++ b/tests/auto/testlib/selftests/float/float.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = float
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/globaldata/globaldata.pro b/tests/auto/testlib/selftests/globaldata/globaldata.pro
index c0b1554c0f..621416c5b8 100644
--- a/tests/auto/testlib/selftests/globaldata/globaldata.pro
+++ b/tests/auto/testlib/selftests/globaldata/globaldata.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = globaldata
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/keyboard/keyboard.pro b/tests/auto/testlib/selftests/keyboard/keyboard.pro
index 0097318797..488c992e62 100644
--- a/tests/auto/testlib/selftests/keyboard/keyboard.pro
+++ b/tests/auto/testlib/selftests/keyboard/keyboard.pro
@@ -5,3 +5,5 @@ macos:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = keyboard
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/longstring/longstring.pro b/tests/auto/testlib/selftests/longstring/longstring.pro
index d16ba85095..d8961203f3 100644
--- a/tests/auto/testlib/selftests/longstring/longstring.pro
+++ b/tests/auto/testlib/selftests/longstring/longstring.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = longstring
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/maxwarnings/maxwarnings.pro b/tests/auto/testlib/selftests/maxwarnings/maxwarnings.pro
index 79451af1ec..bdca0225d3 100644
--- a/tests/auto/testlib/selftests/maxwarnings/maxwarnings.pro
+++ b/tests/auto/testlib/selftests/maxwarnings/maxwarnings.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = maxwarnings
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/mouse/mouse.pro b/tests/auto/testlib/selftests/mouse/mouse.pro
index 7c06b8aa64..e5701eee0f 100644
--- a/tests/auto/testlib/selftests/mouse/mouse.pro
+++ b/tests/auto/testlib/selftests/mouse/mouse.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = mouse
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/multiexec/multiexec.pro b/tests/auto/testlib/selftests/multiexec/multiexec.pro
index 2038acbd31..e9b2b7b587 100644
--- a/tests/auto/testlib/selftests/multiexec/multiexec.pro
+++ b/tests/auto/testlib/selftests/multiexec/multiexec.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = multiexec
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/pairdiagnostics/pairdiagnostics.pro b/tests/auto/testlib/selftests/pairdiagnostics/pairdiagnostics.pro
index 1c07c93e9d..25f5bfe809 100644
--- a/tests/auto/testlib/selftests/pairdiagnostics/pairdiagnostics.pro
+++ b/tests/auto/testlib/selftests/pairdiagnostics/pairdiagnostics.pro
@@ -4,3 +4,5 @@ QT = core testlib
CONFIG -= app_bundle debug_and_release_target
TARGET = pairdiagnostics
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/printdatatags/printdatatags.pro b/tests/auto/testlib/selftests/printdatatags/printdatatags.pro
index cd06384835..83f171aac5 100644
--- a/tests/auto/testlib/selftests/printdatatags/printdatatags.pro
+++ b/tests/auto/testlib/selftests/printdatatags/printdatatags.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = printdatatags
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro b/tests/auto/testlib/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro
index f1cf25d104..00ca4a0e62 100644
--- a/tests/auto/testlib/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro
+++ b/tests/auto/testlib/selftests/printdatatagswithglobaltags/printdatatagswithglobaltags.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = printdatatagswithglobaltags
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/qexecstringlist/qexecstringlist.pro b/tests/auto/testlib/selftests/qexecstringlist/qexecstringlist.pro
index bd967f32e6..4d7af8ab40 100644
--- a/tests/auto/testlib/selftests/qexecstringlist/qexecstringlist.pro
+++ b/tests/auto/testlib/selftests/qexecstringlist/qexecstringlist.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = qexecstringlist
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/silent/silent.pro b/tests/auto/testlib/selftests/silent/silent.pro
index 3150f65a5e..3f6325a010 100644
--- a/tests/auto/testlib/selftests/silent/silent.pro
+++ b/tests/auto/testlib/selftests/silent/silent.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = silent
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/singleskip/singleskip.pro b/tests/auto/testlib/selftests/singleskip/singleskip.pro
index 9f63e62747..a32c22c943 100644
--- a/tests/auto/testlib/selftests/singleskip/singleskip.pro
+++ b/tests/auto/testlib/selftests/singleskip/singleskip.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = singleskip
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/skip/skip.pro b/tests/auto/testlib/selftests/skip/skip.pro
index 8780d295cf..19a01908af 100644
--- a/tests/auto/testlib/selftests/skip/skip.pro
+++ b/tests/auto/testlib/selftests/skip/skip.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = skip
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/skipcleanup/skipcleanup.pro b/tests/auto/testlib/selftests/skipcleanup/skipcleanup.pro
index f98cda7596..059132b5a6 100644
--- a/tests/auto/testlib/selftests/skipcleanup/skipcleanup.pro
+++ b/tests/auto/testlib/selftests/skipcleanup/skipcleanup.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = skipcleanup
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/skipinit/skipinit.pro b/tests/auto/testlib/selftests/skipinit/skipinit.pro
index 7defce9a52..6605226993 100644
--- a/tests/auto/testlib/selftests/skipinit/skipinit.pro
+++ b/tests/auto/testlib/selftests/skipinit/skipinit.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = skipinit
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/skipinitdata/skipinitdata.pro b/tests/auto/testlib/selftests/skipinitdata/skipinitdata.pro
index cd806c2a43..176955500b 100644
--- a/tests/auto/testlib/selftests/skipinitdata/skipinitdata.pro
+++ b/tests/auto/testlib/selftests/skipinitdata/skipinitdata.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = skipinitdata
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/sleep/sleep.pro b/tests/auto/testlib/selftests/sleep/sleep.pro
index affcba22ee..b109bf6253 100644
--- a/tests/auto/testlib/selftests/sleep/sleep.pro
+++ b/tests/auto/testlib/selftests/sleep/sleep.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = sleep
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/strcmp/strcmp.pro b/tests/auto/testlib/selftests/strcmp/strcmp.pro
index f5f6eecc88..35a4c5e858 100644
--- a/tests/auto/testlib/selftests/strcmp/strcmp.pro
+++ b/tests/auto/testlib/selftests/strcmp/strcmp.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = strcmp
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/subtest/subtest.pro b/tests/auto/testlib/selftests/subtest/subtest.pro
index 09dee1b1b9..b5c294aed6 100644
--- a/tests/auto/testlib/selftests/subtest/subtest.pro
+++ b/tests/auto/testlib/selftests/subtest/subtest.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = subtest
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/test/test.pro b/tests/auto/testlib/selftests/test/test.pro
index ec1633ebff..fce8e48ca2 100644
--- a/tests/auto/testlib/selftests/test/test.pro
+++ b/tests/auto/testlib/selftests/test/test.pro
@@ -19,3 +19,4 @@ RESOURCES += expected_files
include(../selftests.pri)
!android:!winrt: for(file, SUBPROGRAMS): TEST_HELPER_INSTALLS += "../$${file}/$${file}"
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/testlib/testlib.pro b/tests/auto/testlib/selftests/testlib/testlib.pro
index a909c1c213..8798f86b18 100644
--- a/tests/auto/testlib/selftests/testlib/testlib.pro
+++ b/tests/auto/testlib/selftests/testlib/testlib.pro
@@ -5,3 +5,5 @@ darwin: CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = testlib
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/tuplediagnostics/tuplediagnostics.pro b/tests/auto/testlib/selftests/tuplediagnostics/tuplediagnostics.pro
index 7a29e0e5e1..f338170b81 100644
--- a/tests/auto/testlib/selftests/tuplediagnostics/tuplediagnostics.pro
+++ b/tests/auto/testlib/selftests/tuplediagnostics/tuplediagnostics.pro
@@ -4,3 +4,5 @@ QT = core testlib
CONFIG -= app_bundle debug_and_release_target
TARGET = tuplediagnostics
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/verbose1/verbose1.pro b/tests/auto/testlib/selftests/verbose1/verbose1.pro
index f00ae69d17..1f16d70d66 100644
--- a/tests/auto/testlib/selftests/verbose1/verbose1.pro
+++ b/tests/auto/testlib/selftests/verbose1/verbose1.pro
@@ -8,3 +8,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = verbose1
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/verbose2/verbose2.pro b/tests/auto/testlib/selftests/verbose2/verbose2.pro
index 796cdeb975..bf54904488 100644
--- a/tests/auto/testlib/selftests/verbose2/verbose2.pro
+++ b/tests/auto/testlib/selftests/verbose2/verbose2.pro
@@ -8,3 +8,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = verbose2
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/verifyexceptionthrown/verifyexceptionthrown.pro b/tests/auto/testlib/selftests/verifyexceptionthrown/verifyexceptionthrown.pro
index 51f108c9d7..198d35dc6c 100644
--- a/tests/auto/testlib/selftests/verifyexceptionthrown/verifyexceptionthrown.pro
+++ b/tests/auto/testlib/selftests/verifyexceptionthrown/verifyexceptionthrown.pro
@@ -6,3 +6,5 @@ CONFIG -= debug_and_release_target
CONFIG += exceptions
TARGET = verifyexceptionthrown
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/warnings/warnings.pro b/tests/auto/testlib/selftests/warnings/warnings.pro
index 0c6cddcefb..a0bd2c62ba 100644
--- a/tests/auto/testlib/selftests/warnings/warnings.pro
+++ b/tests/auto/testlib/selftests/warnings/warnings.pro
@@ -5,3 +5,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = warnings
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)
diff --git a/tests/auto/testlib/selftests/xunit/xunit.pro b/tests/auto/testlib/selftests/xunit/xunit.pro
index b8c606e828..becb46ce8b 100644
--- a/tests/auto/testlib/selftests/xunit/xunit.pro
+++ b/tests/auto/testlib/selftests/xunit/xunit.pro
@@ -6,3 +6,5 @@ mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = xunit
+
+include($$QT_SOURCE_TREE/src/testlib/selfcover.pri)