From de6d3d5b1d49e017d9385ce9c4952f0fc7e189bf Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Tue, 10 Jan 2012 13:46:12 +1000 Subject: 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 Reviewed-by: Rohan McGovern Reviewed-by: Jason McDonald --- tests/auto/testlib/selftests/tst_selftests.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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); -- cgit v1.2.3