LCOV - code coverage report
Current view: top level - src/test - ipc_tests.cpp (source / functions) Coverage Total Hit
Test: total_coverage.info Lines: 100.0 % 23 23
Test Date: 2025-08-25 05:11:47 Functions: 100.0 % 6 6
Branches: 48.7 % 224 109

             Branch data     Line data    Source code
       1                 :             : // Copyright (c) 2023 The Bitcoin Core developers
       2                 :             : // Distributed under the MIT software license, see the accompanying
       3                 :             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       4                 :             : 
       5                 :             : #include <ipc/process.h>
       6                 :             : #include <test/ipc_test.h>
       7                 :             : 
       8                 :             : #include <test/util/setup_common.h>
       9                 :             : #include <boost/test/unit_test.hpp>
      10                 :             : 
      11                 :             : BOOST_FIXTURE_TEST_SUITE(ipc_tests, BasicTestingSetup)
      12   [ +  -  +  -  :           7 : BOOST_AUTO_TEST_CASE(ipc_tests)
          +  -  +  -  -  
          +  +  -  +  -  
          +  -  +  -  +  
          -  +  -  -  +  
          +  -  +  -  +  
          -  +  -  +  -  
          +  -  -  +  +  
          -  +  -  +  -  
          +  -  +  -  +  
          -  +  -  -  +  
          +  -  +  -  +  
          -  +  -  +  -  
          +  -  -  +  +  
                      - ]
      13                 :             : {
      14                 :           1 :     IpcPipeTest();
      15                 :           1 :     IpcSocketPairTest();
      16         [ +  - ]:           1 :     IpcSocketTest(m_args.GetDataDirNet());
      17                 :           1 : }
      18                 :             : 
      19                 :             : // Test address parsing.
      20   [ +  -  +  -  :           7 : BOOST_AUTO_TEST_CASE(parse_address_test)
          +  -  +  -  -  
          +  +  -  +  -  
          +  -  +  -  +  
          -  +  -  -  +  
          +  -  +  -  +  
          -  +  -  +  -  
          +  -  -  +  +  
          -  +  -  +  -  
          +  -  +  -  +  
          -  +  -  -  +  
          +  -  +  -  +  
          -  +  -  +  -  
          +  -  -  +  +  
                      - ]
      21                 :             : {
      22                 :           1 :     std::unique_ptr<ipc::Process> process{ipc::MakeProcess()};
      23         [ +  - ]:           1 :     fs::path datadir{"/var/empty/notexist"};
      24                 :           4 :     auto check_notexist{[](const std::system_error& e) { return e.code() == std::errc::no_such_file_or_directory; }};
      25                 :           6 :     auto check_address{[&](std::string address, std::string expect_address, std::string expect_error) {
      26         [ +  + ]:           5 :         if (expect_error.empty()) {
      27   [ +  -  +  -  :           9 :             BOOST_CHECK_EXCEPTION(process->connect(datadir, "test_bitcoin", address), std::system_error, check_notexist);
          -  +  -  -  -  
          -  -  +  +  -  
                   +  - ]
      28                 :             :         } else {
      29   [ +  -  +  -  :           6 :             BOOST_CHECK_EXCEPTION(process->connect(datadir, "test_bitcoin", address), std::invalid_argument, HasReason(expect_error));
          -  +  -  -  -  
          -  -  +  +  -  
          -  +  +  -  +  
                      - ]
      30                 :             :         }
      31         [ +  - ]:           5 :         BOOST_CHECK_EQUAL(address, expect_address);
      32                 :           6 :     }};
      33   [ +  -  +  -  :           2 :     check_address("unix", "unix:/var/empty/notexist/test_bitcoin.sock", "");
             +  -  +  - ]
      34   [ +  -  +  -  :           2 :     check_address("unix:", "unix:/var/empty/notexist/test_bitcoin.sock", "");
             +  -  +  - ]
      35   [ +  -  +  -  :           2 :     check_address("unix:path.sock", "unix:/var/empty/notexist/path.sock", "");
             +  -  +  - ]
      36   [ +  -  +  - ]:           2 :     check_address("unix:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock",
      37         [ +  - ]:           2 :                   "unix:/var/empty/notexist/0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock",
      38         [ +  - ]:           1 :                   "Unix address path \"/var/empty/notexist/0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.sock\" exceeded maximum socket path length");
      39   [ +  -  +  -  :           2 :     check_address("invalid", "invalid", "Unrecognized address 'invalid'");
             +  -  +  - ]
      40                 :           1 : }
      41                 :             : 
      42                 :             : BOOST_AUTO_TEST_SUITE_END()
        

Generated by: LCOV version 2.0-1