From 6db68970eee12446f38e3f0d12b386980e538ef7 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sun, 23 Jun 2024 23:59:39 +0100 Subject: [PATCH] bolts: haiku build fix. (#2335) --- libafl_bolts/src/os/unix_signals.rs | 2 +- libafl_bolts/src/staterestore.rs | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/libafl_bolts/src/os/unix_signals.rs b/libafl_bolts/src/os/unix_signals.rs index 12d62f6604..57f938e712 100644 --- a/libafl_bolts/src/os/unix_signals.rs +++ b/libafl_bolts/src/os/unix_signals.rs @@ -506,7 +506,7 @@ pub unsafe fn setup_signal_handler(handler: *mut T) -> Res #[inline(always)] pub fn ucontext() -> Result { let mut ucontext = unsafe { mem::zeroed() }; - if cfg!(not(target_os = "openbsd")) { + if cfg!(not(any(target_os = "openbsd", target_os = "haiku"))) { if unsafe { getcontext(&mut ucontext) } == 0 { Ok(ucontext) } else { diff --git a/libafl_bolts/src/staterestore.rs b/libafl_bolts/src/staterestore.rs index bbebe44dff..407a403d52 100644 --- a/libafl_bolts/src/staterestore.rs +++ b/libafl_bolts/src/staterestore.rs @@ -285,22 +285,24 @@ where #[cfg(test)] mod tests { - use alloc::{ - string::{String, ToString}, - vec::Vec, - }; - + #[cfg(not(target_os = "haiku"))] use serial_test::serial; - use crate::{ - shmem::{ShMemProvider, StdShMemProvider}, - staterestore::StateRestorer, - }; - #[test] #[serial] #[cfg_attr(miri, ignore)] + #[cfg(not(target_os = "haiku"))] fn test_state_restore() { + use alloc::{ + string::{String, ToString}, + vec::Vec, + }; + + use crate::{ + shmem::{ShMemProvider, StdShMemProvider}, + staterestore::StateRestorer, + }; + const TESTMAP_SIZE: usize = 1024; let mut shmem_provider = StdShMemProvider::new().unwrap();