Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Dec 11, 2024
1 parent ca11b51 commit 3bc60a8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions test/sys/test_mman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,18 @@ fn test_madv_wipeonfork() {
let _m = crate::FORK_MTX.lock();

unsafe {
if let ForkResult::Child = fork().expect("fork failed") {
// that s the while point of MADV_WIPEONFORK
assert_eq!(slice[ONE_K - 1], 0x00);
let res = fork().expect("fork failed");
match res {
ForkResult::Child => {
// that s the whole point of MADV_WIPEONFORK
assert_eq!(slice[ONE_K - 1], 0x00);
libc::_exit(0);
}
ForkResult::Parent { child } => {
nix::sys::signal::kill(child, nix::sys::signal::SIGTERM)
.unwrap();
let _ = nix::sys::wait::wait().unwrap();
}
}
}
}

0 comments on commit 3bc60a8

Please sign in to comment.