mirror of
https://github.com/chenxiaolong/avbroot.git
synced 2026-07-03 14:05:11 +02:00
3a3582ce4c
This commit replaces the previous approach of patching real OTAs with patching mock OTAs. The motivation for this change is to make it possible to test the system partition otacerts.zip patching without needing to download huge files. Adding the system image to the stripped OTAs would increase the file size by an order of magnitude. The mock OTAs are generated from a set of profiles defined in e2e.toml. The four included profiles are meant to mimic the OTAs used for testing before: * pixel_v4_gki ~= cheetah * pixel_v4_non_gki ~= bluejay * pixel_v3 ~= bramble * pixel_v2 ~= sunfish There is no equivalent profile for ossi because newer OnePlus devices no longer support custom signing keys properly. The mock OTAs are perfectly valid, structure and signature-wise. They just don't include any real partition data where possible. They are initially signed with a different set of keys to ensure that the changes made by the patching process are actually visible. With how small the mock OTAs are, testing every profile only takes about two seconds. Thus, the Github Actions workflow was adjusted to just run e2e in the same job as the build. Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
27 lines
1.4 KiB
Markdown
27 lines
1.4 KiB
Markdown
# End-to-end tests
|
|
|
|
avbroot's output file is reproducible for a given input file. [`e2e.toml`](./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:
|
|
|
|
1. Generate a mock OTA based on the specification
|
|
2. Verify tha original OTA checksum
|
|
3. Run avbroot against the OTA using `--magisk` (with a mock Magisk APK)
|
|
4. Verify the patched OTA checksum
|
|
5. Extract the AVB-related partitions from the patched OTA
|
|
6. Run avbroot against the OTA again using `--prepatched`
|
|
7. 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`](./e2e.toml), run:
|
|
|
|
```bash
|
|
# 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
|
|
```
|