about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-10-18 10:54:53 +0000
committerbors <bors@rust-lang.org>2022-10-18 10:54:53 +0000
commit21b246587c2687935bd6004ffa5dcc4f4dd6600d (patch)
tree0b7347a252d987b16b179fa2e494361642e68583 /src
parente0f8e60dddfecfc9093ee9d9f42557d8260c0355 (diff)
parent727335878d316f6301780d182ea14ec4fb32531d (diff)
downloadrust-21b246587c2687935bd6004ffa5dcc4f4dd6600d.tar.gz
rust-21b246587c2687935bd6004ffa5dcc4f4dd6600d.zip
Auto merge of #103075 - SUPERCILEX:miri-metadata, r=thomcc
Support DirEntry metadata calls in miri

This should work as it uses lstat64 which is supported here: ~https://github.com/rust-lang/miri/blob/d9ad25ee4bbd9364c498959cdc82b5fa6c41e63c/src/shims/unix/macos/foreign_items.rs#L42~ just noticed that's macos, linux would be using statx: https://github.com/rust-lang/miri/blob/86f0e63b21721fe2c14608644f467b9cb21945eb/src/shims/unix/linux/foreign_items.rs#L112

The failing syscall is `dirfd`, so maybe that should actually be added to the shims?
Diffstat (limited to 'src')
-rw-r--r--src/tools/miri/tests/pass-dep/shims/fs.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/tools/miri/tests/pass-dep/shims/fs.rs b/src/tools/miri/tests/pass-dep/shims/fs.rs
index 9faced02916..e2a1d14f740 100644
--- a/src/tools/miri/tests/pass-dep/shims/fs.rs
+++ b/src/tools/miri/tests/pass-dep/shims/fs.rs
@@ -404,6 +404,14 @@ fn test_directory() {
     let mut file_names = dir_iter.map(|e| e.unwrap().file_name()).collect::<Vec<_>>();
     file_names.sort_unstable();
     assert_eq!(file_names, vec!["test_file_1", "test_file_2"]);
+    // Test that read_dir metadata calls succeed
+    assert_eq!(
+        &[true, true],
+        &*read_dir(&dir_path)
+            .unwrap()
+            .map(|e| e.unwrap().metadata().unwrap().is_file())
+            .collect::<Vec<_>>()
+    );
     // Deleting the directory should fail, since it is not empty.
     assert_eq!(ErrorKind::DirectoryNotEmpty, remove_dir(&dir_path).unwrap_err().kind());
     // Clean up the files in the directory