diff options
-rw-r--r-- | tests/auto/api/tst_api.cpp | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp index b47d3b5c8..1a98f5f21 100644 --- a/tests/auto/api/tst_api.cpp +++ b/tests/auto/api/tst_api.cpp @@ -2833,7 +2833,6 @@ void TestApi::targetArtifactStatus() void TestApi::timeout() { QFETCH(QString, projectDirName); - QFETCH(qint64, expectedMaxRunTime); const auto setupParams = defaultSetupParameters(projectDirName + "/timeout.qbs"); std::unique_ptr<qbs::SetupProjectJob> setupJob{ qbs::Project().setupProject(setupParams, m_logSink, nullptr)}; @@ -2857,40 +2856,20 @@ void TestApi::timeout() QFAIL("Could not build helper products"); } - QElapsedTimer timer; - timer.start(); const std::unique_ptr<qbs::BuildJob> buildJob(project.buildOneProduct(productUnderTest, qbs::BuildOptions())); - const auto testAbortTimeout = 20 * 1000ll; - /* We add an additional buffer to the expectedMaxRunTime because Qbs can take some - * time (>1 second) to finish after the command has been cancelled. - */ - expectedMaxRunTime += 4 * 1000ll; - Q_ASSERT_X(testAbortTimeout > expectedMaxRunTime, - Q_FUNC_INFO, - "testAbortTimeout must be larger than the expectedMaxRunTime. Else the " - "test might be cancelled to early although the code is working correctly."); - QTimer::singleShot(testAbortTimeout, buildJob.get(), &qbs::AbstractJob::cancel); QVERIFY(waitForFinished(buildJob.get(), testTimeoutInMsecs())); - const auto actualRunTime = timer.elapsed(); QVERIFY(buildJob->error().hasError()); const auto errorString = buildJob->error().toString(); QVERIFY(errorString.contains("cancel")); QVERIFY(errorString.contains("timeout")); - if (actualRunTime > expectedMaxRunTime) - qDebug() << actualRunTime << "vs." << expectedMaxRunTime; - QVERIFY(actualRunTime < expectedMaxRunTime); } void TestApi::timeout_data() { QTest::addColumn<QString>("projectDirName"); - QTest::addColumn<qint64>("expectedMaxRunTime"); - QTest::newRow("JS Command") << QString("timeout-js") << 3 * 1000ll; - /* The timeout is 3 seconds. Qbs will try to terminate the process for 3 seconds and then kill - * it. - */ - QTest::newRow("Process Command") << QString("timeout-process") << (3 + 3) * 1000ll; + QTest::newRow("JS Command") << QString("timeout-js"); + QTest::newRow("Process Command") << QString("timeout-process"); } void TestApi::toolInModule() |