No known device uses this, but it's very useful for testing that our overhead calculation is identical to AOSP's. A few more bugs were found in our overhead calculation logic: * The CowHeaderV3 size was missing the original CowHeader (v2) fields that are supposed to be included due to inheritance in the C++ class. * The additional 1% overhead was incorrectly calculated against the initial CoW estimate before static overhead for CoW headers was added. * The V3 num_ops estimation did not set a minimum of 25 to match delta_generator. * The V2 size estimation did not take into account that a cluster of CoW operations cannot be truncated. It must be a multiple of cluster_ops (200 for avbroot). With these fixes, the CoW estimation when compression is disabled matches AOSP exactly. This means all the overhead calculation is now correct and the only difference when compression is enabled is in the compression ratios of the various lz4/gz implementations. Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
End-to-end tests
avbroot's output file is reproducible for a given input file. e2e.toml lists some profiles for generating mock OTA images with unique properties and the expected checksums before and after patching. These tests use pregenerated, hardcoded test keys for signing. These keys should NEVER be used for any other purpose.
For each profile listed in the config, the test process will:
- Generate a mock OTA based on the specification
- Verify tha original OTA checksum
- Run avbroot against the OTA using
--magisk(with a mock Magisk APK) - Verify the patched OTA checksum
- Extract the AVB-related partitions from the patched OTA
- Run avbroot against the OTA again using
--prepatched - Verify the patched OTA checksum again
The default profiles shipped with the project mimic how various stock OTAs for Pixel devices are built. The generated mock OTAs have valid signatures and data structures for all components, but without any actual data where possible. For example, most files in the ramdisks are empty files. To ensure the mock OTAs cannot be mistakenly installed on a real device, the OTA metadata lists a fake device name in the preconditions section.
Running the tests
To test against the profiles listed in e2e.toml, run:
# To test all profiles
cargo run --release -- test -a
# Or to test against specific profiles
cargo run --release -- test -p pixel_v4_gki -p pixel_v4_non_gki