in reverie-syscalls/src/syscalls/mod.rs [3310:3365]
fn test_syscall_openat() {
assert_eq!(Openat::NAME, "openat");
assert_eq!(Openat::NUMBER, Sysno::openat);
let memory = LocalMemory::new();
assert_eq!(
format!(
"{}",
Openat::new()
.with_dirfd(-100)
.with_path(None)
.with_flags(OFlag::O_APPEND)
.display(&memory)
),
"openat(-100, NULL, O_APPEND)"
);
assert_eq!(
format!(
"{}",
Openat::new()
.with_dirfd(-100)
.with_path(None)
.with_flags(OFlag::O_CREAT)
.with_mode(Mode::from_bits_truncate(0o644))
.display(&memory)
),
"openat(-100, NULL, O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)"
);
assert_eq!(
format!(
"{}",
Openat::new()
.with_dirfd(-100)
.with_path(None)
.with_flags(OFlag::O_TMPFILE)
.with_mode(Mode::from_bits_truncate(0o600))
.display(&memory)
),
"openat(-100, NULL, O_DIRECTORY | O_TMPFILE, S_IRUSR | S_IWUSR)"
);
assert_eq!(
Openat::new()
.with_dirfd(libc::AT_FDCWD)
.with_path(None)
.with_flags(OFlag::O_CREAT | OFlag::O_WRONLY | OFlag::O_TRUNC)
.with_mode(Mode::from_bits_truncate(0o600)),
Creat::new()
.with_path(None)
.with_mode(Mode::from_bits_truncate(0o600))
.into()
);
}