Retry ioctl in uncrypt if it returns block# 0

In some conditions, ioctl(fd, FIBMAP, &block) returns block number 0.This
is a failure to locate the actual block number of the update package and
will result in an invalid block.map. This CL retries ioctl a few times
if it returns block number as 0.

Bug: 31632090
Test: On N9, uncrypt retries ioctl and produces the correct blockmap.
Change-Id: I913f98cf5c112915c2e803d0683db273c89053b6
1 file changed
tree: 196107fcbfce0a13fe374c4b49b3b4450d283ec0
  1. .clang-format
  2. Android.mk
  3. CleanSpec.mk
  4. NOTICE
  5. README.md
  6. adb_install.cpp
  7. adb_install.h
  8. applypatch/
  9. asn1_decoder.cpp
  10. asn1_decoder.h
  11. bootloader.h
  12. bootloader_message/
  13. common.h
  14. default_device.cpp
  15. device.cpp
  16. device.h
  17. edify/
  18. error_code.h
  19. etc/
  20. fonts/
  21. fuse_sdcard_provider.cpp
  22. fuse_sdcard_provider.h
  23. fuse_sideload.cpp
  24. fuse_sideload.h
  25. install.cpp
  26. install.h
  27. interlace-frames.py
  28. minadbd/
  29. minui/
  30. mounts.cpp
  31. mounts.h
  32. otafault/
  33. otautil/
  34. print_sha1.h
  35. recovery-persist.cpp
  36. recovery-persist.rc
  37. recovery-refresh.cpp
  38. recovery-refresh.rc
  39. recovery.cpp
  40. res-hdpi/
  41. res-mdpi/
  42. res-xhdpi/
  43. res-xxhdpi/
  44. res-xxxhdpi/
  45. roots.cpp
  46. roots.h
  47. rotate_logs.cpp
  48. rotate_logs.h
  49. screen_ui.cpp
  50. screen_ui.h
  51. tests/
  52. tools/
  53. ui.cpp
  54. ui.h
  55. uncrypt/
  56. update_verifier/
  57. updater/
  58. verifier.cpp
  59. verifier.h
  60. wear_touch.cpp
  61. wear_touch.h
  62. wear_ui.cpp
  63. 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.