MCPcopy Create free account
hub / github.com/elast0ny/shared_memory / open_os_id

Function open_os_id

tests/general.rs:41–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39
40#[test]
41fn open_os_id() {
42 let s1 = ShmemConf::new().size(4090).create().unwrap();
43
44 // Open with the unique os id
45 let os_id = s1.get_os_id().to_string();
46 let mut s2 = ShmemConf::new().os_id(&os_id).open().unwrap();
47
48 assert!(!s2.is_owner());
49 assert!(!s2.get_os_id().is_empty());
50 assert!(s2.len() >= 4090);
51 assert!(!s2.as_ptr().is_null());
52 unsafe {
53 assert_eq!(s2.as_slice().len(), s2.len());
54 assert_eq!(s2.as_slice_mut().len(), s2.len());
55 }
56
57 // Drop the owner of the mapping
58 drop(s1);
59
60 // Make sure it can be openned again
61 assert!(ShmemConf::new().os_id(&os_id).open().is_err());
62
63 drop(s2);
64}
65
66#[test]
67fn open_flink() {

Callers

nothing calls this directly

Calls 5

createMethod · 0.80
sizeMethod · 0.80
get_os_idMethod · 0.80
openMethod · 0.80
os_idMethod · 0.80

Tested by

no test coverage detected