()
| 32 | #[cfg(not(target_os = "redox"))] |
| 33 | #[test] |
| 34 | fn test_linkat() { |
| 35 | use rustix::fs::{linkat, openat, readlinkat, statat, AtFlags, Mode, OFlags, CWD}; |
| 36 | |
| 37 | let tmp = tempfile::tempdir().unwrap(); |
| 38 | let dir = openat(CWD, tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap(); |
| 39 | |
| 40 | let _ = openat(&dir, "file", OFlags::CREATE | OFlags::WRONLY, Mode::RUSR).unwrap(); |
| 41 | |
| 42 | linkat(&dir, "file", &dir, "link", AtFlags::empty()).unwrap(); |
| 43 | |
| 44 | readlinkat(&dir, "file", Vec::new()).unwrap_err(); |
| 45 | readlinkat(&dir, "link", Vec::new()).unwrap_err(); |
| 46 | |
| 47 | assert_eq!( |
| 48 | statat(&dir, "file", AtFlags::empty()).unwrap().st_ino, |
| 49 | statat(&dir, "link", AtFlags::empty()).unwrap().st_ino |
| 50 | ); |
| 51 | |
| 52 | linkat(&dir, "link", &dir, "another", AtFlags::empty()).unwrap(); |
| 53 | |
| 54 | assert_eq!( |
| 55 | statat(&dir, "file", AtFlags::empty()).unwrap().st_ino, |
| 56 | statat(&dir, "another", AtFlags::empty()).unwrap().st_ino |
| 57 | ); |
| 58 | } |
nothing calls this directly
no test coverage detected