Harden differential snapshotting tests #5717
Harden differential snapshotting tests #5717Manciukic wants to merge 6 commits intofirecracker-microvm:mainfrom
Conversation
The test was only checking FULL snapshots. Run it also on DIFF and MINCORE. Signed-off-by: Riccardo Mancini <[email protected]>
As a further check, ensure that when writing an arbitrary page in a previous block the incremental snapshots work fine. Signed-off-by: Riccardo Mancini <[email protected]>
s/hptplugged/hotplugged Signed-off-by: Riccardo Mancini <[email protected]>
This proptest will generate 4096 randomized inputs to harden the testing on dump_dirty. Signed-off-by: Riccardo Mancini <[email protected]>
Apply the proptest also to store_dirty_bitmap. Signed-off-by: Riccardo Mancini <[email protected]>
1cde1df to
c7e49a4
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5717 +/- ##
=======================================
Coverage 83.17% 83.17%
=======================================
Files 277 277
Lines 29428 29428
=======================================
Hits 24478 24478
Misses 4950 4950
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| /// Generate a KVM dirty bitmap for a slot of `num_pages` pages. | ||
| fn kvm_bitmap_for(num_pages: usize) -> impl Strategy<Value = Vec<u64>> { | ||
| let num_u64s = num_pages.div_ceil(64); | ||
| let trailing_bits = num_pages % 64; |
There was a problem hiding this comment.
trailing_bits confused me a bit (no pun intended) because it made me think you refer to the MSB, but instead you refer to the LSB. Shall we rename it to something like valid_bits?
There was a problem hiding this comment.
fair point, these are the number of valid bits at the beginning, not the trailing bits at the end. I will change
There was a problem hiding this comment.
Or something like last_chunk_valid_bits might be a bit more descriptive than just valid_bits
| /// A region descriptor produced by the strategy. | ||
| #[derive(Debug, Clone)] | ||
| struct RegionSpec { | ||
| gap_pages: usize, |
There was a problem hiding this comment.
nit: A comment here explaining that this is meant to be the gap from the previous region could be useful
Changes
test_memory_hotplug.py::test_snapshot_restore_incrementalto run on all snapshot typestest_memory_hotplug.py::test_snapshot_restore_incrementalto dirty a random pagedump_dirtyandstore_dirtyReason
Harden tests around incremental snapshots.
test_snapshot_restore_incrementalcould have also caught the issue with differential snapshots, but it was only run on FULL snapshots.Property testing automates the testing on random valid inputs to harden the function, catching edge cases. It caught an edge case that our initial fix didn't consider.
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.PR Checklist
tools/devtool checkbuild --allto verify that the PR passesbuild checks on all supported architectures.
tools/devtool checkstyleto verify that the PR passes theautomated style checks.
how they are solving the problem in a clear and encompassing way.
in the PR.
CHANGELOG.md.Runbook for Firecracker API changes.
integration tests.
TODO.rust-vmm.