Skip to content

Commit

Permalink
fuzz: fix fuzz warnings (#5614)
Browse files Browse the repository at this point in the history
  • Loading branch information
amab8901 authored Apr 13, 2023
1 parent cf9a03c commit abc93f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions tokio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,5 +658,6 @@ cfg_macros! {
#[cfg(test)]
fn is_unpin<T: Unpin>() {}

/// fuzz test (fuzz_linked_list)
#[cfg(fuzzing)]
pub mod fuzz;
3 changes: 3 additions & 0 deletions tokio/src/util/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,13 +507,15 @@ pub(crate) mod tests {
}
}

#[cfg(test)]
macro_rules! assert_clean {
($e:ident) => {{
assert!($e.pointers.get_next().is_none());
assert!($e.pointers.get_prev().is_none());
}};
}

#[cfg(test)]
macro_rules! assert_ptr_eq {
($a:expr, $b:expr) => {{
// Deal with mapping a Pin<&mut T> -> Option<NonNull<T>>
Expand Down Expand Up @@ -717,6 +719,7 @@ pub(crate) mod tests {
}
}

/// This is a fuzz test. You run it by entering `cargo fuzz run fuzz_linked_list` in CLI in `/tokio/` module.
#[cfg(fuzzing)]
pub fn fuzz_linked_list(ops: &[u8]) {
enum Op {
Expand Down

0 comments on commit abc93f6

Please sign in to comment.