File tree Expand file tree Collapse file tree 3 files changed +66
-0
lines changed Expand file tree Collapse file tree 3 files changed +66
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ if(WITH_QRENCODE)
152
152
endif ()
153
153
154
154
cmake_dependent_option (WITH_DBUS "Enable DBus support." ON "CMAKE_SYSTEM_NAME STREQUAL \" Linux\" AND BUILD_GUI" OFF )
155
+ cmake_dependent_option (BUILD_GUI_TESTS "Build test_bitcoin-qt executable." ON "BUILD_GUI;BUILD_TESTS" OFF )
155
156
if (BUILD_GUI )
156
157
set (qt_components Core Gui Widgets LinguistTools )
157
158
if (ENABLE_WALLET )
@@ -161,6 +162,9 @@ if(BUILD_GUI)
161
162
list (APPEND qt_components DBus )
162
163
set (USE_DBUS TRUE )
163
164
endif ()
165
+ if (BUILD_GUI_TESTS )
166
+ list (APPEND qt_components Test )
167
+ endif ()
164
168
find_package (Qt5 5.11.3 MODULE REQUIRED
165
169
COMPONENTS ${qt_components}
166
170
)
@@ -208,6 +212,7 @@ if(BUILD_FOR_FUZZING)
208
212
set (WITH_MINIUPNPC OFF )
209
213
set (WITH_ZMQ OFF )
210
214
set (BUILD_TESTS OFF )
215
+ set (BUILD_GUI_TESTS OFF )
211
216
set (BUILD_BENCH OFF )
212
217
set (BUILD_FUZZ_BINARY ON )
213
218
@@ -506,6 +511,7 @@ message(" QR code (GUI) ....................... ${WITH_QRENCODE}")
506
511
message (" DBus (GUI, Linux only) .............. ${WITH_DBUS} " )
507
512
message ("Tests:" )
508
513
message (" test_bitcoin ........................ ${BUILD_TESTS} " )
514
+ message (" test_bitcoin-qt ..................... ${BUILD_GUI_TESTS} " )
509
515
message (" bench_bitcoin ....................... ${BUILD_BENCH} " )
510
516
message (" fuzz binary ......................... ${BUILD_FUZZ_BINARY} " )
511
517
message ("" )
Original file line number Diff line number Diff line change @@ -243,6 +243,10 @@ if(WIN32)
243
243
set_target_properties (bitcoin-qt PROPERTIES WIN32_EXECUTABLE TRUE )
244
244
endif ()
245
245
246
+ if (BUILD_GUI_TESTS )
247
+ add_subdirectory (test )
248
+ endif ()
249
+
246
250
247
251
# Gets sources to be parsed to gather translatable strings.
248
252
function (get_translatable_sources var )
Original file line number Diff line number Diff line change
1
+ # Copyright (c) 2024-present The Bitcoin Core developers
2
+ # Distributed under the MIT software license, see the accompanying
3
+ # file COPYING or https://opensource.org/license/mit/.
4
+
5
+ add_executable (test_bitcoin-qt
6
+ apptests.cpp
7
+ optiontests.cpp
8
+ rpcnestedtests.cpp
9
+ test_main.cpp
10
+ uritests.cpp
11
+ util.cpp
12
+ ../../init/bitcoin-qt.cpp
13
+ )
14
+
15
+ target_link_libraries (test_bitcoin-qt
16
+ core_interface
17
+ bitcoinqt
18
+ test_util
19
+ bitcoin_node
20
+ Boost::headers
21
+ Qt5::Test
22
+ )
23
+
24
+ import_plugins (test_bitcoin-qt )
25
+
26
+ if (ENABLE_WALLET )
27
+ target_sources (test_bitcoin-qt
28
+ PRIVATE
29
+ addressbooktests.cpp
30
+ wallettests.cpp
31
+ ../../wallet/test/wallet_test_fixture.cpp
32
+ )
33
+ endif ()
34
+
35
+ if (NOT QT_IS_STATIC )
36
+ add_custom_command (
37
+ TARGET test_bitcoin-qt POST_BUILD
38
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different $< TARGET_PROPERTY:Qt5::QMinimalIntegrationPlugin,LOCATION_$< UPPER_CASE:$< CONFIG> > > $< TARGET_FILE_DIR:test_bitcoin-qt> /plugins/platforms
39
+ VERBATIM
40
+ )
41
+ endif ()
42
+
43
+ add_test (NAME test_bitcoin-qt
44
+ COMMAND test_bitcoin-qt
45
+ )
46
+ if (WIN32 AND VCPKG_TARGET_TRIPLET )
47
+ # On Windows, vcpkg configures Qt with `-opengl dynamic`, which makes
48
+ # the "minimal" platform plugin unusable due to internal Qt bugs.
49
+ set_tests_properties (test_bitcoin-qt PROPERTIES
50
+ ENVIRONMENT "QT_QPA_PLATFORM=windows"
51
+ )
52
+ endif ()
53
+
54
+ install (TARGETS test_bitcoin-qt
55
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
56
+ )
You can’t perform that action at this time.
0 commit comments