diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-12-07 16:45:14 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-08 08:51:35 +0100 |
commit | dd2b5b88be78927cb3161a1c1e7219f36417b376 (patch) | |
tree | a0ea34141937fd9d414ea22ab29b80156ff35baa | |
parent | 1e37a053ed6d52cd2ea662f84c97c718b38367c9 (diff) |
QTestlib/Selftest: Fix Windows.
- Do not run with empty environment. At least PATH
is required at least (Qt + MSVC/MinGW runtime)
- Account for MSVC's different formatting of double numbers.
Change-Id: Ic7b1cf4a16a88c5384347b2651b011ac13c92d70
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
-rw-r--r-- | tests/auto/testlib/selftests/tst_selftests.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 43081415c7..f7a485b857 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -426,11 +426,20 @@ void tst_Selftests::runSubTest_data() } } +static inline QProcessEnvironment processEnvironment() +{ + QProcessEnvironment result; + const QString path = QStringLiteral("PATH"); + result.insert(path, QProcessEnvironment::systemEnvironment().value(path)); + return result; +} + void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& loggers, QStringList const& arguments) { QProcess proc; - proc.setEnvironment(QStringList("")); - proc.start(subdir + "/" + subdir, arguments); + static const QProcessEnvironment environment = processEnvironment(); + proc.setProcessEnvironment(environment); + proc.start(subdir + QLatin1Char('/') + subdir, arguments); QVERIFY2(proc.waitForFinished(), qPrintable(proc.errorString())); QList<QByteArray> actualOutputs; @@ -469,6 +478,15 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge QString logger = loggers[n]; QList<QByteArray> res = splitLines(actualOutputs[n]); QList<QByteArray> exp = expectedResult(subdir, logger); +#ifdef Q_CC_MSVC + // MSVC formats double numbers differently + if (n == 0 && subdir == QStringLiteral("float")) { + for (int i = 0; i < exp.size(); ++i) { + exp[i].replace("e-07", "e-007"); + exp[i].replace("e+07", "e+007"); + } + } +#endif // For the "crashes" test, there are multiple versions of the // expected output. Load the one with the same line count as |