Latest fmt (#1339)
This commit is contained in:
parent
07047cb3bb
commit
6f4955619a
@ -45,7 +45,9 @@ fn adder_loop(port: u16) -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
loop {
|
loop {
|
||||||
let mut msg_counter = 0;
|
let mut msg_counter = 0;
|
||||||
loop {
|
loop {
|
||||||
let Some((sender, tag, buf)) = client.recv_buf()? else { break };
|
let Some((sender, tag, buf)) = client.recv_buf()? else {
|
||||||
|
break;
|
||||||
|
};
|
||||||
msg_counter += 1;
|
msg_counter += 1;
|
||||||
match tag {
|
match tag {
|
||||||
_TAG_SIMPLE_U32_V1 => {
|
_TAG_SIMPLE_U32_V1 => {
|
||||||
|
@ -3045,11 +3045,12 @@ where
|
|||||||
let TcpResponse::BrokerConnectHello {
|
let TcpResponse::BrokerConnectHello {
|
||||||
broker_shmem_description,
|
broker_shmem_description,
|
||||||
hostname: _,
|
hostname: _,
|
||||||
} = recv_tcp_msg(&mut stream)?.try_into()? else {
|
} = recv_tcp_msg(&mut stream)?.try_into()?
|
||||||
|
else {
|
||||||
return Err(Error::illegal_state(
|
return Err(Error::illegal_state(
|
||||||
"Received unexpected Broker Hello".to_string(),
|
"Received unexpected Broker Hello".to_string(),
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
let map = LlmpSharedMap::existing(
|
let map = LlmpSharedMap::existing(
|
||||||
shmem_provider.shmem_from_description(broker_shmem_description)?,
|
shmem_provider.shmem_from_description(broker_shmem_description)?,
|
||||||
@ -3064,11 +3065,13 @@ where
|
|||||||
|
|
||||||
send_tcp_msg(&mut stream, &client_hello_req)?;
|
send_tcp_msg(&mut stream, &client_hello_req)?;
|
||||||
|
|
||||||
let TcpResponse::LocalClientAccepted { client_id } = recv_tcp_msg(&mut stream)?.try_into()? else {
|
let TcpResponse::LocalClientAccepted { client_id } =
|
||||||
return Err(Error::illegal_state(
|
recv_tcp_msg(&mut stream)?.try_into()?
|
||||||
"Unexpected Response from Broker".to_string(),
|
else {
|
||||||
|
return Err(Error::illegal_state(
|
||||||
|
"Unexpected Response from Broker".to_string(),
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set our ID to the one the broker sent us..
|
// Set our ID to the one the broker sent us..
|
||||||
// This is mainly so we can filter out our own msgs later.
|
// This is mainly so we can filter out our own msgs later.
|
||||||
|
@ -353,9 +353,11 @@ impl Drop for ShMemServiceThread {
|
|||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if self.join_handle.is_some() {
|
if self.join_handle.is_some() {
|
||||||
log::info!("Stopping ShMemService");
|
log::info!("Stopping ShMemService");
|
||||||
let Ok(mut stream) = UnixStream::connect_to_unix_addr(
|
let Ok(mut stream) =
|
||||||
&UnixSocketAddr::new(UNIX_SERVER_NAME).unwrap(),
|
UnixStream::connect_to_unix_addr(&UnixSocketAddr::new(UNIX_SERVER_NAME).unwrap())
|
||||||
) else { return };
|
else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
let body = postcard::to_allocvec(&ServedShMemRequest::Exit).unwrap();
|
let body = postcard::to_allocvec(&ServedShMemRequest::Exit).unwrap();
|
||||||
|
|
||||||
|
@ -144,7 +144,9 @@ where
|
|||||||
fn load_input_into(&self, testcase: &mut Testcase<Self::Input>) -> Result<(), Error> {
|
fn load_input_into(&self, testcase: &mut Testcase<Self::Input>) -> Result<(), Error> {
|
||||||
if testcase.input_mut().is_none() {
|
if testcase.input_mut().is_none() {
|
||||||
let Some(file_path) = testcase.file_path().as_ref() else {
|
let Some(file_path) = testcase.file_path().as_ref() else {
|
||||||
return Err(Error::illegal_argument("No file path set for testcase. Could not load inputs."));
|
return Err(Error::illegal_argument(
|
||||||
|
"No file path set for testcase. Could not load inputs.",
|
||||||
|
));
|
||||||
};
|
};
|
||||||
let input = I::from_file(file_path)?;
|
let input = I::from_file(file_path)?;
|
||||||
testcase.set_input(input);
|
testcase.set_input(input);
|
||||||
@ -155,10 +157,14 @@ where
|
|||||||
fn store_input_from(&self, testcase: &Testcase<Self::Input>) -> Result<(), Error> {
|
fn store_input_from(&self, testcase: &Testcase<Self::Input>) -> Result<(), Error> {
|
||||||
// Store the input to disk
|
// Store the input to disk
|
||||||
let Some(file_path) = testcase.file_path() else {
|
let Some(file_path) = testcase.file_path() else {
|
||||||
return Err(Error::illegal_argument("No file path set for testcase. Could not store input to disk."));
|
return Err(Error::illegal_argument(
|
||||||
|
"No file path set for testcase. Could not store input to disk.",
|
||||||
|
));
|
||||||
};
|
};
|
||||||
let Some(input) = testcase.input() else {
|
let Some(input) = testcase.input() else {
|
||||||
return Err(Error::illegal_argument("No input available for testcase. Could not store anything."));
|
return Err(Error::illegal_argument(
|
||||||
|
"No input available for testcase. Could not store anything.",
|
||||||
|
));
|
||||||
};
|
};
|
||||||
input.to_file(file_path)
|
input.to_file(file_path)
|
||||||
}
|
}
|
||||||
|
@ -566,9 +566,9 @@ impl CommandExecutorBuilder {
|
|||||||
S: UsesInput,
|
S: UsesInput,
|
||||||
{
|
{
|
||||||
let Some(program) = &self.program else {
|
let Some(program) = &self.program else {
|
||||||
return Err(Error::illegal_argument(
|
return Err(Error::illegal_argument(
|
||||||
"CommandExecutor::builder: no program set!",
|
"CommandExecutor::builder: no program set!",
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut command = Command::new(program);
|
let mut command = Command::new(program);
|
||||||
|
@ -330,11 +330,11 @@ impl Forkserver {
|
|||||||
pub fn read_st_timed(&mut self, timeout: &TimeSpec) -> Result<Option<i32>, Error> {
|
pub fn read_st_timed(&mut self, timeout: &TimeSpec) -> Result<Option<i32>, Error> {
|
||||||
let mut buf: [u8; 4] = [0_u8; 4];
|
let mut buf: [u8; 4] = [0_u8; 4];
|
||||||
let Some(st_read) = self.st_pipe.read_end() else {
|
let Some(st_read) = self.st_pipe.read_end() else {
|
||||||
return Err(Error::file(io::Error::new(
|
return Err(Error::file(io::Error::new(
|
||||||
ErrorKind::BrokenPipe,
|
ErrorKind::BrokenPipe,
|
||||||
"Read pipe end was already closed",
|
"Read pipe end was already closed",
|
||||||
)));
|
)));
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut readfds = FdSet::new();
|
let mut readfds = FdSet::new();
|
||||||
readfds.insert(st_read);
|
readfds.insert(st_read);
|
||||||
|
@ -169,13 +169,17 @@ impl Tokens {
|
|||||||
if line.is_empty() || start == Some('#') {
|
if line.is_empty() || start == Some('#') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let Some(pos_quote) = line.find('\"') else { return Err(Error::illegal_argument(format!("Illegal line: {line}"))) };
|
let Some(pos_quote) = line.find('\"') else {
|
||||||
|
return Err(Error::illegal_argument(format!("Illegal line: {line}")));
|
||||||
|
};
|
||||||
if line.chars().nth(line.len() - 1) != Some('"') {
|
if line.chars().nth(line.len() - 1) != Some('"') {
|
||||||
return Err(Error::illegal_argument(format!("Illegal line: {line}")));
|
return Err(Error::illegal_argument(format!("Illegal line: {line}")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// extract item
|
// extract item
|
||||||
let Some(item) = line.get(pos_quote + 1..line.len() - 1) else { return Err(Error::illegal_argument(format!("Illegal line: {line}"))) };
|
let Some(item) = line.get(pos_quote + 1..line.len() - 1) else {
|
||||||
|
return Err(Error::illegal_argument(format!("Illegal line: {line}")));
|
||||||
|
};
|
||||||
if item.is_empty() {
|
if item.is_empty() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,9 @@ where
|
|||||||
/// Cull the `Corpus`
|
/// Cull the `Corpus`
|
||||||
#[allow(clippy::unused_self)]
|
#[allow(clippy::unused_self)]
|
||||||
pub fn accounting_cull(&self, state: &mut CS::State) -> Result<(), Error> {
|
pub fn accounting_cull(&self, state: &mut CS::State) -> Result<(), Error> {
|
||||||
let Some(top_rated) = state.metadata_map().get::<TopAccountingMetadata>() else { return Ok(()) };
|
let Some(top_rated) = state.metadata_map().get::<TopAccountingMetadata>() else {
|
||||||
|
return Ok(());
|
||||||
|
};
|
||||||
|
|
||||||
for (_key, idx) in &top_rated.map {
|
for (_key, idx) in &top_rated.map {
|
||||||
let mut entry = state.corpus().get(*idx)?.borrow_mut();
|
let mut entry = state.corpus().get(*idx)?.borrow_mut();
|
||||||
|
@ -322,7 +322,9 @@ where
|
|||||||
/// Cull the `Corpus` using the `MinimizerScheduler`
|
/// Cull the `Corpus` using the `MinimizerScheduler`
|
||||||
#[allow(clippy::unused_self)]
|
#[allow(clippy::unused_self)]
|
||||||
pub fn cull(&self, state: &mut CS::State) -> Result<(), Error> {
|
pub fn cull(&self, state: &mut CS::State) -> Result<(), Error> {
|
||||||
let Some(top_rated) = state.metadata_map().get::<TopRatedsMetadata>() else { return Ok(()) };
|
let Some(top_rated) = state.metadata_map().get::<TopRatedsMetadata>() else {
|
||||||
|
return Ok(());
|
||||||
|
};
|
||||||
|
|
||||||
let mut acc = HashSet::new();
|
let mut acc = HashSet::new();
|
||||||
|
|
||||||
|
@ -119,7 +119,9 @@ where
|
|||||||
|
|
||||||
start_timer!(state);
|
start_timer!(state);
|
||||||
let mut testcase = state.corpus().get(corpus_idx)?.borrow_mut();
|
let mut testcase = state.corpus().get(corpus_idx)?.borrow_mut();
|
||||||
let Ok(input) = I::try_transform_from(&mut testcase, state, corpus_idx) else { return Ok(()); };
|
let Ok(input) = I::try_transform_from(&mut testcase, state, corpus_idx) else {
|
||||||
|
return Ok(());
|
||||||
|
};
|
||||||
drop(testcase);
|
drop(testcase);
|
||||||
mark_feature_time!(state, PerfFeature::GetInputFromCorpus);
|
mark_feature_time!(state, PerfFeature::GetInputFromCorpus);
|
||||||
|
|
||||||
|
@ -120,7 +120,9 @@ where
|
|||||||
|
|
||||||
start_timer!(state);
|
start_timer!(state);
|
||||||
let mut testcase = state.corpus().get(corpus_idx)?.borrow_mut();
|
let mut testcase = state.corpus().get(corpus_idx)?.borrow_mut();
|
||||||
let Ok(input) = I::try_transform_from(&mut testcase, state, corpus_idx) else { return Ok(()); };
|
let Ok(input) = I::try_transform_from(&mut testcase, state, corpus_idx) else {
|
||||||
|
return Ok(());
|
||||||
|
};
|
||||||
drop(testcase);
|
drop(testcase);
|
||||||
mark_feature_time!(state, PerfFeature::GetInputFromCorpus);
|
mark_feature_time!(state, PerfFeature::GetInputFromCorpus);
|
||||||
|
|
||||||
|
@ -351,11 +351,11 @@ impl Allocator {
|
|||||||
//log::trace!("freeing address: {:?}", ptr);
|
//log::trace!("freeing address: {:?}", ptr);
|
||||||
let Some(metadata) = self.allocations.get_mut(&(ptr as usize)) else {
|
let Some(metadata) = self.allocations.get_mut(&(ptr as usize)) else {
|
||||||
if !ptr.is_null() {
|
if !ptr.is_null() {
|
||||||
AsanErrors::get_mut()
|
AsanErrors::get_mut()
|
||||||
.report_error(AsanError::UnallocatedFree((ptr as usize, Backtrace::new())));
|
.report_error(AsanError::UnallocatedFree((ptr as usize, Backtrace::new())));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
if metadata.freed {
|
if metadata.freed {
|
||||||
AsanErrors::get_mut().report_error(AsanError::DoubleFree((
|
AsanErrors::get_mut().report_error(AsanError::DoubleFree((
|
||||||
|
@ -60,15 +60,17 @@ impl NyxHelper {
|
|||||||
parent_cpu_id: Option<u32>,
|
parent_cpu_id: Option<u32>,
|
||||||
initial_timeout: Duration,
|
initial_timeout: Duration,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
let Some(sharedir) = target_dir.to_str() else { return Err(Error::illegal_argument("can't convert sharedir to str")) };
|
let Some(sharedir) = target_dir.to_str() else {
|
||||||
|
return Err(Error::illegal_argument("can't convert sharedir to str"));
|
||||||
|
};
|
||||||
let work_dir = target_dir.join("workdir");
|
let work_dir = target_dir.join("workdir");
|
||||||
let work_dir = work_dir.to_str().expect("unable to convert workdir to str");
|
let work_dir = work_dir.to_str().expect("unable to convert workdir to str");
|
||||||
let nyx_type = if parallel_mode {
|
let nyx_type = if parallel_mode {
|
||||||
let Some(parent_cpu_id) = parent_cpu_id else {
|
let Some(parent_cpu_id) = parent_cpu_id else {
|
||||||
return Err(Error::illegal_argument(
|
return Err(Error::illegal_argument(
|
||||||
"please set parent_cpu_id in nyx parallel mode",
|
"please set parent_cpu_id in nyx parallel mode",
|
||||||
))
|
));
|
||||||
};
|
};
|
||||||
if cpu_id == parent_cpu_id {
|
if cpu_id == parent_cpu_id {
|
||||||
NyxProcessType::PARENT
|
NyxProcessType::PARENT
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user