Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/cargo/core/compiler/fingerprint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1611,12 +1611,7 @@ fn calculate_normal(
let outputs = build_runner
.outputs(unit)?
.iter()
.filter(|output| {
!matches!(
output.flavor,
FileFlavor::DebugInfo | FileFlavor::Auxiliary | FileFlavor::Sbom
)
})
.filter(|output| !matches!(output.flavor, FileFlavor::DebugInfo | FileFlavor::Auxiliary))
.map(|output| output.path.clone())
.collect();

Expand Down
34 changes: 34 additions & 0 deletions tests/testsuite/sbom.rs

@weihanglo weihanglo Jul 14, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi, we normally follow the pattern C-TEST described in this doc. The basic idea is that your first commit becomes a reproduction of the buggy behavior, and your second commit contains the diff that shows the behavior change. With that we can make sure we are not fixing a non-existing issue. Mind tweaking your git commits a bit?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Something like this? 9beeb7b

Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,40 @@ fn simple() {
);
}

#[cargo_test]
fn enabling_sbom_invalidates_fingerprint() {
let p = project()
.file("Cargo.toml", &basic_bin_manifest("foo"))
.file("src/main.rs", r#"fn main() {}"#)
.build();

p.cargo("build").run();

let file = append_sbom_suffix(&p.bin("foo"));
assert!(!file.exists());

p.cargo("build -Zsbom")
.env("CARGO_BUILD_SBOM", "true")
.masquerade_as_nightly_cargo(&["sbom"])
.with_stderr_data(cargo_test_support::str![[r#"
[COMPILING] foo v0.5.0 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s

"#]])
.run();

assert!(file.is_file());

p.cargo("build -Zsbom")
.env("CARGO_BUILD_SBOM", "true")
.masquerade_as_nightly_cargo(&["sbom"])
.with_stderr_data(cargo_test_support::str![[r#"
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s

"#]])
.run();
Comment on lines +109 to +128

@weihanglo weihanglo Jul 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you add .with_stderr_data(…) to assert something was actually recompiled?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you again follow the C-TEST pattern? Feel free to rebase and clean up history

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, sorry — I’m still getting used to the C-TEST convention. bd1b857

}

#[cargo_test]
fn with_multiple_crate_types() {
let p = project()
Expand Down