test(freshness_checksum): different fingeprint methods are compatible

This ensures that users can switch between different fingerprint
freshness methods and still correctly rebuild stuff.
This commit is contained in:
Jacob Kiesel 2024-10-02 13:12:12 -06:00 committed by Weihang Lo
parent 0d08e19661
commit c0e550ee5b
No known key found for this signature in database
GPG Key ID: D7DBF189825E82E7

View File

@ -53,6 +53,45 @@ fn checksum_actually_uses_checksum() {
.run();
}
#[cargo_test(nightly, reason = "requires -Zchecksum-hash-algorithm")]
fn checksum_build_compatible_with_mtime_build() {
let p = project()
.file("src/main.rs", "mod a; fn main() {}")
.file("src/a.rs", "")
.build();
p.cargo("check -Zchecksum-freshness")
.masquerade_as_nightly_cargo(&["checksum-freshness"])
.with_stderr_data(str![[r#"
[CHECKING] foo v0.0.1 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
"#]])
.run();
p.cargo("check")
.with_stderr_data(str![[r#"
[CHECKING] foo v0.0.1 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
"#]])
.run();
p.cargo("check -Zchecksum-freshness")
.masquerade_as_nightly_cargo(&["checksum-freshness"])
.with_stderr_data(str![[r#"
[CHECKING] foo v0.0.1 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
"#]])
.run();
p.cargo("check")
.with_stderr_data(str![[r#"
[CHECKING] foo v0.0.1 ([ROOT]/foo)
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
"#]])
.run();
}
#[cargo_test(nightly, reason = "requires -Zchecksum-hash-algorithm")]
fn same_size_different_content() {
let p = project()