WIP: scripted-diff: [test] Add util/check.h includes for assertions #36843

Closed
maflcko wants to merge 0 commits from 2608-test-assert into master AGit
maflcko commented 2026-11-12 09:44:13 +00:00 (Migrated from github.com)

In test code, assert is used. This is perfectly fine, but sometimes confusion arises, when it is unclear whether NDEBUG can disable the assertions, or whether to use assert or Assert.

Avoid that confusion in test code with a scripted replacement to add the util/check.h include. The changes here will also make it easier to run IWYU.

Scope: This change is only about test code, other code can be done later, if there is need to.

(Currently a draft, because it waits on other stuff)

In test code, `assert` is used. This is perfectly fine, but sometimes confusion arises, when it is unclear whether `NDEBUG` can disable the assertions, or whether to use `assert` or `Assert`. Avoid that confusion in test code with a scripted replacement to add the util/check.h include. The changes here will also make it easier to run IWYU. Scope: This change is only about test code, other code can be done later, if there is need to. (Currently a draft, because it waits on other stuff)
DrahtBot commented 2026-11-12 09:44:26 +00:00 (Migrated from github.com)

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

External sites

Reviews

See the guideline and AI policy for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #bitcoin-core/gui/945 (Fix sign message address book filtering by Bushstar)
  • #36844 (iwyu: Fix warnings in some modules in src/ and treat them as errors by hebasto)
  • #36832 (test: speed up wallet unit test by ViniciusCestarii)
  • #36808 (iwyu: Fix warnings in src/test/fuzz and treat them as errors by hebasto)
  • #36737 (qa: check more socket API invariants for each platform we support by darosior)
  • #36598 ([Demo] validation: remove AssumeUTXO by l0rinc)
  • #36548 (net: serve MSG_BLOCK by stripping witnesses in place by l0rinc)
  • #36520 (interfaces: Avoid node crashes from invalid Chain IPC calls by ryanofsky)
  • #36506 (p2p: plug "tier 1" 1p1c liveness holes by instagibbs)
  • #36386 (compressor: oversized script decoding can leave a spendable script by l0rinc)
  • #36280 (validation: throw when a compressed script can't be decompressed by furszy)
  • #36167 (build: Enable -Wunused by fanquake)
  • #36040 (Wallet: Don't backdate locktime rbf by Bicaru20)
  • #36000 (validation: prefetch blocks while connecting by l0rinc)
  • #35731 (Indexes: Harden the flush-error notification invariant by arejula27)
  • #35713 (Remove boost as a unit test runner by rustaceanrob)
  • #35302 (Silent Payments: Sending (take 2) by Eunovo)
  • #35003 (validation: improve block data I/O error handling in P2P paths by furszy)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36843 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36843.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36843#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. A summary of reviews will appear here. <!--174a7506f384e20aa4161008e828411d--> ### Conflicts Reviewers, this pull request conflicts with the following ones: * [#bitcoin-core/gui/945](https://github.com/bitcoin-core/gui/pull/945) <sub><img src="https://drahtbot.space/ack_count/bitcoin-core/gui/945.svg"></sub> (Fix sign message address book filtering by Bushstar) * [#36844](https://github.com/bitcoin/bitcoin/pull/36844) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36844.svg"></sub> (iwyu: Fix warnings in some modules in `src/` and treat them as errors by hebasto) * [#36832](https://github.com/bitcoin/bitcoin/pull/36832) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36832.svg"></sub> (test: speed up wallet unit test by ViniciusCestarii) * [#36808](https://github.com/bitcoin/bitcoin/pull/36808) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36808.svg"></sub> (iwyu: Fix warnings in `src/test/fuzz` and treat them as errors by hebasto) * [#36737](https://github.com/bitcoin/bitcoin/pull/36737) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36737.svg"></sub> (qa: check more socket API invariants for each platform we support by darosior) * [#36598](https://github.com/bitcoin/bitcoin/pull/36598) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36598.svg"></sub> ([Demo] validation: remove AssumeUTXO by l0rinc) * [#36548](https://github.com/bitcoin/bitcoin/pull/36548) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36548.svg"></sub> (net: serve `MSG_BLOCK` by stripping witnesses in place by l0rinc) * [#36520](https://github.com/bitcoin/bitcoin/pull/36520) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36520.svg"></sub> (interfaces: Avoid node crashes from invalid Chain IPC calls by ryanofsky) * [#36506](https://github.com/bitcoin/bitcoin/pull/36506) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36506.svg"></sub> (p2p: plug "tier 1" 1p1c liveness holes by instagibbs) * [#36386](https://github.com/bitcoin/bitcoin/pull/36386) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36386.svg"></sub> (compressor: oversized script decoding can leave a spendable script by l0rinc) * [#36280](https://github.com/bitcoin/bitcoin/pull/36280) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36280.svg"></sub> (validation: throw when a compressed script can't be decompressed by furszy) * [#36167](https://github.com/bitcoin/bitcoin/pull/36167) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36167.svg"></sub> (build: Enable `-Wunused` by fanquake) * [#36040](https://github.com/bitcoin/bitcoin/pull/36040) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36040.svg"></sub> (Wallet: Don't backdate locktime rbf by Bicaru20) * [#36000](https://github.com/bitcoin/bitcoin/pull/36000) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36000.svg"></sub> (validation: prefetch blocks while connecting by l0rinc) * [#35731](https://github.com/bitcoin/bitcoin/pull/35731) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35731.svg"></sub> (Indexes: Harden the flush-error notification invariant by arejula27) * [#35713](https://github.com/bitcoin/bitcoin/pull/35713) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35713.svg"></sub> (Remove boost as a unit test runner by rustaceanrob) * [#35302](https://github.com/bitcoin/bitcoin/pull/35302) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35302.svg"></sub> (Silent Payments: Sending (take 2) by Eunovo) * [#35003](https://github.com/bitcoin/bitcoin/pull/35003) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35003.svg"></sub> (validation: improve block data I/O error handling in P2P paths by furszy) If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. <!--5faf32d7da4f0f540f40219e4f7537a3-->
First-time contributor

No verified findings are available from this review.

Review coverage was incomplete.


Reviewed: 71f48a6e93e4 · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:f3e06854f254c480580a263b00f5c6aaa804717e751da362d6c3a17a8fae78d3:eaa37ea1cdada8fdd806ab11180fd9e0f01062422d9d8c5ea7dcfd80d5014b95 --> <!-- ralph-base:c68583ab5a886b6add45a8607d762b71678c748c --> <!-- ralph-head:71f48a6e93e42d9989a93297555ca8bb37bde31c --> <!-- ralph-case:1bc0884d10373d6cfc8667094ddc02edddf82770a5b82b46d55f0b3b42832c76 --> No verified findings are available from this review. Review coverage was incomplete. <!-- Review tier: routine --> --- Reviewed: [`71f48a6e93e4`](<https://git.fish.foo/bitcoin/bitcoin/commit/71f48a6e93e42d9989a93297555ca8bb37bde31c>) · [Review report](<https://review.fish.foo/report/36843-71f48a6e93e42d9989a93297555ca8bb37bde31c-2562-1.html>) · [Previous reports](<https://review.fish.foo/traces/36843/>) [permalink](<https://review.fish.foo/report/36843-71f48a6e93e42d9989a93297555ca8bb37bde31c-2562-1.html>)
DrahtBot commented 2026-11-21 01:09:09 +00:00 (Migrated from github.com)

🐙 This pull request conflicts with the target branch and needs rebase.

<!--cf906140f33d8803c4a75a2196329ecb--> 🐙 This pull request conflicts with the target branch and [needs rebase](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#rebasing-changes).
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36843
No description provided.