diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index e5f4bd67927..64a3687e2a4 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -2635,6 +2635,9 @@ static void unixPipe_helper(int pipes[2]) c = 2; qt_safe_write(fd, &c, 1); })); + + QElapsedTimer timer; + timer.start(); thr->start(); // synchronize with the thread having started @@ -2643,8 +2646,6 @@ static void unixPipe_helper(int pipes[2]) QCOMPARE(c, '\1'); QFETCH(bool, useStdio); - QElapsedTimer timer; - timer.start(); QFile f; if (useStdio) { FILE *fh = fdopen(pipes[0], "rb"); @@ -2658,8 +2659,8 @@ static void unixPipe_helper(int pipes[2]) c = 0; QCOMPARE(f.read(&c, 1), 1); QCOMPARE(c, '\2'); - int elapsed = timer.elapsed(); - QVERIFY2(elapsed >= Timeout, QByteArray::number(elapsed)); + const int elapsed = timer.elapsed(); + QCOMPARE_GE(elapsed, Timeout); thr->wait(); }