Skip to content

Commit c0e550e

Browse files
Xaeroxeweihanglo
authored andcommitted
test(freshness_checksum): different fingeprint methods are compatible
This ensures that users can switch between different fingerprint freshness methods and still correctly rebuild stuff.
1 parent 0d08e19 commit c0e550e

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/testsuite/freshness_checksum.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,45 @@ fn checksum_actually_uses_checksum() {
5353
.run();
5454
}
5555

56+
#[cargo_test(nightly, reason = "requires -Zchecksum-hash-algorithm")]
57+
fn checksum_build_compatible_with_mtime_build() {
58+
let p = project()
59+
.file("src/main.rs", "mod a; fn main() {}")
60+
.file("src/a.rs", "")
61+
.build();
62+
63+
p.cargo("check -Zchecksum-freshness")
64+
.masquerade_as_nightly_cargo(&["checksum-freshness"])
65+
.with_stderr_data(str![[r#"
66+
[CHECKING] foo v0.0.1 ([ROOT]/foo)
67+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
68+
69+
"#]])
70+
.run();
71+
p.cargo("check")
72+
.with_stderr_data(str![[r#"
73+
[CHECKING] foo v0.0.1 ([ROOT]/foo)
74+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
75+
76+
"#]])
77+
.run();
78+
p.cargo("check -Zchecksum-freshness")
79+
.masquerade_as_nightly_cargo(&["checksum-freshness"])
80+
.with_stderr_data(str![[r#"
81+
[CHECKING] foo v0.0.1 ([ROOT]/foo)
82+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
83+
84+
"#]])
85+
.run();
86+
p.cargo("check")
87+
.with_stderr_data(str![[r#"
88+
[CHECKING] foo v0.0.1 ([ROOT]/foo)
89+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
90+
91+
"#]])
92+
.run();
93+
}
94+
5695
#[cargo_test(nightly, reason = "requires -Zchecksum-hash-algorithm")]
5796
fn same_size_different_content() {
5897
let p = project()

0 commit comments

Comments
 (0)