test(fuzz): Remove debug printing

This commit is contained in:
Chris Hennick 2024-06-21 07:51:43 -07:00
parent 27c7fa4cd4
commit ad111aa297
No known key found for this signature in database
GPG key ID: DA47AABA4961C509

View file

@ -167,7 +167,6 @@ fn do_operation<'k, T>(
where where
T: Read + Write + Seek, T: Read + Write + Seek,
{ {
println!("do_operation(writer, {:?}, {:?}, {:?}, {:?})", operation, abort, flush_on_finish_file, files_added);
writer.set_flush_on_finish_file(flush_on_finish_file); writer.set_flush_on_finish_file(flush_on_finish_file);
let mut path = Cow::Borrowed(&operation.path); let mut path = Cow::Borrowed(&operation.path);
match &operation.basic { match &operation.basic {
@ -197,23 +196,19 @@ where
} }
BasicFileOperation::ShallowCopy(base) => { BasicFileOperation::ShallowCopy(base) => {
let Some(base_path) = base.get_path() else { let Some(base_path) = base.get_path() else {
println!("Skipping ShallowCopy because no base_path");
return Ok(()); return Ok(());
}; };
deduplicate_paths(&mut path, &base_path); deduplicate_paths(&mut path, &base_path);
do_operation(writer, &base, false, flush_on_finish_file, files_added)?; do_operation(writer, &base, false, flush_on_finish_file, files_added)?;
println!("Shallow copying {:?} to {:?}", base_path, path);
writer.shallow_copy_file_from_path(&*base_path, &*path)?; writer.shallow_copy_file_from_path(&*base_path, &*path)?;
*files_added += 1; *files_added += 1;
} }
BasicFileOperation::DeepCopy(base) => { BasicFileOperation::DeepCopy(base) => {
let Some(base_path) = base.get_path() else { let Some(base_path) = base.get_path() else {
println!("Skipping DeepCopy because no base_path");
return Ok(()); return Ok(());
}; };
deduplicate_paths(&mut path, &base_path); deduplicate_paths(&mut path, &base_path);
do_operation(writer, &base, false, flush_on_finish_file, files_added)?; do_operation(writer, &base, false, flush_on_finish_file, files_added)?;
println!("Deep copying {:?} to {:?}", base_path, path);
writer.deep_copy_file_from_path(&*base_path, &*path)?; writer.deep_copy_file_from_path(&*base_path, &*path)?;
*files_added += 1; *files_added += 1;
} }
@ -237,7 +232,6 @@ where
} }
} }
if abort && *files_added != 0 { if abort && *files_added != 0 {
println!("Calling abort_file()");
writer.abort_file()?; writer.abort_file()?;
*files_added -= 1; *files_added -= 1;
} }
@ -248,20 +242,16 @@ where
ReopenOption::DoNotReopen => return Ok(()), ReopenOption::DoNotReopen => return Ok(()),
ReopenOption::ViaFinish => { ReopenOption::ViaFinish => {
let old_comment = writer.get_raw_comment().to_owned(); let old_comment = writer.get_raw_comment().to_owned();
println!("ViaFinish: old_comment: {:?}", old_comment);
replace_with_or_abort(writer, |old_writer: zip::ZipWriter<T>| { replace_with_or_abort(writer, |old_writer: zip::ZipWriter<T>| {
zip::ZipWriter::new_append(old_writer.finish().unwrap()).unwrap() zip::ZipWriter::new_append(old_writer.finish().unwrap()).unwrap()
}); });
println!("writer.get_raw_comment(): {:?}", writer.get_raw_comment());
assert!(writer.get_raw_comment().starts_with(&old_comment)); assert!(writer.get_raw_comment().starts_with(&old_comment));
}, },
ReopenOption::ViaFinishIntoReadable => { ReopenOption::ViaFinishIntoReadable => {
let old_comment = writer.get_raw_comment().to_owned(); let old_comment = writer.get_raw_comment().to_owned();
println!("ViaFinishIntoReadable: {:?}", writer);
replace_with_or_abort(writer, |old_writer: zip::ZipWriter<T>| { replace_with_or_abort(writer, |old_writer: zip::ZipWriter<T>| {
zip::ZipWriter::new_append(old_writer.finish_into_readable().unwrap().into_inner()).unwrap() zip::ZipWriter::new_append(old_writer.finish_into_readable().unwrap().into_inner()).unwrap()
}); });
println!("writer: {:?}", writer);
assert!(writer.get_raw_comment().starts_with(&old_comment)); assert!(writer.get_raw_comment().starts_with(&old_comment));
}, },
} }