Skip to content

Commit 31b3e9a

Browse files
author
Alexandra Iordache
committed
vmm: fix test_signal_handler
This test fails intermittently when linked against glibc. Glibc's getpid() caches the result, so it doesn't always do the syscall. To avoid GNU-related complications, the test now forces a different syscall (mkdir) - as getpid will be needed in a later commit. Signed-off-by: Alexandra Iordache <[email protected]>
1 parent 51d7d25 commit 31b3e9a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

vmm/src/sigsys_handler.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,8 @@ mod tests {
8888
use super::*;
8989

9090
use std::mem;
91-
use std::process;
9291

93-
use libc::cpu_set_t;
92+
use libc::{cpu_set_t, syscall};
9493

9594
use seccomp::{allow_syscall, SeccompAction, SeccompFilter};
9695

@@ -144,8 +143,8 @@ mod tests {
144143
assert!(filter.apply().is_ok());
145144
assert_eq!(METRICS.seccomp.num_faults.count(), 0);
146145

147-
// Calls the blacklisted SYS_getpid.
148-
let _pid = process::id();
146+
// Call the blacklisted `SYS_mkdir`.
147+
unsafe { syscall(libc::SYS_mkdir, "/foo/bar\0") };
149148

150149
assert!(cpu_count() > 0);
151150

0 commit comments

Comments
 (0)