Fix xor writer failure
When two install op extents generate consecutive XOR extents, xor extent
writer will merge them. But ExtentMap does not support partial look up,
so OTA fails. Add testcases specifically for this case.
Test: th
Bug: 266021213
Change-Id: Ieb5b9a3fd175f16ced2799050f627376bacbfb51
diff --git a/payload_generator/extent_utils.h b/payload_generator/extent_utils.h
index 17995b1..f8d36e7 100644
--- a/payload_generator/extent_utils.h
+++ b/payload_generator/extent_utils.h
@@ -151,6 +151,13 @@
block < extent.start_block() + extent.num_blocks();
}
+// return true iff |big| extent contains |small| extent
+constexpr bool ExtentContains(const Extent& big, const Extent& small) {
+ return big.start_block() <= small.start_block() &&
+ small.start_block() + small.num_blocks() <=
+ big.start_block() + big.num_blocks();
+}
+
} // namespace chromeos_update_engine
#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_EXTENT_UTILS_H_