Skip to content

Conversation

@hebasto
Copy link
Owner

@hebasto hebasto commented Feb 11, 2024

A new configuration option is BUILD_GUI_TESTS.


Native Windows / MSVC Notes:

  1. vcpkg configures Qt with -opengl dynamic, which makes the "minimal" platform plugin unusable due to internal Qt bugs.
  2. ctest workarounds this issue by setting the environment variable QT_QPA_PLATFORM=windows.
  3. This approach works nice in the CI for both x64-windows and x64-windows-static triplets. Please note that test_bitcoin-qt.exe fails to run in the CI environment on the master branch.
  4. One who is willing to debug Qt with the "minimal" platform plugin could run the test_bitcoin-qt.exe directly (not driven by ctest).

@hebasto hebasto added the enhancement New feature or request label Feb 11, 2024
@hebasto hebasto force-pushed the 240211-cmake-BP branch 2 times, most recently from 3c071c2 to 197fcce Compare February 11, 2024 17:37
@hebasto hebasto marked this pull request as draft February 11, 2024 18:29
@hebasto hebasto marked this pull request as ready for review February 11, 2024 19:32
Copy link

@theuni theuni left a comment

Choose a reason for hiding this comment

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

I noticed while poking around that cmake adds:
CMakeFiles/test_bitcoin-qt.dir/__/__/__/depends/x86_64-pc-linux-gnu/lib/cmake/Qt5Gui/Qt5Gui_QXcbIntegrationPlugin_Import.cpp.o

The contents of Qt5Gui_QXcbIntegrationPlugin_Import.cpp are:

#include <QtPlugin>
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)

So I think we're doing that twice?

It seems we should either turn that off somehow, or remove the import from our code?

- name: Test Release configuration
run: |
ctest --test-dir build -j $env:NUMBER_OF_PROCESSORS -C Release
ctest --test-dir build -j $env:NUMBER_OF_PROCESSORS -C Release --exclude-regex test_bitcoin-qt
Copy link

Choose a reason for hiding this comment

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

Why? Because it requires a gui? Could you please add a comment?

Copy link
Owner Author

Choose a reason for hiding this comment

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

A "TODO" comment with links to the issues has been added.

@hebasto
Copy link
Owner Author

hebasto commented Feb 24, 2024

I noticed while poking around that cmake adds: CMakeFiles/test_bitcoin-qt.dir/__/__/__/depends/x86_64-pc-linux-gnu/lib/cmake/Qt5Gui/Qt5Gui_QXcbIntegrationPlugin_Import.cpp.o

The contents of Qt5Gui_QXcbIntegrationPlugin_Import.cpp are:

#include <QtPlugin>
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)

So I think we're doing that twice?

It seems we should either turn that off somehow, or remove the import from our code?

Nice catch! It happens on the staging branch as well. Investigating...

@hebasto
Copy link
Owner Author

hebasto commented Feb 25, 2024

I noticed while poking around that cmake adds: CMakeFiles/test_bitcoin-qt.dir/__/__/__/depends/x86_64-pc-linux-gnu/lib/cmake/Qt5Gui/Qt5Gui_QXcbIntegrationPlugin_Import.cpp.o

The contents of Qt5Gui_QXcbIntegrationPlugin_Import.cpp are:

#include <QtPlugin>
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)

So I think we're doing that twice?

It seems we should either turn that off somehow, or remove the import from our code?

@theuni

Thank you for this insight! Please consider #103.

This PR has been rebased on #103 and drafted for now.

@hebasto hebasto marked this pull request as draft February 25, 2024 10:10
@hebasto
Copy link
Owner Author

hebasto commented Mar 4, 2024

On Windows, the statically linked test_bitcoin.exe crashes with the minimal platform plugin, which is used by default.

Specifically, WalletTests and AddressBookTests fail due to an unhandled exception in the QMessageBox class.

This behavior differs from our custom static Qt build in the master branch, which does not crash :)

I believe that the root of the difference in behaviour lies in the following Qt configuration options:

There are two obvious workarounds for this unfortunate issue:

  1. Keep using our custom static Qt build for statically linked executables.
  2. Disable WalletTests and AddressBookTests for the minimal platform plugin as we do on macOS.

Thought?

cc @sipsorcery

@sipsorcery
Copy link

+1 to disable the tests for the dynamically linked version.

Reasoning being that the Windows build is for "developers only" and tracking down Qt bugs for a non-production build doesn't seem to offer a good effort to reward tradeoff.

Copy link

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

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

tACK cb1a44f

Tested on Ubuntu 22.04.

...
Tests:
  test_bitcoin ........................ ON
  test_bitcoin-qt ..................... ON
...

./build/src/qt/test/test_bitcoin-qt

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
********* Start testing of AppTests *********
Config: Using QtTest library 5.15.3, Qt 5.15.3 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 11.3.0), ubuntu 22.04
...

All tests passed.

~InitExecutor : Stopping thread
~InitExecutor : Stopped thread

@hebasto
Copy link
Owner Author

hebasto commented Mar 5, 2024

#101 (comment):

Why? Because it requires a gui? Could you please add a comment?

A "TODO" comment with links to the issues has been added.

The mentioned issues have been fixed in bitcoin-core/gui#803. Please review it as well :)

@hebasto hebasto marked this pull request as ready for review March 8, 2024 15:39
@hebasto
Copy link
Owner Author

hebasto commented Mar 9, 2024

Reworked. Rebased. Ready for review.

The PR description has been updated with Windows/MSVC specific notes.

Friendly ping @TheCharlatan @m3dwards @pablomartin4btc @vasild; and @sipsorcery (as a Windows expert) :)

@sipsorcery
Copy link

With a dynamic linked build on Windows I get:

PS C:\dev\github\hebasto-bitcoin\build> ctest -j $env:NUMBER_OF_PROCESSORS -C Release
...
...
99% tests passed, 1 tests failed out of 129

Total Test time (real) = 504.59 sec

The following tests FAILED:
         35 - fs_tests:fs_tests.cpp (Failed)
Errors while running CTest
Output from these tests are in: C:/dev/github/hebasto-bitcoin/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.

@hebasto
Copy link
Owner Author

hebasto commented Mar 9, 2024

With a dynamic linked build on Windows I get:

PS C:\dev\github\hebasto-bitcoin\build> ctest -j $env:NUMBER_OF_PROCESSORS -C Release
...
...
99% tests passed, 1 tests failed out of 129

Total Test time (real) = 504.59 sec

The following tests FAILED:
         35 - fs_tests:fs_tests.cpp (Failed)
Errors while running CTest
Output from these tests are in: C:/dev/github/hebasto-bitcoin/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.

Yes. That happens when a user has no privilege to create symbolic links. This issue is not specific to this PR change. However, it should be fixed.

@sipsorcery
Copy link

tACK 4da7634.

Copy link

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

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

re tACK e4b4c98

On Ubuntu 22.04.

./build/src/qt/test/test_bitcoin-qt

...

All tests passed.
...

ctest -j $(nproc)

...

100% tests passed, 0 tests failed out of 128

Total Test time (real) =  22.90 sec

Copy link

@pablomartin4btc pablomartin4btc left a comment

Choose a reason for hiding this comment

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

re tACK e4b4c98

Tested cross-building for Windows on WSL Ubuntu 22.04.

All tests passed. (running test_bitcoin-qt.exe successfully in both WSL and Windows 11 Pro)

@hebasto hebasto merged commit 83374fd into cmake-staging Mar 13, 2024
hebasto added a commit that referenced this pull request Mar 13, 2024
593b130 cmake: Add `libqrencode` optional package support (Hennadii Stepanov)

Pull request description:

  A new configuration option `WITH_QRENCODE` has been added.

  This PR, along with #101, concludes the GUI-specific part of the new CMake-based build system.

ACKs for top commit:
  pablomartin4btc:
    tACK 593b130

Tree-SHA512: ba21d65ccff59e29585bd6ce092216034abcbd9866e5452fe6a1b1e2f0957dc3c48a204c170ce443888852ae165be7cb1846483b031b8cf49e6d986dec722f88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants