Reject changed nested file sizes before checkpoint replay
This commit is contained in:
1 parent
ffd84cd15b
commit
061e484001
4 files changed
+101
-30
No files matched your search
+18
-10
@@ -656,19 +656,27 @@ fn child_checkpoints_reuse_only_the_validated_physical_prefix() {
|
||||
prior = after;
|
||||
}
|
||||
|
||||
// A whole-file consumer makes changes to any byte observable before input.
|
||||
let probed = make_project(&format!(r"\count0=\pdffilesize{{leaf.tex}}\relax
|
||||
// A size probe allows new bytes of the same length past the scanner
|
||||
// frontier. A length change invalidates the earlier numeric result.
|
||||
let mut probed = make_project(&format!(r"\count0=\pdffilesize{{leaf.tex}}\relax
|
||||
{main}"));
|
||||
let guarded = NativeCompiler::default().with_automatic_entry_checkpoints();
|
||||
guarded.compile(request.clone().with_project(probed.clone())).unwrap();
|
||||
let changed = original.replace("100 points", "3000 points");
|
||||
let probed = probed.with_file_edits(2, [(leaf.clone(), Arc::from(changed.into_bytes()))].into()).unwrap();
|
||||
let job = request.with_project(probed);
|
||||
let after = guarded.compile(job.clone()).unwrap();
|
||||
let full = NativeCompiler::default().compile(job).unwrap();
|
||||
assert_ne!(after.entry_checkpoint_work.reused_source.as_deref(), Some(leaf.as_path()));
|
||||
assert!(after.execution.execution == full.execution.execution);
|
||||
assert_eq!(after.pdf, full.pdf);
|
||||
|
||||
for (revision, edit, reuse_leaf) in [(2, "200 points", true), (3, "3000 points", false)] {
|
||||
let changed = original.replace("100 points", edit);
|
||||
let bytes = changed.len() as i32;
|
||||
probed = probed.with_file_edits(revision, [(leaf.clone(), Arc::from(changed.into_bytes()))].into()).unwrap();
|
||||
let job = request.clone().with_project(probed.clone());
|
||||
let after = guarded.compile(job.clone()).unwrap();
|
||||
let full = NativeCompiler::default().compile(job).unwrap();
|
||||
assert_eq!(after.entry_checkpoint_work.reused_source.as_deref() == Some(leaf.as_path()), reuse_leaf,
|
||||
"{:?}", after.entry_checkpoint_work);
|
||||
assert_eq!(after.execution.execution.state.count(0), bytes);
|
||||
assert!(after.execution.execution == full.execution.execution);
|
||||
assert_eq!(after.execution.execution_resources, full.execution.execution_resources);
|
||||
assert_eq!(after.pdf, full.pdf);
|
||||
}
|
||||
fs::remove_dir_all(root).unwrap();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user