Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-39797

QTestLib clutters test output with warnings about qSleep taking too long

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.3.0
    • Fix Version/s: 5.3.1
    • Component/s: Testing: qtestlib
    • Labels:
      None
    • Environment:
      Qt 5.3.0, GCC, X11 (Linux Mint 14)
    • Commits:
      a17aaed1cd99d4a00912e4a1c631d49f2c7c3cc4

      Description

      When running my tests in Qt 5.3.0, the output is cluttered with warnings about qSleep taking longer than expected:

      WARNING: MyTestClass::myTestFunction() QTest::qSleep() should have taken 10000000ns, but actually took 16281196ns!
      Loc: [qtestcase.cpp(2889)]

      qSleep is never used in my tests, but probably internally in Qt code.

      This warning feature that's a bit misbehaving here was introduced by Ulf in the following commit:
      https://codereview.qt-project.org/#/c/80695/

      I fully understand the reasoning behind having such a warning message, but on some systems (e.g. mine), qSleep taking longer than expected seems to be the normal case rather than the exception. This renders the warnings useless or even harmful. I now need to send the test output through grep to filter all the warnings out and see what's actually important.

      An improved implementation might be to let the user of qtestlib decide which threshold he gives qSleep before warnings are printed. Or just a switch to turn this warning off entirely.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            ulherman Ulf Hermann
            Reporter:
            dermanu Emanuel Eichhammer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes