From ad788c1014ea7a84f4ad9c52f50b957074cb3e38 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 18 Nov 2016 12:39:36 +0100 Subject: tst_qstandardpaths: Disable WOW64 redirection on Windows The logo (microsoft.windows.softwarelogo.showdesktop.exe) is otherwise not found. Change-Id: Ic52329462612a027e2928922a1f9a541dcbc67a3 Reviewed-by: Jesus Fernandez Reviewed-by: Oliver Wolff --- .../auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index e1c277717d..92e66e20c2 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -38,6 +38,9 @@ #include #include #include +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE) +# include +#endif #ifdef Q_OS_UNIX #include @@ -131,6 +134,16 @@ static const char * const enumNames[MaxStandardLocation + 1 - int(QStandardPaths void tst_qstandardpaths::initTestCase() { +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE) + // Disable WOW64 redirection, see testFindExecutable() + if (QSysInfo::buildCpuArchitecture() != QSysInfo::currentCpuArchitecture()) { + void *oldMode; + const bool disabledDisableWow64FsRedirection = Wow64DisableWow64FsRedirection(&oldMode) == TRUE; + if (!disabledDisableWow64FsRedirection) + qErrnoWarning("Wow64DisableWow64FsRedirection() failed"); + QVERIFY(disabledDisableWow64FsRedirection); + } +#endif // Q_OS_WIN && !Q_OS_WINRT && !Q_OS_WINCE QVERIFY2(m_localConfigTempDir.isValid(), qPrintable(m_localConfigTempDir.errorString())); QVERIFY2(m_globalConfigTempDir.isValid(), qPrintable(m_globalConfigTempDir.errorString())); QVERIFY2(m_localAppTempDir.isValid(), qPrintable(m_localAppTempDir.errorString())); @@ -380,6 +393,7 @@ void tst_qstandardpaths::testFindExecutable_data() if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS8) { // The logo executable on Windows 8 is perfectly suited for testing that the // suffix mechanism is not thrown off by dots in the name. + // Note: Requires disabling WOW64 redirection, see initTestCase() const QString logo = QLatin1String("microsoft.windows.softwarelogo.showdesktop"); const QString logoPath = cmdFi.absolutePath() + QLatin1Char('/') + logo + QLatin1String(".exe"); QTest::newRow("win8-logo") -- cgit v1.2.3