What changed, and why it matters
This commit is a routine build-system cleanup. It moves existing inter-process communication (IPC) test files from one directory to another and updates CMake instructions accordingly. No production code, no security-sensitive logic, and no bug fixes are present.
No security action needed. Treat as ordinary maintenance/refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change relocates ipc_tests.cpp and its CMake rules from src/test/ to a new src/ipc/test/ directory. It also removes src/test/.clang-tidy.in, which previously disabled a clang-analyzer array-bounds check for the test directory. The test source code itself is identical before and after the move. This is purely a project-structure refactor.
Changed components
src/test/CMakeLists.txtsrc/ipc/test/CMakeLists.txtsrc/test/ipc_tests.cppsrc/ipc/test/ipc_tests.cppsrc/test/.clang-tidy.inInspect captured patch +62 / −59
diff --git a/src/ipc/test/CMakeLists.txt b/src/ipc/test/CMakeLists.txt
new file mode 100644
index 00000000..a9bb02f5
--- /dev/null
+++ b/src/ipc/test/CMakeLists.txt
@@ -0,0 +1,19 @@
+# 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/.
+
+target_link_libraries(bitcoin_ipc_test
+ PRIVATE
+ core_interface
+ univalue
+ Boost::headers
+)
+
+# 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)
diff --git a/src/ipc/test/ipc_tests.cpp b/src/ipc/test/ipc_tests.cpp
new file mode 100644
index 00000000..35a4f611
--- /dev/null
+++ b/src/ipc/test/ipc_tests.cpp
@@ -0,0 +1,42 @@
+// Copyright (c) 2023 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#include <ipc/process.h>
+#include <test/ipc_test.h>
+
+#include <test/util/setup_common.h>
+#include <boost/test/unit_test.hpp>
+
+BOOST_FIXTURE_TEST_SUITE(ipc_tests, BasicTestingSetup)
+BOOST_AUTO_TEST_CASE(ipc_tests)
+{
+ IpcPipeTest();
+ IpcSocketPairTest();
+ IpcSocketTest(m_args.GetDataDirNet());
+}
+
+// Test address parsing.
+BOOST_AUTO_TEST_CASE(parse_address_test)
+{
+ std::unique_ptr<ipc::Process> process{ipc::MakeProcess()};
+ fs::path datadir{"/var/empty/notexist"};
+ auto check_notexist{[](const std::system_error& e) { return e.code() == std::errc::no_such_file_or_directory; }};
+ auto check_address{[&](std::string address, std::string expect_address, std::string expect_error) {
+ if (expect_error.empty()) {
+ BOOST_CHECK_EXCEPTION(process->connect(datadir, "test_bitcoin", address), std::system_error, check_notexist);
+ } else {
+ BOOST_CHECK_EXCEPTION(process->connect(datadir, "test_bitcoin", address), std::invalid_argument, HasReason(expect_error));
+ }
+ BOOST_CHECK_EQUAL(address, expect_address);
+ }};
+ check_address("unix", "unix:/var/empty/notexist/test_bitcoin.sock", "");
+ check_address("unix:", "unix:/var/empty/notexist/test_bitcoin.sock", "");
+ check_address("unix:path.sock", "unix:/var/empty/notexist/path.sock", "");
+ check_address("unix:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock",
+ "unix:/var/empty/notexist/0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock",
+ "Unix address path \"/var/empty/notexist/0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock\" exceeded maximum socket path length");
+ check_address("invalid", "invalid", "Unrecognized address 'invalid'");
+}
+
+BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/test/.clang-tidy.in b/src/test/.clang-tidy.in
deleted file mode 100644
index 92d24f6f..00000000
--- a/src/test/.clang-tidy.in
+++ /dev/null
@@ -1,3 +0,0 @@
-Checks:
- # See: https://github.com/capnproto/capnproto/pull/2417.
- - "-clang-analyzer-security.ArrayBound"
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
index a67cd241..4e8f7e91 100644
--- a/src/test/CMakeLists.txt
+++ b/src/test/CMakeLists.txt
@@ -168,20 +168,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)
diff --git a/src/test/ipc_tests.cpp b/src/test/ipc_tests.cpp
deleted file mode 100644
index 35a4f611..00000000
--- a/src/test/ipc_tests.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2023 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#include <ipc/process.h>
-#include <test/ipc_test.h>
-
-#include <test/util/setup_common.h>
-#include <boost/test/unit_test.hpp>
-
-BOOST_FIXTURE_TEST_SUITE(ipc_tests, BasicTestingSetup)
-BOOST_AUTO_TEST_CASE(ipc_tests)
-{
- IpcPipeTest();
- IpcSocketPairTest();
- IpcSocketTest(m_args.GetDataDirNet());
-}
-
-// Test address parsing.
-BOOST_AUTO_TEST_CASE(parse_address_test)
-{
- std::unique_ptr<ipc::Process> process{ipc::MakeProcess()};
- fs::path datadir{"/var/empty/notexist"};
- auto check_notexist{[](const std::system_error& e) { return e.code() == std::errc::no_such_file_or_directory; }};
- auto check_address{[&](std::string address, std::string expect_address, std::string expect_error) {
- if (expect_error.empty()) {
- BOOST_CHECK_EXCEPTION(process->connect(datadir, "test_bitcoin", address), std::system_error, check_notexist);
- } else {
- BOOST_CHECK_EXCEPTION(process->connect(datadir, "test_bitcoin", address), std::invalid_argument, HasReason(expect_error));
- }
- BOOST_CHECK_EQUAL(address, expect_address);
- }};
- check_address("unix", "unix:/var/empty/notexist/test_bitcoin.sock", "");
- check_address("unix:", "unix:/var/empty/notexist/test_bitcoin.sock", "");
- check_address("unix:path.sock", "unix:/var/empty/notexist/path.sock", "");
- check_address("unix:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock",
- "unix:/var/empty/notexist/0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock",
- "Unix address path \"/var/empty/notexist/0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock\" exceeded maximum socket path length");
- check_address("invalid", "invalid", "Unrecognized address 'invalid'");
-}
-
-BOOST_AUTO_TEST_SUITE_END()
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.