test: Kill `BOOST_ASSERT` and update the linter #27889

pull hebasto wants to merge 2 commits into bitcoin:master from hebasto:230614-assert changing 2 files +13 −4
  1. hebasto commented at 3:09 PM on June 14, 2023: member

    One of the goals of #27783 was to get rid of the BOOST_ASSERT macros instead of including the boost/assert.hpp headers. See #27783 (review).

    It turns out that a couple of those macros sneaked into the codebase in #27790.

    This PR makes the linter guard against new instances of the BOOST_ASSERT macros and replaces the current ones.

  2. test: Kill `BOOST_ASSERT` 47fe551e52
  3. DrahtBot commented at 3:09 PM on June 14, 2023: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK kevkevinpal, stickies-v, TheCharlatan

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. DrahtBot added the label Tests on Jun 14, 2023
  5. in test/lint/lint-includes.py:109 in 82f694a617 outdated
     104 | +        if e.returncode > 1:
     105 | +            raise e
     106 | +        elif e.returncode == 1:
     107 | +            return extra_boosts
     108 | +
     109 | +    extra_boosts.add("BOOST_ASSERT")
    


    maflcko commented at 3:14 PM on June 14, 2023:

    Any reason to put this here, instead of in ./test/lint/lint-assertions.py?


    hebasto commented at 3:24 PM on June 14, 2023:
  6. hebasto force-pushed on Jun 14, 2023
  7. hebasto commented at 3:24 PM on June 14, 2023: member

    Updated 82f694a61716d182fef4b85b1c38a812649eeff0 -> de5e464787ad41c631c81ab690d0cf64bea18060 (pr27889.01 -> pr27889.02, diff):

  8. in test/lint/lint-assertions.py:56 in de5e464787 outdated
      51 | +        "-E",
      52 | +        r"BOOST_ASSERT *\(.*\);",
      53 | +        "--",
      54 | +        "*.cpp",
      55 | +        "*.h",
      56 | +    ], "BOOST_ASSERT must replaced with non-Boost alternatives.")
    


    maflcko commented at 3:25 PM on June 14, 2023:
        ], "BOOST_ASSERT must replaced with Assert, BOOST_REQUIRE, or BOOST_CHECK*.")
    

    hebasto commented at 3:27 PM on June 14, 2023:

    Indeed! BOOST_CHECK is not a "non-Boost alternative" :)

    Thanks! Fixed.

  9. test: Make linter to look for `BOOST_ASSERT` macros
    The `BOOST_ASSERT` macro requires to `#include boost/assert.hpp`.
    28fff06afe
  10. hebasto force-pushed on Jun 14, 2023
  11. hebasto commented at 3:29 PM on June 14, 2023: member

    Updated de5e464787ad41c631c81ab690d0cf64bea18060 -> 28fff06afe98177c14a932abf95b380bb51c6653 (pr27889.02 -> pr27889.03, diff):

  12. kevkevinpal commented at 10:49 PM on June 15, 2023: contributor

    ACK 28fff06

    did on a grep on 427853ab49f610e971b73ea4cc1d5366747e52b1 grep -nri "BOOST_ASSERT" ./src and grep -nri "BOOST_ASSERT" ./test found the two instances of BOOST_ASSERT you removed

  13. stickies-v approved
  14. stickies-v commented at 9:36 AM on June 16, 2023: contributor

    ACK 28fff06af

    No need for BOOST_ASSERT. Verified that the test works:

    ./test/lint/all-lint.py
    BOOST_ASSERT must be replaced with Assert, BOOST_REQUIRE, or BOOST_CHECK.
    src/wallet/test/db_tests.cpp:                BOOST_ASSERT(status == DatabaseCursor::Status::MORE);
    
    ^---- failure generated from lint-assertions.py
    
  15. TheCharlatan approved
  16. TheCharlatan commented at 11:19 AM on June 22, 2023: contributor

    ACK 28fff06afe98177c14a932abf95b380bb51c6653

  17. fanquake merged this on Jun 22, 2023
  18. fanquake closed this on Jun 22, 2023

  19. sidhujag referenced this in commit 1d1ed98bef on Jun 22, 2023
  20. hebasto deleted the branch on Jun 23, 2023
  21. bitcoin locked this on Jun 22, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-24 21:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me