ci(fuzz): Improve debug format
This commit is contained in:
parent
f1b617d112
commit
9a27fb8bba
1 changed files with 11 additions and 1 deletions
|
@ -133,7 +133,7 @@ impl <'k> Debug for FuzzTestCase<'k> {
|
||||||
self.operations.iter().map(|op| {
|
self.operations.iter().map(|op| {
|
||||||
f.write_fmt(format_args!("{:?}", op.0))?;
|
f.write_fmt(format_args!("{:?}", op.0))?;
|
||||||
if op.1 {
|
if op.1 {
|
||||||
f.write_str("writer.abort_file()?;")
|
f.write_str("writer.abort_file()?;\n")
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -167,6 +167,7 @@ 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 {
|
||||||
|
@ -196,19 +197,23 @@ 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;
|
||||||
}
|
}
|
||||||
|
@ -232,6 +237,7 @@ 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;
|
||||||
}
|
}
|
||||||
|
@ -242,16 +248,20 @@ 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));
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue