qt, test: Run GUI tests on macOS with minimal QPA plugin - #950
Conversation
`[NSApplication sharedApplication]` creates the shared application object if it does not yet exist. When running with the `minimal` or `offscreen` QPA plugins, which is common for testing purposes, the Cocoa platform plugin never creates it, so these call sites were instantiating `NSApplication` as a side effect. Use the `NSApp` global instead and return early when it is `nil`.
The crash source, implicit `NSApplication` instantiation with a non-Cocoa QPA plugin, was fixed in the previous commit.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste |
|
lgtm ACK fd59d68 |
pablomartin4btc
left a comment
There was a problem hiding this comment.
tACK fd59d68
I recently ran into this when writing tests for addressbooktests.cpp in #945 — they had to be run on Linux because they were skipped on macOS.
Tested locally — AppTests, WalletTests, and AddressBookTests now run with QT_QPA_PLATFORM=minimal on macOS.
From the macOS native CI logs, test_bitcoin-qt runs and passes but it's unclear whether those three test classes were previously being skipped or actually executing.
For the tests run by the ctest --test-dir build_dev_mode -R bitcoin-qt --verbose |
|
After this change the tests segfault if you build using depends: bitcoin/bitcoin#35771. |
|
Fixed in #951 |
…nimal` QPA plugin 7fdb6d5 qt, test: Enable tests on macOS with `minimal` QPA plugin (Hennadii Stepanov) 963df5e qt: Avoid implicit `NSApplication` instantiation (Hennadii Stepanov) Pull request description: On macOS, `test_bitcoin-qt` has skipped `AppTests`, `WalletTests`, and `AddressBookTests` under the `minimal` QPA plugin since bitcoin/bitcoin@30d480e (2018, Qt 5.11), pointing to [QTBUG-49686](https://qt-project.atlassian.net/browse/QTBUG-49686). The recent re-evaluation of the Bitcoin Core codebase showed that the Qt bug report is no longer relevant. The remaining causes were in our own code, and they are fixed in the first commit. ACKs for top commit: maflcko: lgtm ACK 7fdb6d5 pablomartin4btc: tACK 7fdb6d5 Tree-SHA512: 9fae09668cffe8b207736c6a202af01666a06ae1a8adbd3061717b92a692c0b65b6fe853f192cdc8793073b1c02c3f6a61350a5974397ac016ff8924a51e084a
On macOS,
test_bitcoin-qthas skippedAppTests,WalletTests, andAddressBookTestsunder theminimalQPA plugin since bitcoin/bitcoin@a3197c5 (2018, Qt 5.11), pointing to QTBUG-49686.The recent re-evaluation of the Bitcoin Core codebase showed that the Qt bug report is no longer relevant. The remaining causes were in our own code, and they are fixed in the first commit.