mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-31 10:41:08 +00:00
Merge bitcoin/bitcoin#33774: cmake: Move IPC tests to ipc/test
866bbb98fd365962840ee99df0d9f7ad557cc025 cmake, test: Improve locality of `bitcoin_ipc_test` library description (Hennadii Stepanov) ae2e438b257f2b5322080087ed7dc8843d4f9cca cmake: Move IPC tests to `ipc/test` (Hennadii Stepanov) Pull request description: This PR follows up on https://github.com/bitcoin/bitcoin/pull/33445 and: 1. Organizes the IPC tests in the same way as the wallet tests. 2. Removes no longer needed `src/test/.clang-tidy.in`. See the previous discussion: - https://github.com/bitcoin/bitcoin/pull/33445#discussion_r2379651340 - https://github.com/bitcoin/bitcoin/pull/33445#pullrequestreview-3411868329 Additionally, the locality of the `bitcoin_ipc_test` build target description has been improved. ACKs for top commit: Sjors: ACK 866bbb98fd365962840ee99df0d9f7ad557cc025 janb84: ACK 866bbb98fd365962840ee99df0d9f7ad557cc025 ryanofsky: Code review ACK 866bbb98fd365962840ee99df0d9f7ad557cc025, just adding back the suggested comment, and also fixing bad include arguments passed to target_capnp_sources. It would probably be a little better if the include fix was done in an earlier commit, since it's not really related to the other changes in the last commit, but would also be ok to make both changes at the same time. Tree-SHA512: ed7cc817ccb88595d8516978bff0ea2560048d35b3f548e7913aec7d58b8d6ac550e230e992c527fb747bef175580be92dc4df6342e4485f3a9870dba0a25cba
This commit is contained in:
commit
9e02f78089
@ -325,22 +325,6 @@ if(ENABLE_IPC AND BUILD_DAEMON)
|
||||
install_binary_component(bitcoin-node INTERNAL)
|
||||
endif()
|
||||
|
||||
if(ENABLE_IPC AND BUILD_TESTS)
|
||||
# bitcoin_ipc_test library target is defined here in src/CMakeLists.txt
|
||||
# instead of src/test/CMakeLists.txt so capnp files in src/test/ are able to
|
||||
# reference capnp files in src/ipc/capnp/ by relative path. The Cap'n Proto
|
||||
# compiler only allows importing by relative path when the importing and
|
||||
# imported files are underneath the same compilation source prefix, so the
|
||||
# source prefix must be src/, not src/test/
|
||||
add_library(bitcoin_ipc_test STATIC EXCLUDE_FROM_ALL
|
||||
test/ipc_test.cpp
|
||||
)
|
||||
target_capnp_sources(bitcoin_ipc_test ${PROJECT_SOURCE_DIR}
|
||||
test/ipc_test.capnp
|
||||
)
|
||||
add_dependencies(bitcoin_ipc_test bitcoin_ipc_headers)
|
||||
endif()
|
||||
|
||||
|
||||
add_library(bitcoin_cli STATIC EXCLUDE_FROM_ALL
|
||||
compat/stdin.cpp
|
||||
|
||||
@ -9,7 +9,7 @@ add_library(bitcoin_ipc STATIC EXCLUDE_FROM_ALL
|
||||
process.cpp
|
||||
)
|
||||
|
||||
target_capnp_sources(bitcoin_ipc ${PROJECT_SOURCE_DIR}
|
||||
target_capnp_sources(bitcoin_ipc ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
capnp/common.capnp
|
||||
capnp/echo.capnp
|
||||
capnp/init.capnp
|
||||
@ -22,4 +22,27 @@ target_link_libraries(bitcoin_ipc
|
||||
univalue
|
||||
)
|
||||
|
||||
if(BUILD_TESTS)
|
||||
# bitcoin_ipc_test library target is defined here in src/ipc/CMakeLists.txt
|
||||
# instead of src/ipc/test/CMakeLists.txt so capnp files in src/ipc/test/ are able to
|
||||
# reference capnp files in src/ipc/capnp/ by relative path. The Cap'n Proto
|
||||
# compiler only allows importing by relative path when the importing and
|
||||
# imported files are underneath the same compilation source prefix, so the
|
||||
# source prefix must be src/ipc, not src/ipc/test/
|
||||
add_library(bitcoin_ipc_test STATIC EXCLUDE_FROM_ALL
|
||||
test/ipc_test.cpp
|
||||
)
|
||||
target_capnp_sources(bitcoin_ipc_test ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
test/ipc_test.capnp
|
||||
)
|
||||
add_dependencies(bitcoin_ipc_test bitcoin_ipc_headers)
|
||||
|
||||
target_link_libraries(bitcoin_ipc_test
|
||||
PRIVATE
|
||||
core_interface
|
||||
univalue
|
||||
Boost::headers
|
||||
)
|
||||
endif()
|
||||
|
||||
configure_file(.clang-tidy.in .clang-tidy USE_SOURCE_PERMISSIONS COPYONLY)
|
||||
|
||||
12
src/ipc/test/CMakeLists.txt
Normal file
12
src/ipc/test/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
# Copyright (c) 2023-present The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
# Do not use generator expressions in test sources because the
|
||||
# SOURCES property is processed to gather test suite macros.
|
||||
target_sources(test_bitcoin
|
||||
PRIVATE
|
||||
ipc_tests.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(test_bitcoin bitcoin_ipc_test bitcoin_ipc)
|
||||
@ -8,10 +8,10 @@ using Cxx = import "/capnp/c++.capnp";
|
||||
$Cxx.namespace("gen");
|
||||
|
||||
using Proxy = import "/mp/proxy.capnp";
|
||||
$Proxy.include("test/ipc_test.h");
|
||||
$Proxy.includeTypes("test/ipc_test_types.h");
|
||||
$Proxy.include("ipc/test/ipc_test.h");
|
||||
$Proxy.includeTypes("ipc/test/ipc_test_types.h");
|
||||
|
||||
using Mining = import "../ipc/capnp/mining.capnp";
|
||||
using Mining = import "../capnp/mining.capnp";
|
||||
|
||||
interface FooInterface $Proxy.wrap("FooImplementation") {
|
||||
add @0 (a :Int32, b :Int32) -> (result :Int32);
|
||||
@ -8,9 +8,9 @@
|
||||
#include <ipc/protocol.h>
|
||||
#include <logging.h>
|
||||
#include <mp/proxy-types.h>
|
||||
#include <test/ipc_test.capnp.h>
|
||||
#include <test/ipc_test.capnp.proxy.h>
|
||||
#include <test/ipc_test.h>
|
||||
#include <ipc/test/ipc_test.capnp.h>
|
||||
#include <ipc/test/ipc_test.capnp.proxy.h>
|
||||
#include <ipc/test/ipc_test.h>
|
||||
#include <tinyformat.h>
|
||||
#include <validation.h>
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_TEST_IPC_TEST_H
|
||||
#define BITCOIN_TEST_IPC_TEST_H
|
||||
#ifndef BITCOIN_IPC_TEST_IPC_TEST_H
|
||||
#define BITCOIN_IPC_TEST_IPC_TEST_H
|
||||
|
||||
#include <primitives/transaction.h>
|
||||
#include <script/script.h>
|
||||
@ -27,4 +27,4 @@ void IpcPipeTest();
|
||||
void IpcSocketPairTest();
|
||||
void IpcSocketTest(const fs::path& datadir);
|
||||
|
||||
#endif // BITCOIN_TEST_IPC_TEST_H
|
||||
#endif // BITCOIN_IPC_TEST_IPC_TEST_H
|
||||
@ -2,11 +2,11 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_TEST_IPC_TEST_TYPES_H
|
||||
#define BITCOIN_TEST_IPC_TEST_TYPES_H
|
||||
#ifndef BITCOIN_IPC_TEST_IPC_TEST_TYPES_H
|
||||
#define BITCOIN_IPC_TEST_IPC_TEST_TYPES_H
|
||||
|
||||
#include <ipc/capnp/common-types.h>
|
||||
#include <ipc/capnp/mining-types.h>
|
||||
#include <test/ipc_test.capnp.h>
|
||||
#include <ipc/test/ipc_test.capnp.h>
|
||||
|
||||
#endif // BITCOIN_TEST_IPC_TEST_TYPES_H
|
||||
#endif // BITCOIN_IPC_TEST_IPC_TEST_TYPES_H
|
||||
@ -3,7 +3,7 @@
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <ipc/process.h>
|
||||
#include <test/ipc_test.h>
|
||||
#include <ipc/test/ipc_test.h>
|
||||
|
||||
#include <test/util/setup_common.h>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
@ -1,3 +0,0 @@
|
||||
Checks:
|
||||
# See: https://github.com/capnproto/capnproto/pull/2417.
|
||||
- "-clang-analyzer-security.ArrayBound"
|
||||
@ -167,20 +167,7 @@ if(ENABLE_WALLET)
|
||||
endif()
|
||||
|
||||
if(ENABLE_IPC)
|
||||
target_link_libraries(bitcoin_ipc_test
|
||||
PRIVATE
|
||||
core_interface
|
||||
univalue
|
||||
Boost::headers
|
||||
)
|
||||
|
||||
target_sources(test_bitcoin
|
||||
PRIVATE
|
||||
ipc_tests.cpp
|
||||
)
|
||||
target_link_libraries(test_bitcoin bitcoin_ipc_test bitcoin_ipc)
|
||||
|
||||
configure_file(.clang-tidy.in .clang-tidy USE_SOURCE_PERMISSIONS COPYONLY)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/src/ipc/test ipc)
|
||||
endif()
|
||||
|
||||
function(add_boost_test source_file)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user