MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / test_unix_msg

Function test_unix_msg

tests/net/unix.rs:372–392  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

370#[cfg(not(target_os = "freebsd"))] // TODO: Investigate why these tests fail on FreeBSD.
371#[test]
372fn test_unix_msg() {
373 use rustix::ffi::CString;
374 use std::os::unix::ffi::OsStrExt as _;
375
376 crate::init();
377
378 let tmpdir = tempfile::tempdir().unwrap();
379 let path = tmpdir.path().join("scp_4804");
380
381 let name = SocketAddrUnix::new(&path).unwrap();
382 assert_eq!(
383 name.path(),
384 Some(CString::new(path.as_os_str().as_bytes()).unwrap().into())
385 );
386 assert_eq!(name.path_bytes(), Some(path.as_os_str().as_bytes()));
387 #[cfg(linux_kernel)]
388 assert!(!name.is_unnamed());
389 do_test_unix_msg(name);
390
391 unlinkat(CWD, path, AtFlags::empty()).unwrap();
392}
393
394/// Like `test_unix_msg` but tests `do_test_unix_msg_unconnected`.
395#[cfg(not(any(target_os = "espidf", target_os = "redox", target_os = "wasi")))]

Callers

nothing calls this directly

Calls 4

initFunction · 0.70
do_test_unix_msgFunction · 0.70
unlinkatFunction · 0.50
pathMethod · 0.45

Tested by

no test coverage detected