| 194 | } |
| 195 | |
| 196 | pub fn synthesis(&mut self) -> Result<()> { |
| 197 | log::info!("synthesis huge fuzzers!"); |
| 198 | let driver_dir = self.deopt.get_library_driver_dir()?; |
| 199 | let drivers: Vec<PathBuf> = deopt::utils::read_sort_dir(&driver_dir)? |
| 200 | .iter() |
| 201 | .filter(|x| x.extension().is_some() && x.extension().unwrap().to_string_lossy() == "cc") |
| 202 | .cloned() |
| 203 | .collect(); |
| 204 | |
| 205 | let mut batch = Vec::new(); |
| 206 | let mut batch_id = Vec::new(); |
| 207 | let mut fuzzer_id = 0; |
| 208 | |
| 209 | for (i, driver) in drivers.iter().enumerate() { |
| 210 | if !self.use_constraint || self.is_valid_driver(driver) { |
| 211 | batch.push(driver.clone()); |
| 212 | batch_id.push(i); |
| 213 | } |
| 214 | if batch.len() == self.batch || i == drivers.len() - 1 { |
| 215 | let fuzzer_content = self.synthesis_batch(&batch_id)?; |
| 216 | self.fuse_fuzzer(fuzzer_content, fuzzer_id, &batch, &batch_id)?; |
| 217 | self.fuse_corpus(fuzzer_id, &batch)?; |
| 218 | batch.clear(); |
| 219 | batch_id.clear(); |
| 220 | fuzzer_id += 1; |
| 221 | } |
| 222 | } |
| 223 | Ok(()) |
| 224 | } |
| 225 | |
| 226 | fn fuse_fuzzer( |
| 227 | &self, |