| 39 | |
| 40 | #[test] |
| 41 | fn 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] |
| 67 | fn open_flink() { |