add with_timeout constructor for Observer
This commit is contained in:
parent
ae9486814e
commit
ff759e2ca7
@ -71,11 +71,7 @@ where
|
||||
#[inline]
|
||||
fn run_target(&mut self, input: &I) -> Result<ExitKind, Error> {
|
||||
let bytes = input.target_bytes();
|
||||
|
||||
|
||||
let ret = (self.harness_fn)(self, bytes.as_slice());
|
||||
|
||||
|
||||
#[cfg(unix)]
|
||||
unsafe {
|
||||
write_volatile(
|
||||
|
@ -128,6 +128,15 @@ impl TimeObserver {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_timeout(name: &'static str, tmout: u64) -> Self {
|
||||
Self {
|
||||
name: name.to_string(),
|
||||
start_time: Duration::from_secs(0),
|
||||
last_runtime: None,
|
||||
exec_tmout: Some(Duration::from_secs(tmout)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn last_runtime(&self) -> &Option<Duration> {
|
||||
&self.last_runtime
|
||||
}
|
||||
@ -135,7 +144,6 @@ impl TimeObserver {
|
||||
|
||||
impl Observer for TimeObserver {
|
||||
fn pre_exec(&mut self) -> Result<(), Error> {
|
||||
|
||||
#[cfg(unix)]
|
||||
match self.exec_tmout {
|
||||
Some(exec_tmout) => unsafe {
|
||||
|
Loading…
x
Reference in New Issue
Block a user