summaryrefslogtreecommitdiffstats
path: root/src/tools/cargo/tests/testsuite/freshness.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /src/tools/cargo/tests/testsuite/freshness.rs
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/cargo/tests/testsuite/freshness.rs')
-rw-r--r--src/tools/cargo/tests/testsuite/freshness.rs62
1 files changed, 61 insertions, 1 deletions
diff --git a/src/tools/cargo/tests/testsuite/freshness.rs b/src/tools/cargo/tests/testsuite/freshness.rs
index 86b186af8..f28f1ff46 100644
--- a/src/tools/cargo/tests/testsuite/freshness.rs
+++ b/src/tools/cargo/tests/testsuite/freshness.rs
@@ -14,7 +14,8 @@ use super::death;
use cargo_test_support::paths::{self, CargoPathExt};
use cargo_test_support::registry::Package;
use cargo_test_support::{
- basic_manifest, is_coarse_mtime, project, rustc_host, rustc_host_env, sleep_ms,
+ basic_lib_manifest, basic_manifest, is_coarse_mtime, project, rustc_host, rustc_host_env,
+ sleep_ms,
};
#[cargo_test]
@@ -2814,3 +2815,62 @@ directory sources are not [..]
)
.run();
}
+
+#[cargo_test]
+fn skip_mtime_check_in_selected_cargo_home_subdirs() {
+ let p = project()
+ .at("cargo_home/registry/foo")
+ .file("Cargo.toml", &basic_lib_manifest("foo"))
+ .file("src/lib.rs", "")
+ .build();
+ let project_root = p.root();
+ let cargo_home = project_root.parent().unwrap().parent().unwrap();
+ p.cargo("check -v")
+ .env("CARGO_HOME", &cargo_home)
+ .with_stderr(
+ "\
+[CHECKING] foo v0.5.0 ([CWD])
+[RUNNING] `rustc --crate-name foo src/lib.rs [..]
+[FINISHED] dev [..]",
+ )
+ .run();
+ p.change_file("src/lib.rs", "illegal syntax");
+ p.cargo("check -v")
+ .env("CARGO_HOME", &cargo_home)
+ .with_stderr(
+ "\
+[FRESH] foo v0.5.0 ([CWD])
+[FINISHED] dev [..]",
+ )
+ .run();
+}
+
+#[cargo_test]
+fn use_mtime_cache_in_cargo_home() {
+ let p = project()
+ .at("cargo_home/foo")
+ .file("Cargo.toml", &basic_lib_manifest("foo"))
+ .file("src/lib.rs", "")
+ .build();
+ let project_root = p.root();
+ let cargo_home = project_root.parent().unwrap();
+ p.cargo("check -v")
+ .env("CARGO_HOME", &cargo_home)
+ .with_stderr(
+ "\
+[CHECKING] foo v0.5.0 ([CWD])
+[RUNNING] `rustc --crate-name foo src/lib.rs [..]
+[FINISHED] dev [..]",
+ )
+ .run();
+ p.change_file("src/lib.rs", "illegal syntax");
+ p.cargo("check -v")
+ .env("CARGO_HOME", &cargo_home)
+ .with_stderr(
+ "\
+[DIRTY] foo v0.5.0 ([CWD]): [..]
+[CHECKING] foo v0.5.0 ([CWD])
+[RUNNING] `rustc --crate-name foo src/lib.rs [..]",
+ )
+ .run_expect_error();
+}