Skip to content

cln-rpc: skip the overflow panic tests in release builds - #9584

Closed
cdecker wants to merge 1 commit into
ElementsProject:masterfrom
cdecker:fix/cln-rpc-overflow-tests-release
Closed

cdecker wants to merge 1 commit into
ElementsProject:masterfrom
cdecker:fix/cln-rpc-overflow-tests-release

Conversation

@cdecker

@cdecker cdecker commented Sep 29, 2026

Copy link
Copy Markdown
Member

test_amount_add_overflow and test_amount_sub_overflow are #[should_panic(expected = "attempt to ... with overflow")], but that panic only exists where overflow checks are on. Release builds turn them off, the arithmetic wraps, and both tests fail:

$ cargo test --release -p cln-rpc --lib primitives::test::test_amount_
note: test did not panic as expected
test result: FAILED. 3 passed; 2 failed

That in turn breaks the Nix flake's rust package on every system: crane runs its check phase in the release profile, so nix build .#rust, and with it packages.default, fails.

This marks both tests ignored when debug_assertions is off. A release run then reports them as skipped, with the reason, rather than failing, and debug runs are unchanged:

release: 3 passed; 0 failed; 2 ignored   (ignored, overflow checks are off in release builds)
debug:   5 passed; 0 failed; 0 ignored

Test-only change; no binary is affected.

`test_amount_add_overflow` and `test_amount_sub_overflow` expect the
"attempt to ... with overflow" panic, which only exists where overflow
checks are enabled.  Release builds turn them off, so the arithmetic
wraps and both tests fail under `cargo test --release`.  That breaks
the Nix flake's `rust` package, which runs its check phase in the
release profile, and with it `packages.default`.

Mark them ignored when `debug_assertions` is off, so a release run
reports them as skipped, with the reason, instead of failing.

Changelog-None

Signed-off-by: cdecker <cdecker@blockstream.com>
@cdecker

cdecker commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

Duplicate of #9423, which fixes the same release-profile test failure by making the Amount arithmetic checked instead; closing.

@cdecker cdecker closed this Sep 29, 2026
@cdecker
cdecker deleted the fix/cln-rpc-overflow-tests-release branch September 29, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant