From 753e57672296e13c534f87b6e2672a73fff4965c Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Wed, 11 Jan 2023 17:05:15 +0000 Subject: 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 --- src/tools/miri/tests/pass-dep/shims/libc-fs-with-isolation.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/tools') diff --git a/src/tools/miri/tests/pass-dep/shims/libc-fs-with-isolation.rs b/src/tools/miri/tests/pass-dep/shims/libc-fs-with-isolation.rs index f1838cf64f7..d6d19a3fe81 100644 --- a/src/tools/miri/tests/pass-dep/shims/libc-fs-with-isolation.rs +++ b/src/tools/miri/tests/pass-dep/shims/libc-fs-with-isolation.rs @@ -22,7 +22,8 @@ fn main() { } // test `stat` - assert_eq!(fs::metadata("foo.txt").unwrap_err().kind(), ErrorKind::PermissionDenied); + let err = fs::metadata("foo.txt").unwrap_err(); + assert_eq!(err.kind(), ErrorKind::PermissionDenied); // check that it is the right kind of `PermissionDenied` - assert_eq!(Error::last_os_error().raw_os_error(), Some(libc::EACCES)); + assert_eq!(err.raw_os_error(), Some(libc::EACCES)); } -- cgit 1.4.1-3-g733a5