summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel/qdeadlinetimer
Commit message (Collapse)AuthorAgeFilesLines
* QDeadlineTimer: use new comparison helper macrosTatiana Borisova2024-04-182-0/+32
| | | | | | | | | | | Replace public friend operators operator==() and operator!=() of QDeadlineTimer to friend method comparesEqual(). Replace public friends operator<(),<=(),>(), etc of QDeadlineTimer to friend method compareThreeWay(). Task-number: QTBUG-120304 Change-Id: Ib855ccac9b31b54fe28b822f2985154608fefa27 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Change license for tests filesLucie Gérard2024-02-041-1/+1
| | | | | | | | | | | | According to QUIP-18 [1], all tests file should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* CMake: Make corelib tests standalone projectsAlexandru Croitor2023-07-051-0/+6
| | | | | | | | | | | | | | | | | | Add the boilerplate standalone test prelude to each test, so that they can be opened with an IDE without the qt-cmake-standalone-test script, but directly with qt-cmake or cmake. Boilerplate was added using the following scripts: https://git.qt.io/alcroito/cmake_refactor Manual adjustments were made where the code was inserted in the wrong location. Task-number: QTBUG-93020 Change-Id: I28b6d3815c5f43d2c33ea65764f6f3f8f129eaf3 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDeadlineTimer: make it so any negative millisecond count is "forever"Thiago Macieira2023-05-111-4/+26
| | | | | | | | | | | | | | We have quite a few Qt API that assumes this, so making this change helps transitioning them to QDeadlineTimer. [ChangeLog][Important Behavior Changes] QDeadlineTimer will now interpret negative millisecond remaining times as "forever", instead of only the value -1. This brings the API closer in line with other API like QMutex. This change does not apply to the nanosecond counts in the API, nor to the API based on std::chrono. Change-Id: I6f518d59e63249ddbf43fffd175a3e5bead564ae Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QDeadlineTimer: remove the testing of the different timer typesThiago Macieira2023-05-111-36/+13
| | | | | | | | | | Commit b498e1ae3a3c6f188952f02a5ba14d092fbd168b removed the last distinction. And since there was no distinction, the code that was previously under a conditional for CoarseTimer must work for precise too. Change-Id: I6f518d59e63249ddbf43fffd175a3eddbd41611a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Move the formatting of <chrono> durations to QDebug & QtTestThiago Macieira2023-05-061-46/+0
| | | | | | | | | | | | [ChangeLog][QtCore][QDebug] Added pretty formatting of C++ <chrono> durations. [ChangeLog][QtTest] Added pretty formatting of C++ <chrono> durations for QCOMPARE expressions. Change-Id: I3b169860d8bd41e9be6bfffd1757cc087ba957fa Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QDeadlineTimer: remove internal TimeReference classThiago Macieira2023-04-181-1/+1
| | | | | | | | | This removes all uses of QDeadlineTimer::t2 member in the .cpp (so it gets marked [[maybe_unused]]) and greatly simplifies the code. Change-Id: Ieec322d73c1e40ad95c8fffd17465bd50c1113ea Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QDeadlineTimer: use if constexpr instead of function specializationsThiago Macieira2023-04-181-0/+8
| | | | | | | | | | | You can't partially specialize a template function, so these specializations for steady_clock only worked if the Duration parameter was nanoseconds. This could have been solved with function overloads instead, but I find the if constexpr code simpler to read. Pick-to: 6.5 Change-Id: Ieec322d73c1e40ad95c8fffd17468bd73fc2fe24 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QDeadlineTimer: use std::chrono::steady_clock everywhereThiago Macieira2023-04-181-6/+4
| | | | | | | | | | | | | | | This matches the work that was done for QElapsedTimer. The QDeadlineTimer::t2 member is now always 0. This also removes the last distinction of timer types. Originally I had intended to use CLOCK_MONOTONIC_COARSE on Linux[1], but that created more problems than was worth, so I abandoned the idea in 2016. [1] https://codereview.qt-project.org/c/qt/qtbase/+/159933 Change-Id: Ieec322d73c1e40ad95c8fffd17468b313798ef79 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* tst_QDeadlineTimer: use std::chrono_literalsThiago Macieira2023-04-181-47/+48
| | | | | | | | | For greater readability. Pick-to: 6.5 Change-Id: Ieec322d73c1e40ad95c8fffd17468e0c737bec0e Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_QDeadlineTimer: use the new QCOMPARE_xx() macrosThiago Macieira2023-04-181-164/+216
| | | | | | | Pick-to: 6.5 Change-Id: Ieec322d73c1e40ad95c8fffd17468cb805546aea Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tests: Remove remains of qmake conversion from CMakeLists.txt filesFriedemann Kleint2023-02-171-2/+0
| | | | | | | Pick-to: 6.5 Change-Id: I8d106554bb86ac1ec9bb7a4083de4c376bcbab1d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Remove preprocessor conditionals for chrono includeKonrad Kujawa2022-09-161-7/+1
| | | | | | | | | __has_include(<chrono>) is always true, because C++11 chrono include is required since 6.0. Pick-to: 6.4 6.3 6.2 Change-Id: I50cb92571bf4f1f86e2f3f2b5f486dd3c3f30f4a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-231-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-031-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-27/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-071-5/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Replace QtTest headers with QTestDavid Skoland2020-12-221-1/+2
| | | | | | | | | | | Complete search and replace of QtTest and QtTest/QtTest with QTest, as QtTest includes the whole module. Replace all such instances with correct header includes. See Jira task for more discussion. Fixes: QTBUG-88831 Change-Id: I981cfae18a1cabcabcabee376016b086d9d01f44 Pick-to: 6.0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Blacklist tst_QDeadlineTimer::stdchrono on Windows/clangFriedemann Kleint2020-12-211-0/+2
| | | | | | | | It has been failing consistently, recently. Pick-to: 6.0 Change-Id: I71b2e8857c3d5ce86ad17864c95aac7265ed9a8a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QDeadlineTimer: optimize when std::chrono::steady_clock is the sameThiago Macieira2020-12-091-0/+12
| | | | | | Change-Id: Ib57b52598e2f452985e9fffd14583173716343b0 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix tst_QDeadlineTimer::stdchrono() flaky testJarek Kobus2020-10-271-52/+32
| | | | | | | | | | | | | | | | This patch reverts the last attempt to fix it: 4a1de178c9cc891560f38d64d89074799b0fa0e1. In addition, instead of using imprecise QTest::qSleep() we trigger a single shot PreciseTimer twice and gather the measurements in lambdas. We wait for lambdas to be executed - we give it twice as much time as is in theory needed. Afterwards we verify all the data collected in lambdas. Fixes: QTBUG-82825 Change-Id: Ib691f5f23a92fb8b41a24f7b603981d9c9450ddc Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-231-1/+1
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Regenerate tests with new qt_ prefixed APIsAlexandru Croitor2020-07-091-1/+1
| | | | | | | | Use pro2cmake with '--api-version 2' to force regenerate projects to use the new prefixed qt_foo APIs. Change-Id: I055c4837860319e93aaa6b09d646dda4fc2a4069 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devLars Knoll2020-03-041-16/+34
|\ | | | | | | Change-Id: I99ee6f8b4bdc372437ee60d1feab931487fe55c4
| * Try again to make QDeadlineTimer test robust against context switchesVolker Hilsheimer2020-02-281-16/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of comparing to absolute values, compare the result from QDeadlineTimer with the reference clock types from std::chrono. Pass the test as long as we are within 10% of that reference. In addition, handle the case where QTest::qSleep sleeps for more than 10% longer or shorter than what is requested, and if so, abort the test. Change-Id: If8b77aea55a8c5c53e96427b2fff2f78281d0f82 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devLars Knoll2020-02-281-4/+19
|\| | | | | | | Change-Id: I469b0501cc65fc5ce4d797a69ae89405cc69c7f8
| * Make QDeadlineTimer test more resilient against VM starvationVolker Hilsheimer2020-02-261-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Flaky fails in this test suggest that the VM on which the test is executed does not get CPU resources allocated for enough time to make this test pass. This change makes the test more resilient by taking the measurements as quickly as possible. In addition, use a sanity-check based on std::chrono APIs to abort the test completely if we see that the clock has advanced too far to make the following tests meaningful. Change-Id: Ie6ac4ffb52f20e7774014f8222c9cd8f54d8a263 Fixes: QTBUG-64517 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/dev' into merge-devLeander Beernaert2020-01-241-2/+2
|\| | | | | | | Change-Id: I31b761cfd5ea01373c60d02a5da8c33398d34739
| * Don't wrap feature detection macros with QT_HAS_FOO() variantsTor Arne Vestbø2019-12-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using wrappers for these macros is problematic when for example passing the -frewrite-includes flag to preprocess sources before shipping off to distcc or Icecream. It will also start producing warnings when compilers implement http://eel.is/c++draft/cpp.cond#7.sentence-2. See for example https://reviews.llvm.org/D49091 Both https://clang.llvm.org/docs/LanguageExtensions.html and the SD-6 document at https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations recommend defining '__has_foo(x) 0' as a fallback for compilers without the macros, so that's what we go for. Change-Id: I0298cd3b4a6ff6618821e34642a5ddd6728be767 Reviewed-by: Alex Richardson <arichardson.kde@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Regenerate tests/auto/corelib/kernelAlexandru Croitor2019-11-121-3/+0
| | | | | | | | | | | | | | Change-Id: I466387408d26854e11fde0a1fbef74c2fad764c7 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* | Implement SUBDIR-= conversion in pro2cmake toolJędrzej Nowacki2019-08-011-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CMake doesn't support removing subdirectories therefore one need to convert all removal to conditional adds. The resulting code doesn't win a beauty contest. That is because handle_subdir works on already processed strings which means it doesn't have access to the boolean operations. As such it can not minimize the expressions, but it works and in the most simple cases it is pretty good. The patch re-generates CMakeLists.txt under tests/auto/corelib/kernel excluding qcoreapplication, qmetatype, qmimedata, qobject, qtimer, which are suffering from unrelated problems, like for example Gui, pthread linkage issues. Change-Id: I18a02f6eda7a3b41b1313211c8bc9ce277bb67be Reviewed-by: Qt CMake Build Bot Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2019-06-031-0/+79
|\| | | | | | | | | | | Take 5. Change-Id: Ifb2d20e95ba824e45e667fba6c2ba45389991cc3
| * Fix integer overflows in QDeadlineTimerKonstantin Shegunov2019-05-081-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If the deadline is far in the future, the conversions to nanoseconds or internal arithmetic may overflow and give an invalid object, thus the deadline may end up in the past. Added a test to the testlib selftest for sleep. [ChangeLog][QtCore][QDeadlineTimer] Fixed integer overflows leading to immediate timeouts. Task-number: QTBUG-69750 Change-Id: I9814eccdf9f9b3add9ca66ec3e27e10cd5ad54a8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Begin port of qtbase to CMakeSimon Hausmann2018-11-011-0/+1
|/ | | | | | | | | | | | | | | Done-by: Alexandru Croitor <alexandru.croitor@qt.io> Done-by: Frederik Gladhorn <frederik.gladhorn@qt.io> Done-by: Kevin Funk <kevin.funk@kdab.com> Done-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Done-by: Simon Hausmann <simon.hausmann@qt.io> Done-by: Tobias Hunger <tobias.hunger@qt.io> Done-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Done-by: Volker Krause <volker.krause@kdab.com> Change-Id: Ida4f8bd190f9a4849a1af7b5b7981337a5df5310 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
* Increase the resolution for QDeadlineTimer unit testThiago Macieira2016-10-261-1/+1
| | | | | | | | | | Apparently, the CI can run something over 1000x slower than on my machine. We're getting over 100 ms delays in operations that shouldn't have taken more than half a millisecond. The last report was of 136% over budget, so I multiplied the resolution by 4. Change-Id: I9093948278414644a416fffd1474406967b2a6ee Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Long live QDeadlineTimerThiago Macieira2016-08-152-0/+630
It's like QElapsedTimer, but marks a time in the future instead. [ChangeLog][QtCore] Added QDeadlineTimer, a counterpart to QElapsedTimer, used to mark a time point in the future (a deadline) and determine whether such a deadline has passed. Change-Id: Ifea6e497f11a461db432ffff144921f7fbc1d1d3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>