mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 13:42:10 +02:00
Adds a functional test that starts bitcoin-gui (via the bitcoin wrapper
with "gui" subcommand) using QT_QPA_PLATFORM=minimal for headless
operation, then verifies it responds to a stop RPC call. This catches
startup regressions in the GUI that have no CI coverage today.
Extends the test framework to support use_gui=True in TestNode, which
invokes "bitcoin gui" instead of "bitcoin node" and automatically sets
QT_QPA_PLATFORM=minimal. Adds BUILD_GUI to test/config.ini.in and
is_gui_compiled()/skip_if_no_gui() helpers to BitcoinTestFramework.
Co-Authored-By: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
41 lines
1.3 KiB
Python
Executable File
41 lines
1.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) The Bitcoin Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
"""Test that bitcoin-gui starts up and can be stopped via RPC."""
|
|
|
|
import platform
|
|
|
|
from test_framework.test_framework import (
|
|
BitcoinTestFramework,
|
|
SkipTest,
|
|
)
|
|
|
|
|
|
class GuiTest(BitcoinTestFramework):
|
|
def set_test_params(self):
|
|
self.num_nodes = 1
|
|
self.extra_args = [["-server"]]
|
|
|
|
def skip_test_if_missing_module(self):
|
|
self.skip_if_no_gui()
|
|
# On Windows, bitcoin.exe exits immediately when launching bitcoin-gui.exe,
|
|
# causing the test framework's process monitor to see a premature node exit.
|
|
# On macOS, bitcoin-qt's Cocoa code assumes NSApp is initialized, but the
|
|
# minimal Qt platform plugin skips that, causing crashes.
|
|
# Both issues are likely fixable.
|
|
if platform.system() in ("Windows", "Darwin"):
|
|
raise SkipTest("bitcoin-gui test not supported on Windows or macOS")
|
|
|
|
def setup_nodes(self):
|
|
self.extra_init = [{"use_gui": True}]
|
|
super().setup_nodes()
|
|
|
|
def run_test(self):
|
|
self.log.info("Test that bitcoin-gui starts up and can be stopped via RPC")
|
|
self.stop_node(0)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
GuiTest(__file__).main()
|