mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
virtio-devices: Custom 'EpollHelper::run_with_timeout' for fuzz
To support all virtio-devices, this patch replaces the customized EpollHelper::run` with customized `EpollHelper::run_with_timeout` for fuzzing. Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
683491a955
commit
cfafc85b9c
@ -148,7 +148,6 @@ impl EpollHelper {
|
|||||||
.map_err(EpollHelperError::Ctl)
|
.map_err(EpollHelperError::Ctl)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(fuzzing))]
|
|
||||||
pub fn run(
|
pub fn run(
|
||||||
&mut self,
|
&mut self,
|
||||||
paused: Arc<AtomicBool>,
|
paused: Arc<AtomicBool>,
|
||||||
@ -158,6 +157,7 @@ impl EpollHelper {
|
|||||||
self.run_with_timeout(paused, paused_sync, handler, -1, false)
|
self.run_with_timeout(paused, paused_sync, handler, -1, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(fuzzing))]
|
||||||
pub fn run_with_timeout(
|
pub fn run_with_timeout(
|
||||||
&mut self,
|
&mut self,
|
||||||
paused: Arc<AtomicBool>,
|
paused: Arc<AtomicBool>,
|
||||||
@ -245,11 +245,13 @@ impl EpollHelper {
|
|||||||
#[cfg(fuzzing)]
|
#[cfg(fuzzing)]
|
||||||
// Require to have a 'queue_evt' being kicked before calling
|
// Require to have a 'queue_evt' being kicked before calling
|
||||||
// and return when no epoll events are active
|
// and return when no epoll events are active
|
||||||
pub fn run(
|
pub fn run_with_timeout(
|
||||||
&mut self,
|
&mut self,
|
||||||
paused: Arc<AtomicBool>,
|
paused: Arc<AtomicBool>,
|
||||||
paused_sync: Arc<Barrier>,
|
paused_sync: Arc<Barrier>,
|
||||||
handler: &mut dyn EpollHelperHandler,
|
handler: &mut dyn EpollHelperHandler,
|
||||||
|
_timeout: i32,
|
||||||
|
_enable_event_list: bool,
|
||||||
) -> std::result::Result<(), EpollHelperError> {
|
) -> std::result::Result<(), EpollHelperError> {
|
||||||
const EPOLL_EVENTS_LEN: usize = 100;
|
const EPOLL_EVENTS_LEN: usize = 100;
|
||||||
let mut events = vec![epoll::Event::new(epoll::Events::empty(), 0); EPOLL_EVENTS_LEN];
|
let mut events = vec![epoll::Event::new(epoll::Events::empty(), 0); EPOLL_EVENTS_LEN];
|
||||||
|
Loading…
Reference in New Issue
Block a user