summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib
diff options
context:
space:
mode:
authorKurt Korbatits <kurt.korbatits@nokia.com>2012-01-10 13:46:12 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-11 04:09:32 +0100
commitde6d3d5b1d49e017d9385ce9c4952f0fc7e189bf (patch)
treef4964126bf657c7356c17084c77852d3341450f2 /tests/auto/testlib
parent28bfa8f6cc62306ada0fbd4e367f4b99748ca606 (diff)
Changed selftests unittest to not fail but warn when valgrind not installed.
- Changed to detect valgrind at runtime and skip test instead of failing. - subprograms inherit QT_QPA_PLATFORM value from parent if set. Change-Id: I280acee389df1ee74ee6758a0dd1601226e103c7 Reviewed-by: Kurt Korbatits <kurt.korbatits@nokia.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Diffstat (limited to 'tests/auto/testlib')
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index f33e7a3e0f..04696a1387 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -466,11 +466,26 @@ static inline QProcessEnvironment processEnvironment()
if (!displayValue.isEmpty())
result.insert(display, displayValue);
#endif
+ const QString platform = QStringLiteral("QT_QPA_PLATFORM");
+ const QString platformValue = systemEnvironment.value(platform);
+ if (!platformValue.isEmpty())
+ result.insert(platform, platformValue);
return result;
}
void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& loggers, QStringList const& arguments)
{
+#if defined(__GNUC__) && defined(__i386) && defined(Q_OS_LINUX)
+ if (arguments.contains("-callgrind")) {
+ QProcess checkProcess;
+ QStringList args;
+ args << QLatin1String("--version");
+ checkProcess.start(QLatin1String("valgrind"), args);
+ if (!checkProcess.waitForFinished(-1))
+ QSKIP(QString("Valgrind broken or not available. Not running %1 test!").arg(subdir).toLocal8Bit());
+ }
+#endif
+
QProcess proc;
static const QProcessEnvironment environment = processEnvironment();
proc.setProcessEnvironment(environment);