Skip to content

Conversation

@nyonson
Copy link
Collaborator

@nyonson nyonson commented Dec 12, 2025

Two little cleanups which I hope make it easier to add some release/debug_assert settings.

First patch drops the builds before running test. I don't think there is any benefit of this, but maybe there was historically or I am just missing something?

Second patch makes sure we are using --locked everywhere so that dependencies are never silently upgraded in CI.

Copy link
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 47cc9ce

@tcharding tcharding merged commit 058316c into rust-bitcoin:master Dec 15, 2025
1 check passed
@tcharding
Copy link
Member

The new cargo function is giving us some grief @nyonson. It showed up in https://github.com/rust-bitcoin/rust-bitcoin/actions/runs/20219540291/job/58038533409?pr=5391 but you can see the problems by running cargo +nightly clippy in the cargo-rbmt/ directory.

warning: unused variable: `name`
   --> cargo-rbmt/src/test.rs:174:21
    |
174 |                 let name = parts[0];
    |                     ^^^^
175 |                 cargo(sh, "run --example {name}").run()?;
    |                           ---------------------- you might have meant to use string interpolation in this string literal
...
183 |                     cargo(sh, "run --no-default-features --example {name}").run()?;
    |                               -------------------------------------------- you might have meant to use string interpolation in this string literal
...
186 |                     cargo(sh, "run --example {name} --features={features}").run()?;
    |                               -------------------------------------------- you might have meant to use string interpolation in this string literal
    |
    = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default
help: string interpolation only works in `format!` invocations
    |
175 |                 cargo(sh, format!("run --example {name}")).run()?;
    |                           ++++++++                      +
help: string interpolation only works in `format!` invocations
    |
183 |                     cargo(sh, format!("run --no-default-features --example {name}")).run()?;
    |                               ++++++++                                            +
help: string interpolation only works in `format!` invocations
    |
186 |                     cargo(sh, format!("run --example {name} --features={features}")).run()?;
    |                               ++++++++                                            +
help: if this is intentional, prefix it with an underscore

@nyonson
Copy link
Collaborator Author

nyonson commented Dec 15, 2025

The new cargo function is giving us some grief @nyonson. It showed up in https://github.com/rust-bitcoin/rust-bitcoin/actions/runs/20219540291/job/58038533409?pr=5391 but you can see the problems by running cargo +nightly clippy in the cargo-rbmt/ directory.

Ah dang, my bad. I have been testing changes to this by just installing it locally which clearly isn't good enough now. Let me take a pass at cleaning things up.

@tcharding
Copy link
Member

Cheers, legend.

@apoelstra
Copy link
Member

In 07d9757:

Why is the build redundant? It builds the crate without cfg=test, which cargo test does not.

@apoelstra
Copy link
Member

For the record: second commit was reverted in #40

@nyonson
Copy link
Collaborator Author

nyonson commented Dec 18, 2025

In 07d9757:

Why is the build redundant? It builds the crate without cfg=test, which cargo test does not.

Oh, I totally missed this, my bad. Is it possible to write code that some how only works with a test dependency or something?

I'll add back the separate build step.

@apoelstra
Copy link
Member

Is it possible to write code that some how only works with a test dependency or something?

Yes, by gating some critical part of the code on #[cfg(test)].

@tcharding
Copy link
Member

Oh, I totally missed this, my bad.

My mistake too, I reviewed.

tcharding added a commit that referenced this pull request Dec 18, 2025
c37a853 cargo-rbmt: bring back build before test to catch gating issues (Nick Johnson)

Pull request description:

  As pointed out by @apoelstra in #39 (comment), this isn't a performance thing, it attempts to catch issues where gated test code is actually depended on.

ACKs for top commit:
  tcharding:
    ACK c37a853

Tree-SHA512: 4df1b9f2261576b05f2c50e97bbf7cb0003f5bf29b3d63e31c0eff863c0094c548cb7e57280854206db16f79eb0005ff54e6452ffea85348f003b2eec3421b95
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.

3 participants