Skip to content

Commit cd958e5

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

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

tests/run-pass/fs.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33

44
use std::fs::{File, remove_file, metadata};
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 = 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)