aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-11-22 11:17:15 +0000
committerfanquake <fanquake@gmail.com>2023-11-22 11:18:24 +0000
commit3dca308bd77cae6489e325e19472338a525def6e (patch)
treee33cf4d7310f93e40311ff5b88dc368aeb5b3085 /src/test
parente9beaa749c998ad86e97c98025125cafeec6c9de (diff)
parent007d6f0e85bc329040bb405ef6016339518caa66 (diff)
Merge bitcoin/bitcoin#28891: test: fix `AddNode` unit test failure on OpenBSD
007d6f0e85bc329040bb405ef6016339518caa66 test: fix `AddNode` unit test failure on OpenBSD (Sebastian Falbesoner) Pull request description: On OpenBSD 7.4, the following check of the unit test `test_addnode_getaddednodeinfo_and_connection_detection` currently fails: ``` BOOST_CHECK(!connman->AddNode({/*m_added_node=*/"127.1", /*m_use_v2transport=*/true})); ``` The reason for that is that this OS seemingly doesn't support the IPv4 shorthand notation with omitted zero-bytes: ``` $ ping 127.1 ping: no address associated with name ``` As a simple fix, this PR skips the check for this with a pre-processor #if. On NetBSD and FreeBSD, `127.1` is resolved correctly to localhost and hence the test passes (thanks to vasild for verifying on the latter!). ACKs for top commit: vasild: ACK 007d6f0e85bc329040bb405ef6016339518caa66 Tree-SHA512: 8ab8393c490e1ecc140e8ff74f6fa4d26d0dd77e6a77a241cd198314b8c5afee7422f95351ca05f4c1742433dab77016a8ccb8d28062f8edd4b703a918a2bbda
Diffstat (limited to 'src/test')
-rw-r--r--src/test/net_peer_connection_tests.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/test/net_peer_connection_tests.cpp b/src/test/net_peer_connection_tests.cpp
index 3d3f296d82..a9e9858d95 100644
--- a/src/test/net_peer_connection_tests.cpp
+++ b/src/test/net_peer_connection_tests.cpp
@@ -116,7 +116,10 @@ BOOST_AUTO_TEST_CASE(test_addnode_getaddednodeinfo_and_connection_detection)
BOOST_TEST_MESSAGE("\nCall AddNode() with 2 addrs resolving to existing localhost addnode entry; neither should be added");
BOOST_CHECK(!connman->AddNode({/*m_added_node=*/"127.0.0.1", /*m_use_v2transport=*/true}));
+ // OpenBSD doesn't support the IPv4 shorthand notation with omitted zero-bytes.
+#if !defined(__OpenBSD__)
BOOST_CHECK(!connman->AddNode({/*m_added_node=*/"127.1", /*m_use_v2transport=*/true}));
+#endif
BOOST_TEST_MESSAGE("\nExpect GetAddedNodeInfo to return expected number of peers with `include_connected` true/false");
BOOST_CHECK_EQUAL(connman->GetAddedNodeInfo(/*include_connected=*/true).size(), nodes.size());