Skip to content

Commit 047dc18

Browse files
committed
Auto merge of #13143 - ChrisDenton:test-changes, r=weihanglo
Don't rely on mtime to test changes ### What does this PR try to resolve? Fixes #13139 by making sure tests aren't relying on changing the mtime alone ### How should we test and review this PR? The pattern to watch out for is when a file is created with empty contents, e.g. `.file("foo", "")`, then later the same file updated with empty contents, e.g. `.change_file("foo", "")`. Tests should be making an actual change to the contents.
2 parents a1449ee + 4ef503f commit 047dc18

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

tests/testsuite/build_script.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3471,7 +3471,7 @@ fn rebuild_only_on_explicit_paths() {
34713471

34723472
// random other files do not affect freshness
34733473
println!("run baz");
3474-
p.change_file("baz", "");
3474+
p.change_file("baz", "// modified");
34753475
p.cargo("build -v")
34763476
.with_stderr(
34773477
"\
@@ -3483,7 +3483,7 @@ fn rebuild_only_on_explicit_paths() {
34833483

34843484
// but changing dependent files does
34853485
println!("run foo change");
3486-
p.change_file("foo", "");
3486+
p.change_file("foo", "// modified");
34873487
p.cargo("build -v")
34883488
.with_stderr(
34893489
"\

tests/testsuite/build_script_env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn rerun_if_env_or_file_changes() {
9696
.with_stderr("[FINISHED] [..]")
9797
.run();
9898
sleep_ms(1000);
99-
p.change_file("foo", "");
99+
p.change_file("foo", "// modified");
100100
p.cargo("check")
101101
.env("FOO", "bar")
102102
.with_stderr(

tests/testsuite/freshness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ fn bust_patched_dep() {
15221522
sleep_ms(1000);
15231523
}
15241524

1525-
p.change_file("reg1new/src/lib.rs", "");
1525+
p.change_file("reg1new/src/lib.rs", "// modified");
15261526
if is_coarse_mtime() {
15271527
sleep_ms(1000);
15281528
}

0 commit comments

Comments
 (0)