Skip to content

Commit 61272f0

Browse files
committed
Exclude macos from the metadata test
1 parent e6cf5d4 commit 61272f0

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

tests/run-pass/fs.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
// ignore-windows: File handling is not implemented yet
22
// compile-flags: -Zmiri-disable-isolation
33

4-
use std::fs::{File, remove_file, metadata};
4+
use std::fs::{File, remove_file};
55
use std::io::{Read, Write, ErrorKind};
6+
use std::path::Path;
7+
8+
#[cfg(target_os = "linux")]
9+
fn test_metadata(path: &Path, bytes: &[u8]) {
10+
// Test that the file metadata is correct.
11+
let metadata = std::fs::metadata(path).unwrap();
12+
// `path` should point to a file.
13+
assert!(metadata.is_file());
14+
// The size of the file must be equal to the number of written bytes.
15+
assert_eq!(bytes.len() as u64, metadata.len());
16+
}
17+
18+
#[cfg(not(target_os = "linux"))]
19+
fn test_metadata(_path: &Path, _bytes: &[u8]) {}
620

721
fn main() {
822
let path = std::env::temp_dir().join("miri_test_fs.txt");
@@ -22,12 +36,8 @@ fn main() {
2236
file.read_to_end(&mut contents).unwrap();
2337
assert_eq!(bytes, contents.as_slice());
2438

25-
// Test that the file metadata is correct.
26-
let metadata = metadata(&path).unwrap();
27-
// `path` should point to a file.
28-
assert!(metadata.is_file());
29-
// The size of the file must be equal to the number of written bytes.
30-
assert_eq!(bytes.len() as u64, metadata.len());
39+
// FIXME: Implement stat64 for macos.
40+
test_metadata(&path, bytes);
3141

3242
// Removing file should succeed.
3343
remove_file(&path).unwrap();

0 commit comments

Comments
 (0)