From 3576ed043c21a55b137affd7215d1efb845f136e Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 4 Feb 2020 07:16:53 -0800 Subject: [PATCH] tests: handle legacy and new bootstat complete Regression from commit cb1a8e7fdd231a9d1e95b1493ad716b9008dd81f ("Don't retrigger bootstat during userspace reboot.") sys.boot_completed and either sys.logbootcomplete (legacy) or sys.bootstat.first_boot_completed set to determine if the display has gone active for bootstat. For adb remount test we have no desire or need to wait for bootstat complete, reduce script complexity. Also solve a possible problem with no content supplied to xargs. Signed-off-by: Mark Salyzyn Test: adb-remount-test.sh Bug: 148804390 Bug: 135984674 Change-Id: Ieefddf583ff7422e8811d2e338a0f16c8943b0d7 --- bootstat/boot_reason_test.sh | 20 ++++++++++---------- fs_mgr/tests/adb-remount-test.sh | 19 ++++--------------- 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/bootstat/boot_reason_test.sh b/bootstat/boot_reason_test.sh index 970ca941b..2f2919f2a 100755 --- a/bootstat/boot_reason_test.sh +++ b/bootstat/boot_reason_test.sh @@ -230,16 +230,16 @@ wait_for_screen() { if [ -n "`get_property sys.boot.reason`" ] then vals=`get_property | - sed -n 's/[[]sys[.]\(boot_completed\|bootstat.first_boot_completed\)[]]: [[]\([01]\)[]]$/\1=\2/p'` - if [ "${vals}" = "`echo boot_completed=1 ; echo bootstat.first_boot_completed=1`" ] - then - sleep 1 - break - fi - if [ "${vals}" = "`echo bootstat.first_boot_completed=1 ; echo boot_completed=1`" ] - then - sleep 1 - break + sed -n 's/[[]sys[.]\(boot_completed\|logbootcomplete\|bootstat[.]first_boot_completed\)[]]: [[]\([01]\)[]]$/\1=\2/p'` + if [ X"${vals}" != X"${vals##*boot_completed=1}" ]; then + if [ X"${vals}" != X"${vals##*logbootcomple=1}" ]; then + sleep 1 + break + fi + if [ X"${vals}" != X"${vals##*bootstat.first_boot_completed=1}" ]; then + sleep 1 + break + fi fi fi fi diff --git a/fs_mgr/tests/adb-remount-test.sh b/fs_mgr/tests/adb-remount-test.sh index c66f307cd..e364436ae 100755 --- a/fs_mgr/tests/adb-remount-test.sh +++ b/fs_mgr/tests/adb-remount-test.sh @@ -474,20 +474,9 @@ wait_for_screen() { if [ 0 != ${counter} ]; then adb_wait fi - if [ -n "`get_property sys.boot.reason`" ] - then - vals=`get_property | - sed -n 's/[[]sys[.]\(boot_completed\|logbootcomplete\)[]]: [[]\([01]\)[]]$/\1=\2/p'` - if [ "${vals}" = "`echo boot_completed=1 ; echo logbootcomplete=1`" ] - then - sleep 1 - break - fi - if [ "${vals}" = "`echo logbootcomplete=1 ; echo boot_completed=1`" ] - then - sleep 1 - break - fi + if [ "1" = "`get_property sys.boot_completed`" ]; then + sleep 1 + break fi fi counter=`expr ${counter} + 1` @@ -858,7 +847,7 @@ D=`get_property ro.serialno` USB_SERIAL= [ -z "${ANDROID_SERIAL}" ] || USB_SERIAL=`find /sys/devices -name serial | grep usb | - xargs grep -l ${ANDROID_SERIAL}` + xargs -r grep -l ${ANDROID_SERIAL}` USB_ADDRESS= if [ -n "${USB_SERIAL}" ]; then USB_ADDRESS=${USB_SERIAL%/serial}