thread #36105 (review):
Thanks for the generous attribution.
Commit ac15f5654aec8ae96fc814cbab331c580f790250 "test: Enable tool_bitcoin.py and interface_gui.py tests on Windows" happens to be the commit I feel is still I don't fully grasp, but it's more what it's referencing than what it's doing.
What it's doing in the scope of interface_gui.py - instead of avoiding to run at all on Windows, only skip when the build is a vcpkg build. It references src/qt/test/CMakeLists.txt but that file is not immediately understandable to me.
From looking at https://qt.developpez.com/doc/6.4/qguiapplication/#platformName-prop I think this is how I would make it more understandable:
--- a/src/qt/test/CMakeLists.txt
+++ b/src/qt/test/CMakeLists.txt
@@ -40,12 +40,14 @@ add_test(NAME test_bitcoin-qt
COMMAND test_bitcoin-qt
)
if(WIN32 AND VCPKG_TARGET_TRIPLET)
set(plugin_path "$<SHELL_PATH:$<PATH:GET_PARENT_PATH,$<PATH:GET_PARENT_PATH,$<TARGET_PROPERTY:Qt6::QWindowsIntegrationPlugin,LOCATION_$<CONFIG>>>>>")
set_property(TEST test_bitcoin-qt APPEND PROPERTY
ENVIRONMENT_MODIFICATION
# On Windows, vcpkg configures Qt with `-opengl dynamic`, which makes
- # the "minimal" platform plugin unusable due to internal Qt bugs.
+ # the otherwise appropriate headless "minimal" platform plugin unusable
+ # due to internal Qt bugs. So override to "windows" plugin in order to
+ # make it work when built in that configuration (VCPKG_TARGET_TRIPLET).
QT_QPA_PLATFORM=set:windows
QT_PLUGIN_PATH=set:${plugin_path}
)
unset(plugin_path)
My impression is that src/qt/test/CMakeLists.txt is supposed to make test_bitcoin-qt actually work, even when built with vcpkg.
So why would you be changing the functional test to skip something which should be working?
Well, when I build and run .\build\bin\Release\test_bitcoin-qt.exe I get:
qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Setting it to "minimal" has the same result.
I tried printing the plugin path through adding this before the variable is unset:
message("QT_PLUGIN_PATH=${plugin_path} (plugin_path)")
and it prints:
QT_PLUGIN_PATH=$<SHELL_PATH:$<PATH:GET_PARENT_PATH,$<PATH:GET_PARENT_PATH,$<TARGET_PROPERTY:Qt6::QWindowsIntegrationPlugin,LOCATION_$<CONFIG>>>>> (plugin_path)
Manually setting:
set QT_PLUGIN_PATH=C:\Users\hodlinator\bitcoin\build\vcpkg_installed\x64-windows\Qt6\plugins
makes .\build\bin\Release\test_bitcoin-qt.exe run fine, both with minimal and windows plugins!
So I wonder if the setting of QT_PLUGIN_PATH in CMakeLists.txt is somehow broken? I'm on CMake 4.4.2.
Having the QT_PLUGIN_PATH set correctly also makes interface_gui.py run fine when modified to not skip!