Skip to content

qt, test: Run GUI tests on macOS with minimal QPA plugin - #950

Merged
hebasto merged 2 commits into
bitcoin-core:masterfrom
hebasto:260720-macos-minimal
Jul 20, 2026
Merged

qt, test: Run GUI tests on macOS with minimal QPA plugin#950
hebasto merged 2 commits into
bitcoin-core:masterfrom
hebasto:260720-macos-minimal

Conversation

@hebasto

@hebasto hebasto commented Jul 20, 2026

Copy link
Copy Markdown
Member

On macOS, test_bitcoin-qt has skipped AppTests, WalletTests, and AddressBookTests under the minimal QPA 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.

hebasto added 2 commits July 20, 2026 15:00
`[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.
@DrahtBot

DrahtBot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK maflcko, pablomartin4btc

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

@maflcko

maflcko commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

lgtm ACK fd59d68

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@hebasto

hebasto commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

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 driver, you can use the --verbose option:

ctest --test-dir build_dev_mode -R bitcoin-qt --verbose

@hebasto
hebasto merged commit 4906594 into bitcoin-core:master Jul 20, 2026
29 checks passed
@fanquake

Copy link
Copy Markdown
Member

After this change the tests segfault if you build using depends: bitcoin/bitcoin#35771.

@maflcko

maflcko commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Fixed in #951

Kino1994 pushed a commit to Kino1994/bitcoin-full-history that referenced this pull request Jul 26, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants