-
-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor tests and benchmarks #4700
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and use ctest
It doesn't actually use ctest
- but it could: ctest -j$(nproc) --output-on-failure
(optionally with -T test
).
This test was really flaky for me - it probably depends a lot on the scheduling and the system this is running on.
This reverts commit 86dc1f4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
Description
This PR makes a few changes:
Tests and benchmarks run on the main thread
qWaitFor
which keeps the event-loop spinning. Since this is actually declared in QtCore, no dependency to the Test component is necessary.Running benchmarks/tests related to emojis would segfault (at least for me with MSVC), because the
ImageExpirationPool
would be destroyed before theImage
fromgetEmpty
(the destructor callsremoveImagePtr
).The fix for this is a bit more involved, as it's not trivial to control the order of destruction of static inside functions, so the statics are moved inside an anonymous namespace.
Creating a
ImageExpirationPool
when starting up will cause thefreeTimer_
to not work, as the main thread isn't running yet. That's why it's created lazily.For the emoji tests/benchmarks, this will cause
QObject::startTimer: Timers can only be used with threads started with QThread
to be printed after they're finished, because that's the first time theImageExpirationPool
is accessed (when destroying the empty image). This can be fixed by e.g. callingImageExpirationPool::instance()
somewhere before/during the tests/benchmarks, but it's not really an issue here, since we're about to destroy the pool regardless (thus the timer would've never fired).The tests for filters failed on Qt 6 (filters are probably not fully working in Qt 6, so this could be a separate PR).https://httpbin.org was really slow for me at times, and sometimes it even timed out. I found https://postman-echo.com, which has the same API except for the special 402 status response.
Now the following is possible:
ctest
.