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

Function test_unix_msg

tests/net/unix_alloc.rs:369–389  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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