Skip to content

Commit 753e576

Browse files
committed
Fix up stat test in libc-fs-with-isolation
The test relied on Error::last_os_error() coming from the stat call on the passed file, but there is no guarantee this will be the case. Instead extract errno from the error returned by the routine. Patch de facto written by joboet. Co-authored-by: joboet <[email protected]>
1 parent 3254bef commit 753e576

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/tools/miri/tests/pass-dep/shims/libc-fs-with-isolation.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ fn main() {
2222
}
2323

2424
// test `stat`
25-
assert_eq!(fs::metadata("foo.txt").unwrap_err().kind(), ErrorKind::PermissionDenied);
25+
let err = fs::metadata("foo.txt").unwrap_err();
26+
assert_eq!(err.kind(), ErrorKind::PermissionDenied);
2627
// check that it is the right kind of `PermissionDenied`
27-
assert_eq!(Error::last_os_error().raw_os_error(), Some(libc::EACCES));
28+
assert_eq!(err.raw_os_error(), Some(libc::EACCES));
2829
}

0 commit comments

Comments
 (0)