diff --git a/fs_mgr/tests/adb-remount-test.sh b/fs_mgr/tests/adb-remount-test.sh index ed55768f2..04422f9d6 100755 --- a/fs_mgr/tests/adb-remount-test.sh +++ b/fs_mgr/tests/adb-remount-test.sh @@ -1001,8 +1001,16 @@ diff ${tempdir}/libc.so ${tempdir}/libc.so.fromdevice > /dev/null || echo "${GREEN}[ RUN ]${NORMAL} reboot to confirm content persistent" >&2 +fixup_from_recovery() { + inRecovery || return 1 + echo "${ORANGE}[ ERROR ]${NORMAL} Device in recovery" >&2 + adb reboot + adb_wait 2m +} + adb_reboot && adb_wait 2m || + fixup_from_recovery || die "reboot after override content added failed `usb_status`" if ${overlayfs_needed}; then @@ -1110,6 +1118,7 @@ else die "can not reboot out of fastboot" echo "${ORANGE}[ WARNING ]${NORMAL} adb after fastboot" adb_wait 2m || + fixup_from_recovery || die "did not reboot after flash `usb_status`" if ${overlayfs_needed}; then adb_root && @@ -1231,9 +1240,25 @@ fi echo "${GREEN}[ RUN ]${NORMAL} test raw remount commands" >&2 +fixup_from_fastboot() { + inFastboot || return 1 + if [ -n "${ACTIVE_SLOT}" ]; then + local active_slot=`get_active_slot` + if [ X"${ACTIVE_SLOT}" != X"${active_slot}" ]; then + echo "${ORANGE}[ ERROR ]${NORMAL} Active slot changed from ${ACTIVE_SLOT} to ${active_slot}" + else + echo "${ORANGE}[ ERROR ]${NORMAL} Active slot to be set to ${ACTIVE_SLOT}" + fi >&2 + fastboot --set-active=${ACTIVE_SLOT} + fi + fastboot reboot + adb_wait 2m +} + # Prerequisite is a prepped device from above. adb_reboot && adb_wait 2m || + fixup_from_fastboot || die "lost device after reboot to ro state `usb_status`" adb_sh grep " /vendor .* rw," /proc/mounts >/dev/null &2 # Prerequisite is a prepped device from above. adb_reboot && adb_wait 2m || + fixup_from_fastboot || die "lost device after reboot to ro state `usb_status`" adb_sh grep " /vendor .* rw," /proc/mounts >/dev/null /dev/null