Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add comment and simplify hiberfil_sys test
  • Loading branch information
ChrisDenton committed Jul 5, 2022
commit 2d0650457f570ca3d0d1ff24092e71291155a8a6
11 changes: 6 additions & 5 deletions library/std/src/fs/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1535,13 +1535,14 @@ fn read_large_dir() {
}
}

/// Test the fallback for getting the metadata of files like hiberfil.sys that
/// Windows holds a special lock on, preventing normal means of querying
/// metadata. See #96980.
#[test]
#[cfg(windows)]
fn hiberfil_sys() {
// Get the system drive, which is usually `C:`.
let mut hiberfil = crate::env::var("SystemDrive").unwrap();
hiberfil.push_str(r"\hiberfil.sys");
let hiberfil = r"C:\hiberfil.sys";

fs::metadata(&hiberfil).unwrap();
fs::symlink_metadata(&hiberfil).unwrap();
fs::metadata(hiberfil).unwrap();
fs::symlink_metadata(hiberfil).unwrap();
}