From ac384524c8fa6b19153811e2eaf6dac6b911f930 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 14 Oct 2016 14:51:16 +0200 Subject: Speculative fix for tst_QThread::wait2() flakiness This test fails on Windows occasionally with values just short of 800, the lowest observed being 791. It is probably rounding somehow to 10ms segments, so allow it to be up to 10 ms too fast. Change-Id: Ie28e9f61588b68a9060a006f78eedc3a26d05155 Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira Reviewed-by: Simon Hausmann --- tests/auto/corelib/thread/qthread/tst_qthread.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index 3230472d5b..d7294c3ee6 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -1082,8 +1082,8 @@ void tst_QThread::wait2() thread.start(); timer.start(); QVERIFY(!thread.wait(Waiting_Thread::WaitTime)); - qint64 elapsed = timer.elapsed(); // On Windows, we sometimes get (WaitTime - 1). - QVERIFY2(elapsed >= Waiting_Thread::WaitTime - 1, qPrintable(QString::fromLatin1("elapsed: %1").arg(elapsed))); + qint64 elapsed = timer.elapsed(); // On Windows, we sometimes get (WaitTime - 9). + QVERIFY2(elapsed >= Waiting_Thread::WaitTime - 10, qPrintable(QString::fromLatin1("elapsed: %1").arg(elapsed))); timer.start(); thread.cond1.wakeOne(); -- cgit v1.2.3 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(+) (limited to 'tests/auto/corelib') 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 From 3cd457bdad6eee4a703ef9773b80165a272fbdc7 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 21 Nov 2016 11:38:43 +0100 Subject: Handle RemovePath correctly when calling matches() Change-Id: Ied324a537df127e676fad26b42e658a9d5aeec9b Reviewed-by: David Faure --- tests/auto/corelib/io/qurl/tst_qurl.cpp | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 8f99047df3..670b72acc8 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -182,6 +182,8 @@ private slots: void streaming(); void detach(); void testThreading(); + void matches_data(); + void matches(); private: void testThreadingHelper(); @@ -4023,6 +4025,54 @@ void tst_QUrl::testThreading() delete s_urlStorage; } +void tst_QUrl::matches_data() +{ + QTest::addColumn("urlStrOne"); + QTest::addColumn("urlStrTwo"); + QTest::addColumn("options"); + QTest::addColumn("matches"); + + QTest::newRow("matchingString-none") << "http://www.website.com/directory/?#ref" + << "http://www.website.com/directory/?#ref" + << uint(QUrl::None) << true; + QTest::newRow("nonMatchingString-none") << "http://www.website.com/directory/?#ref" + << "http://www.nomatch.com/directory/?#ref" + << uint(QUrl::None) << false; + QTest::newRow("matchingHost-removePath") << "http://www.website.com/directory" + << "http://www.website.com/differentdir" + << uint(QUrl::RemovePath) << true; + QTest::newRow("nonMatchingHost-removePath") << "http://www.website.com/directory" + << "http://www.different.com/differentdir" + << uint(QUrl::RemovePath) << false; + QTest::newRow("matchingHost-removePathAuthority") << "http://user:pass@www.website.com/directory" + << "http://www.website.com/differentdir" + << uint(QUrl::RemovePath | QUrl::RemoveAuthority) + << true; + QTest::newRow("nonMatchingHost-removePathAuthority") << "http://user:pass@www.website.com/directory" + << "http://user:pass@www.different.com/differentdir" + << uint(QUrl::RemovePath | QUrl::RemoveAuthority) + << true; + QTest::newRow("matchingHostAuthority-removePathAuthority") + << "http://user:pass@www.website.com/directory" << "http://www.website.com/differentdir" + << uint(QUrl::RemovePath | QUrl::RemoveAuthority) << true; + QTest::newRow("nonMatchingAuthority-removePathAuthority") + << "http://user:pass@www.website.com/directory" + << "http://otheruser:otherpass@www.website.com/directory" + << uint(QUrl::RemovePath | QUrl::RemoveAuthority) << true; +} + +void tst_QUrl::matches() +{ + QFETCH(QString, urlStrOne); + QFETCH(QString, urlStrTwo); + QFETCH(uint, options); + QFETCH(bool, matches); + + QUrl urlOne(urlStrOne); + QUrl urlTwo(urlStrTwo); + QCOMPARE(urlOne.matches(urlTwo, QUrl::FormattingOptions(options)), matches); +} + QTEST_MAIN(tst_QUrl) #include "tst_qurl.moc" -- cgit v1.2.3