Drop the dependency on 'ui' in verify_file().

verify_file() has a dependency on the global variable of 'ui' for
posting the verification progress, which requires the users of
libverifier to provide a UI instance.

This CL adds an optional argument to verify_file() so that it can
post the progress through the provided callback function. As a result,
we can drop the MockUI class in verifier_test.cpp.

Test: recovery_component_test passes.
Test: verify_file() posts progress update when installing an OTA.
Change-Id: I8b87d0f0d99777ea755d33d6dbbe2b6d44243bf1
(cherry picked from commit 5e535014dd7961fbf812abeaa27f3339775031f1)
4 files changed
tree: 50e5c63d245b942bca1efac8e96600a456e73d2d
  1. applypatch/
  2. bootloader_message/
  3. edify/
  4. etc/
  5. fonts/
  6. minadbd/
  7. minui/
  8. otafault/
  9. otautil/
  10. res-hdpi/
  11. res-mdpi/
  12. res-xhdpi/
  13. res-xxhdpi/
  14. res-xxxhdpi/
  15. tests/
  16. tools/
  17. uncrypt/
  18. update_verifier/
  19. updater/
  20. .clang-format
  21. adb_install.cpp
  22. adb_install.h
  23. Android.mk
  24. asn1_decoder.cpp
  25. asn1_decoder.h
  26. bootloader.h
  27. CleanSpec.mk
  28. common.h
  29. default_device.cpp
  30. device.cpp
  31. device.h
  32. error_code.h
  33. fuse_sdcard_provider.cpp
  34. fuse_sdcard_provider.h
  35. fuse_sideload.cpp
  36. fuse_sideload.h
  37. install.cpp
  38. install.h
  39. interlace-frames.py
  40. mounts.cpp
  41. mounts.h
  42. NOTICE
  43. print_sha1.h
  44. README.md
  45. recovery-persist.cpp
  46. recovery-persist.rc
  47. recovery-refresh.cpp
  48. recovery-refresh.rc
  49. recovery.cpp
  50. roots.cpp
  51. roots.h
  52. rotate_logs.cpp
  53. rotate_logs.h
  54. screen_ui.cpp
  55. screen_ui.h
  56. stub_ui.h
  57. ui.cpp
  58. ui.h
  59. verifier.cpp
  60. verifier.h
  61. wear_touch.cpp
  62. wear_touch.h
  63. wear_ui.cpp
  64. wear_ui.h
README.md

The Recovery Image

Quick turn-around testing

mm -j && m ramdisk-nodeps && m recoveryimage-nodeps

# To boot into the new recovery image
# without flashing the recovery partition:
adb reboot bootloader
fastboot boot $ANDROID_PRODUCT_OUT/recovery.img

Running the tests

# After setting up environment and lunch.
mmma -j bootable/recovery

# Running the tests on device.
adb root
adb sync data

# 32-bit device
adb shell /data/nativetest/recovery_unit_test/recovery_unit_test
adb shell /data/nativetest/recovery_component_test/recovery_component_test

# Or 64-bit device
adb shell /data/nativetest64/recovery_unit_test/recovery_unit_test
adb shell /data/nativetest64/recovery_component_test/recovery_component_test

Running the manual tests

recovery-refresh and recovery-persist executables exist only on systems without /cache partition. And we need to follow special steps to run tests for them.

  • Execute the test on an A/B device first. The test should fail but it will log some contents to pmsg.

  • Reboot the device immediately and run the test again. The test should save the contents of pmsg buffer into /data/misc/recovery/inject.txt. Test will pass if this file has expected contents.

ResourceTest validates whether the png files are qualified as background text image under recovery.

1. `adb sync data` to make sure the test-dir has the images to test.
2. The test will automatically pickup and verify all `_text.png` files in
   the test dir.