9#include <boost/test/unit_test.hpp>
23 fs::path datadir{
"/var/empty/notexist"};
24 auto check_notexist{[](
const std::system_error& e) {
return e.code() == std::errc::no_such_file_or_directory; }};
25 auto check_address{[&](std::string address, std::string expect_address, std::string expect_error) {
26 if (expect_error.empty()) {
27 BOOST_CHECK_EXCEPTION(process->connect(datadir,
"test_bitcoin", address), std::system_error, check_notexist);
29 BOOST_CHECK_EXCEPTION(process->connect(datadir,
"test_bitcoin", address), std::invalid_argument,
HasReason(expect_error));
33 check_address(
"unix",
"unix:/var/empty/notexist/test_bitcoin.sock",
"");
34 check_address(
"unix:",
"unix:/var/empty/notexist/test_bitcoin.sock",
"");
35 check_address(
"unix:path.sock",
"unix:/var/empty/notexist/path.sock",
"");
36 check_address(
"unix:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock",
37 "unix:/var/empty/notexist/0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock",
38 "Unix address path \"/var/empty/notexist/0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock\" exceeded maximum socket path length");
39 check_address(
"invalid",
"invalid",
"Unrecognized address 'invalid'");
BOOST_CHECK_EXCEPTION predicates to check the specific validation error.
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
BOOST_FIXTURE_TEST_SUITE(cuckoocache_tests, BasicTestingSetup)
Test Suite for CuckooCache.
BOOST_AUTO_TEST_SUITE_END()
void IpcSocketTest(const fs::path &datadir)
Test ipc::Process bind() and connect() methods connecting over a unix socket.
void IpcPipeTest()
Unit test that tests execution of IPC calls without actually creating a separate process.
void IpcSocketPairTest()
Test ipc::Protocol connect() and serve() methods connecting over a socketpair.
BOOST_AUTO_TEST_CASE(ipc_tests)
std::unique_ptr< Process > MakeProcess()
Constructor for Process interface.
#define BOOST_CHECK_EQUAL(v1, v2)