From c1057ecf7100ecc9c95c50666810d6762cf2a251 Mon Sep 17 00:00:00 2001 From: Marco Mastropaolo Date: Thu, 2 Mar 2023 18:24:30 +0100 Subject: [PATCH] Fixed unit tests under macOS and possibly other *nix flavors - Optional use of SOCK_CLOEXEC on platforms that do not support the flag - Fixed Path constructor usage in macOS tests --- gio/src/socket.rs | 7 +------ glib/src/translate.rs | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/gio/src/socket.rs b/gio/src/socket.rs index 391c25c9de3f..dc55002d2d13 100644 --- a/gio/src/socket.rs +++ b/gio/src/socket.rs @@ -925,12 +925,7 @@ mod tests { let mut fds = [0 as libc::c_int; 2]; let (out_sock, in_sock) = unsafe { - let ret = libc::socketpair( - libc::AF_UNIX, - libc::SOCK_STREAM | libc::SOCK_CLOEXEC, - 0, - fds.as_mut_ptr(), - ); + let ret = libc::socketpair(libc::AF_UNIX, libc::SOCK_STREAM, 0, fds.as_mut_ptr()); if ret != 0 { panic!("{}", io::Error::last_os_error()); } diff --git a/glib/src/translate.rs b/glib/src/translate.rs index bceccc25c1a4..760be8115a59 100644 --- a/glib/src/translate.rs +++ b/glib/src/translate.rs @@ -2812,10 +2812,10 @@ mod tests { // gives us useful results let dir_1 = tmp_dir.join("abcd"); fs::create_dir(&dir_1).unwrap(); - assert_eq!(crate::path_get_basename(&dir_1), Path::from("abcd")); + assert_eq!(crate::path_get_basename(&dir_1), Path::new("abcd")); assert_eq!( crate::path_get_basename(dir_1.canonicalize().unwrap()), - Path::from("abcd") + Path::new("abcd") ); assert_eq!( crate::path_get_dirname(dir_1.canonicalize().unwrap()),