Fix tests on aarch64

Summary: Gets all tests in `reverie-process` successfully working on aarch64.

Reviewed By: VladimirMakaev

Differential Revision: D40867425

fbshipit-source-id: 4aa7b0be17a40f677baf5de312a0765f8c41c2a4
This commit is contained in:
Jason White 2022-11-01 10:11:35 -07:00 committed by Facebook GitHub Bot
parent 10b3d0df9f
commit 2346c73d2c
3 changed files with 34 additions and 1 deletions

View file

@ -1008,6 +1008,7 @@ mod tests {
);
}
#[cfg(target_arch = "x86_64")]
#[test]
pub fn pin_affinity_to_all_cores() -> Result<(), Error> {
use std::collections::HashMap;

View file

@ -457,7 +457,7 @@ mod tests {
let filter = seccomp_bpf![
VALIDATE_ARCH(AUDIT_ARCH_X86_64),
LOAD_SYSCALL_NR,
SYSCALL(Sysno::open, DENY),
SYSCALL(Sysno::openat, DENY),
SYSCALL(Sysno::close, DENY),
SYSCALL(Sysno::write, DENY),
SYSCALL(Sysno::read, DENY),

View file

@ -315,6 +315,7 @@ impl FilterBuilder {
mod tests {
use super::*;
#[cfg(target_arch = "x86_64")]
#[test]
fn smoke() {
assert_eq!(
@ -322,6 +323,8 @@ mod tests {
.default_action(Action::Allow)
.target_arch(TargetArch::x86_64)
.syscalls([
// NOTE: Different architectures will have a different order
// to the syscalls.
(Sysno::read, Action::KillThread),
(Sysno::write, Action::KillThread),
(Sysno::open, Action::KillThread),
@ -340,4 +343,33 @@ mod tests {
]
);
}
#[cfg(target_arch = "aarch64")]
#[test]
fn smoke() {
assert_eq!(
FilterBuilder::new()
.default_action(Action::Allow)
.target_arch(TargetArch::aarch64)
.syscalls([
// NOTE: Different architectures will have a different order
// to the syscalls.
(Sysno::read, Action::KillThread),
(Sysno::write, Action::KillThread),
(Sysno::openat, Action::KillThread),
(Sysno::close, Action::KillThread),
(Sysno::write, Action::KillThread),
])
.build(),
seccomp_bpf![
VALIDATE_ARCH(AUDIT_ARCH_AARCH64),
LOAD_SYSCALL_NR,
SYSCALL(Sysno::openat, DENY),
SYSCALL(Sysno::close, DENY),
SYSCALL(Sysno::read, DENY),
SYSCALL(Sysno::write, DENY),
ALLOW,
]
);
}
}