From a17aaed1cd99d4a00912e4a1c631d49f2c7c3cc4 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 6 May 2014 12:27:56 +0200 Subject: 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 --- src/testlib/qtestcase.cpp | 16 ---------------- 1 file changed, 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 -- cgit v1.2.3