Skip to content

Commit 8343fb7

Browse files
committed
test(freshness): remove simple_deps_cleaner_does_not_rebuild
Now that the `mtime` of intermediate artifacts is not updated there's no need for this test anymore (it now fails because without the `mtime`s it cannot perform the intended GC operation).
1 parent 78927e6 commit 8343fb7

File tree

1 file changed

+0
-87
lines changed

1 file changed

+0
-87
lines changed

tests/testsuite/freshness.rs

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,93 +1170,6 @@ fn changing_rustflags_is_cached() {
11701170
.run();
11711171
}
11721172

1173-
fn simple_deps_cleaner(mut dir: PathBuf, timestamp: filetime::FileTime) {
1174-
// Cargo is experimenting with letting outside projects develop some
1175-
// limited forms of GC for target_dir. This is one of the forms.
1176-
// Specifically, Cargo is updating the mtime of files in
1177-
// target/profile/deps each time it uses the file.
1178-
// So a cleaner can remove files older then a time stamp without
1179-
// effecting any builds that happened since that time stamp.
1180-
let mut cleand = false;
1181-
dir.push("deps");
1182-
for dep in fs::read_dir(&dir).unwrap() {
1183-
let dep = dep.unwrap();
1184-
if filetime::FileTime::from_last_modification_time(&dep.metadata().unwrap()) <= timestamp {
1185-
fs::remove_file(dep.path()).unwrap();
1186-
println!("remove: {:?}", dep.path());
1187-
cleand = true;
1188-
}
1189-
}
1190-
assert!(
1191-
cleand,
1192-
"called simple_deps_cleaner, but there was nothing to remove"
1193-
);
1194-
}
1195-
1196-
#[cargo_test]
1197-
fn simple_deps_cleaner_does_not_rebuild() {
1198-
let p = project()
1199-
.file(
1200-
"Cargo.toml",
1201-
r#"
1202-
[package]
1203-
name = "foo"
1204-
version = "0.0.1"
1205-
1206-
[dependencies]
1207-
bar = { path = "bar" }
1208-
"#,
1209-
)
1210-
.file("src/lib.rs", "")
1211-
.file("bar/Cargo.toml", &basic_manifest("bar", "0.0.1"))
1212-
.file("bar/src/lib.rs", "")
1213-
.build();
1214-
1215-
p.cargo("build -Z mtime-on-use")
1216-
.masquerade_as_nightly_cargo()
1217-
.run();
1218-
p.cargo("build -Z mtime-on-use")
1219-
.masquerade_as_nightly_cargo()
1220-
.env("RUSTFLAGS", "-C target-cpu=native")
1221-
.with_stderr(
1222-
"\
1223-
[COMPILING] bar v0.0.1 ([..])
1224-
[COMPILING] foo v0.0.1 ([..])
1225-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]",
1226-
)
1227-
.run();
1228-
if is_coarse_mtime() {
1229-
sleep_ms(1000);
1230-
}
1231-
let timestamp = filetime::FileTime::from_system_time(SystemTime::now());
1232-
if is_coarse_mtime() {
1233-
sleep_ms(1000);
1234-
}
1235-
// This does not make new files, but it does update the mtime.
1236-
p.cargo("build -Z mtime-on-use")
1237-
.masquerade_as_nightly_cargo()
1238-
.env("RUSTFLAGS", "-C target-cpu=native")
1239-
.with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]")
1240-
.run();
1241-
simple_deps_cleaner(p.target_debug_dir(), timestamp);
1242-
// This should not recompile!
1243-
p.cargo("build -Z mtime-on-use")
1244-
.masquerade_as_nightly_cargo()
1245-
.env("RUSTFLAGS", "-C target-cpu=native")
1246-
.with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]")
1247-
.run();
1248-
// But this should be cleaned and so need a rebuild
1249-
p.cargo("build -Z mtime-on-use")
1250-
.masquerade_as_nightly_cargo()
1251-
.with_stderr(
1252-
"\
1253-
[COMPILING] bar v0.0.1 ([..])
1254-
[COMPILING] foo v0.0.1 ([..])
1255-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]",
1256-
)
1257-
.run();
1258-
}
1259-
12601173
#[cargo_test]
12611174
fn update_dependency_mtime_does_not_rebuild() {
12621175
let p = project()

0 commit comments

Comments
 (0)