summaryrefslogtreecommitdiffstats
path: root/tests/testdata (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Generate recovery.img for unittest during build timeTianjie Xu2020-02-214-0/+0
| | | | | | | | | | | | | | The unit tests for imgpatch is comparing the compressed bytes. As a result, these unit tests will fail with libz change. Since the recovery image is just a gzipped ramdisk with some wrappings, we can generate with minigzip it during the build time. This matches the usage in the real world, where we generate the patch with the host side libz; and apply the patch with the library on the device. Bug: 149443852 Test: tests pass on Pixel3 Change-Id: I7885765a161c6bf765671bc55a72cfcaa04b4138
* Allow RSA 4096 key in package verificationxunchang2019-03-262-0/+35
| | | | | | | | | | | | | | | | | | | The RSA_verify sitll works for 4096 bits keys. And we just need to loose the check on modulus. Sample commands to generate the key & package: 1. openssl genrsa -out keypair.pem 4096 2. openssl pkcs8 -topk8 -inform PEM -outform DER -nocrypt \ -in keypair.pem -out private.pk8 3. openssl req -new -x509 -key keypair.pem -out public.x509.pem \ -days 365 4. java -Djava.library.path=prebuilts/sdk/tools/linux/lib64 -jar \ prebuilts/sdk/tools/lib/signapk.jar -w public.x509.pem private.pk8 \ unsigned.zip signed.zip Bug: 129163830 Test: unit tests pass Change-Id: I5a5ff539c9ff1955c02ec2ce4b17563cb92808a4
* minui: Fix a wrong arg in calling GRSurface::Create().Tao Bao2018-11-271-0/+0
| | | | | | | | | | | | | | | | | | This is a bug introduced while refactoring init_display_surface(), in [1]. As a result, user of res_create_multi_display_surface(), which is effectively `charger` right now, crashes due to buffer overrun. This CL fixes the wrong arg and adds a sanity test for res_create_multi_display_surface(). The testdata (battery_scale.png) is copied from system/core/healthd/images/battery_scale.png. [1] commit 44820ac1e31ffa029ab5baa71238a11b6db3e6cc. Bug: 119122296 Test: Run recovery_unit_test on marlin. Test: Build and boot into charger mode on blueline. Verify that `charger` no longer crashes. Change-Id: Ib6d083e1512a9c3c6eb63874d26d22658921d693
* tests: Remove obsolete testdata files.Tao Bao2018-11-053-0/+0
| | | | | | | | | | | | testdata/jarsigned.zip and testdata/unsigned.zip became dead since commit 432918603f57de5a3acc6da9ff613d21c857d9fd ("Refactor existing tests to use gtest"). testdata/patch.bsdiff became dead when applypatch/applypatch.sh was deleted (commit c3ef089dfac921ef6ca04d5341a4035e8c4feb51). Test: Run recovery_unit_test and recovery_component_test. Change-Id: Ie1a7f8850878593fcb7d4554759a539271ffb207
* tests: Remove {old,new}.file.Tao Bao2018-08-202-0/+0
| | | | | | | | | | They serve the same purpose as {boot,recovery}.img, except that they're not structured to be imgdiff'd. Remove the two files and replace all the uses with {boot,recovery}.img instead. Bug: 110106408 Test: Run recovery_{unit,component}_test on marlin. Change-Id: I8e71187d5b0c142ad932f33717f6fae364b43abc
* Convert deflate image chunks to raw if the raw data is smallerTianjie Xu2018-05-242-0/+0
| | | | | | | | | | | | | | | | | The imgpatch will fail on empty deflates because the bspatch won't call the sink function if the target length is zero. Instead of compressing an empty string, it's cleaner to not generate such empty deflate chunks in the patch. Therefore, we can just convert the chunk type to raw if the target length is smaller than the patch data. Also adjust some unit tests and add the testdata gzipped_source & gzipped_target. These two files are ~1K each and are generated by gzipping two slightly different regular files. Bug: 79265132 Test: unit tests pass, imgpatch applys successfully on the given src/tgt Change-Id: I6bfff3251918137f6762a6f9e9551642371a1124
* tests: Add tests for ScreenRecoveryUI.Tao Bao2018-05-092-0/+0
| | | | | | | | | | | | In order to support that, this CL adds Paths::set_resource_dir() to override the default resource dir ("/res/images/") that's only available under recovery. Note that since there're external modules depending on libminui, it adds a separate function of res_set_resource_dir(), instead of requiring the dependency on libotautil for everyone. Test: mmma -j bootable/recovery Test: Run recovery_unit_test on marlin. Change-Id: I0a7dcf4476808bea9e634eaffc9676f6cbaf92b7
* Fix the size mismatch in imgdiffTianjie Xu2017-11-012-0/+0
| | | | | | | | | | | | As we construct the deflate entries of the target zip file with random data, the total size of the zip file may vary from case to case. This leads to occasional failures in the split test for deflate large apk files. This CL fixes the issue by adding two static zip files in the testdata instead of generating them dynamically. Bug: 67849209 Test: run the deflate_large_test repeatedly Change-Id: Iaeffad9205adefa10c9f62f9f088c33c4360a650
* tests: Construct two bad packages at runtime for VerifierTest.Tao Bao2017-03-282-0/+0
| | | | | | | | | | | | For the BadPackage tests from VerifierTest: one alters the footer, and the other alters the metadata. Move the two tests to be based on otasigned_v3.zip (they're based on otasigned_v1.zip previously). Also construct the testdata files dynamically (to save the space and for better readability). Test: recovery_component_test Change-Id: I7604d563f8b4fa0c55fec8730c063384158e3abc (cherry picked from commit 217d9f98595076f344746bffdafb4314191f3e1b)
* tests: Construct signature-boundary.zip at runtime.Tao Bao2017-03-271-0/+0
| | | | | | Test: Observe the same failure with recovery_component_test ("signature start: 65535 is larger than comment size: 0"). Change-Id: I98c357b5df2fa4caa9d8eed63af2e945ed99f18a
* Add a checker for signature boundary in verifierTianjie Xu2016-12-171-0/+0
| | | | | | | | | | | | | | The 'signature_start' variable marks the location of the signature from the end of a zip archive. And a boundary check is missing where 'signature_start' should be within the EOCD comment field. This causes problems when sideloading a malicious package. Also add a corresponding test. Bug: 31914369 Test: Verification fails correctly when sideloading recovery_test.zip on angler. Change-Id: I6ea96bf04dac5d8d4d6719e678d504f957b4d5c1
* applypatch: Add testcases for applypatch executable.Tao Bao2016-11-015-0/+0
| | | | | | | | | | | | | | | Refactor applypatch/main.cpp into libapplypatch_modes so that we can add testcases. Some changes to applypatch/main.cpp: - Replace char** argv with const char**; - Use android::base::Split() to split ":"; - Use android::base::ParseUInt(). Bug: 32383590 Test: Unit tests pass, install-recovery.sh works. Change-Id: I44e7bfa5ab717d439ea1d0ee9ddb7b2c40bb95a4
* Replace minzip with libziparchiveTianjie Xu2016-10-182-0/+0
| | | | | | | | | | | Clean up the duplicated codes that handle the zip files in bootable/recovery; and rename the library of the remaining utility functions to libotautil. Test: Update package installed successfully on angler. Bug: 19472796 Change-Id: Iea8962fcf3004473cb0322b6bb3a9ea3ca7f679e
* Merge \"Clean up verifier testcases.\"Tao Bao2016-08-0120-0/+4
|\ | | | | | | | | | | am: e91aef0ee9 Change-Id: Ia130dc2a7f62ecf1ad40ec03d88a331a31800efa
| * Clean up verifier testcases.Tao Bao2016-08-0120-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A Certificate is a pair of an RSAPublicKey and a particular hash. So v1 and v3 differ in the hash algorithm (SHA-1 vs SHA-256), similarly for v2 and v4. In verifier testcases, we used to load v1/v2 keys with an explicit argument of "sha256" to test the v3/v4 keys. This CL switches to loading v3/v4 keys directly and lets load_keys() to handle that, which is the actual flow we use in practice. Also remove the "fallback to v1 key" in the testcases, which is not the actual behavior. Bug: 30415901 Test: Run the verifier_test component test on device. Change-Id: I3a2baa64826f1b6c4c367a560090df384c4521bb
* | resolve merge conflicts of 2bf95ac to nyc-dev-plus-aospElliott Hughes2016-04-133-0/+3
|\| | | | | | | Change-Id: Iaf232fbe65879bad6e19c7a9600aa6303a491a67
| * Convert recovery to use BoringSSL instead of mincrypt.Mattias Nissler2016-04-063-0/+3
| | | | | | | | | | | | | | This changes the verification code in bootable/recovery to use BoringSSL instead of mincrypt. Change-Id: I37b37d84b22e81c32ac180cd1240c02150ddf3a7
* | Port applypatch.sh tests to recovery_component_testsJed Estep2016-03-123-0/+0
|/ | | | | Bug: 27135282 Change-Id: If53682b591397ddfdb84860a3779b612904d4489
* Refactor existing tests to use gtestJed Estep2016-02-0419-0/+114
Bug: 26962907 Change-Id: I5f80636af1740badeff7d08193f08e23f4e4fee1