forked from gentoo-utils/gentoo-utils
skip atoms that portage denies for having duplicate usedeps
This commit is contained in:
21
fuzz/fuzz.rs
21
fuzz/fuzz.rs
@@ -68,19 +68,30 @@ pub unsafe extern "C" fn LLVMFuzzerTestOneInput(input: *const u8, len: usize) ->
|
|||||||
result => panic!("got unexpected result from python: {result}"),
|
result => panic!("got unexpected result from python: {result}"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let gentoo_utils_result = Atom::parser().check_finished(InputIter::new(atom)).is_ok();
|
let gentoo_utils_result = Atom::parser().parse_finished(InputIter::new(atom));
|
||||||
|
|
||||||
match (portage_result, gentoo_utils_result) {
|
match (portage_result, gentoo_utils_result) {
|
||||||
(true, true) => {
|
(true, Ok(_)) => {
|
||||||
eprintln!("agreement that {atom} is valid");
|
eprintln!("agreement that {atom} is valid");
|
||||||
}
|
}
|
||||||
(false, false) => {
|
(false, Err(_)) => {
|
||||||
eprintln!("agreement that {atom} is invalid");
|
eprintln!("agreement that {atom} is invalid");
|
||||||
}
|
}
|
||||||
(true, false) => {
|
(true, Err(_)) => {
|
||||||
panic!("rejected valid atom: {atom}");
|
panic!("rejected valid atom: {atom}");
|
||||||
}
|
}
|
||||||
(false, true) => {
|
(false, Ok(atom))
|
||||||
|
if atom.usedeps().iter().any(|usedep| {
|
||||||
|
atom.usedeps()
|
||||||
|
.iter()
|
||||||
|
.filter(|u| usedep.flag() == u.flag())
|
||||||
|
.count()
|
||||||
|
> 1
|
||||||
|
}) =>
|
||||||
|
{
|
||||||
|
eprintln!("disagreement due to duplicates in usedeps");
|
||||||
|
}
|
||||||
|
(false, Ok(_)) => {
|
||||||
panic!("accpeted invalid atom: {atom}")
|
panic!("accpeted invalid atom: {atom}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user