diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-05-06 12:27:56 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-06 16:35:56 +0200 |
commit | a17aaed1cd99d4a00912e4a1c631d49f2c7c3cc4 (patch) | |
tree | b43f9c8c6e87e8e280e731a80063bffa7b358126 /src/testlib/qtestcase.cpp | |
parent | f0579fa68e620ced2bc32c6549d2e45cdf8c7c97 (diff) |
Remove warnings about sleep times from QTest::qSleep()
The collected data doesn't reveal any obvious correlation between sleep
times and test failures but the many warnings are a hassle for anyone
reading the test results.
Change-Id: I71bd0c90c20c730573693f23f4435e538b635d44
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r-- | src/testlib/qtestcase.cpp | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index cbf479f1d2..cc58b51743 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -2863,8 +2863,6 @@ bool QTest::currentTestFailed() void QTest::qSleep(int ms) { QTEST_ASSERT(ms > 0); - QElapsedTimer timer; - timer.start(); #if defined(Q_OS_WINRT) WaitForSingleObjectEx(GetCurrentThread(), ms, true); @@ -2874,20 +2872,6 @@ void QTest::qSleep(int ms) struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 }; nanosleep(&ts, NULL); #endif - // Warn if the elapsed time was more than 50% longer or more than 10% shorter than the - // requested time. - qint64 requested = 1000000 * (qint64)ms; - qint64 diff = timer.nsecsElapsed() - requested; -#ifndef Q_OS_WIN - const qint64 factor = 2; // more than 50% longer -#else - const qint64 factor = 1; // Windows: 50% is quite common, warn about 100% -#endif - if (diff * factor > requested || diff * 10 < -requested) { - QTestLog::warn(qPrintable( - QString::fromLatin1("QTest::qSleep() should have taken %1ns, but actually took %2ns!") - .arg(requested).arg(diff + requested)), __FILE__, __LINE__); - } } /*! \internal |