From bcf66ed699efa3e4c2a2f2b5ce26b2c5e1a5c4eb Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 24 Oct 2017 15:20:44 -0700 Subject: [PATCH 1/5] bootstat: fix test regression (extra logging) Deal with regression from 9a3870490a005ac73dc1e2be202e0824cc239e43 where additional content is logged and should be ignored. Test: system/core/bootstat/boot_reason_test.sh Bug: 63736262 Change-Id: I70709ba5b00ea18a653ff8d1658556b7d4c48775 --- bootstat/boot_reason_test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstat/boot_reason_test.sh b/bootstat/boot_reason_test.sh index 209e81b4c..85c85f345 100755 --- a/bootstat/boot_reason_test.sh +++ b/bootstat/boot_reason_test.sh @@ -287,6 +287,7 @@ bootstat: Service started: /system/bin/bootstat -l bootstat: Battery level at shutdown 100% bootstat: Battery level at startup 100% init : Parsing file /system/etc/init/bootstat.rc... +init : Parsing file /system/etc/init/bootstat-debug.rc... init : processing action (persist.test.boot.reason=*) from (/system/etc/init/bootstat-debug.rc: init : Command 'setprop ro.boot.bootreason \${persist.test.boot.reason}' action=persist.test.boot.reason=* (/system/etc/init/bootstat-debug.rc: init : processing action (post-fs-data) from (/system/etc/init/bootstat.rc From 73691aafc286c7601b0223a16903010aa339072e Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 24 Oct 2017 15:20:44 -0700 Subject: [PATCH 2/5] bootstat: fix test regression (exec_background) Deal with regression from 557a9d4054f6da38bc000a5842582d2afbc23294 where bootstat was moved to exec_background and actions delayed to improve boot time. Add a 1 second sleep rather than trying to inspect the dmesg (debug only) for clues to the end of bootstat. Test: system/core/bootstat/boot_reason_test.sh Bug: 63736262 Change-Id: I87dfb6a07130112bf51c367632967efa53ea2534 --- bootstat/boot_reason_test.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bootstat/boot_reason_test.sh b/bootstat/boot_reason_test.sh index 85c85f345..ffe3dc7b3 100755 --- a/bootstat/boot_reason_test.sh +++ b/bootstat/boot_reason_test.sh @@ -194,10 +194,12 @@ wait_for_screen() { 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 fi From 2a8e5cce338b7f3b81d90df68853e8a120a867bd Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 24 Oct 2017 13:37:39 -0700 Subject: [PATCH 3/5] bootstat: test: check ro.boot.bootreason in some tests blind_reboot_test() did not report the ro.boot.bootreason value, making it more difficult to diagnose failures. Test: system/core/bootstat/boot_reason_test.sh cold warm hard Bug: 63736262 Change-Id: I313cfef202b1e06c583b0b47cd5d0e0888a7dbe7 --- bootstat/boot_reason_test.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bootstat/boot_reason_test.sh b/bootstat/boot_reason_test.sh index ffe3dc7b3..af65135df 100755 --- a/bootstat/boot_reason_test.sh +++ b/bootstat/boot_reason_test.sh @@ -569,6 +569,8 @@ blind_reboot_test() { esac adb reboot ${TEST} wait_for_screen + bootloader_reason=`validate_property ro.boot.bootreason` + EXPECT_PROPERTY ro.boot.bootreason ${bootloader_reason} EXPECT_PROPERTY sys.boot.reason ${reason} EXPECT_PROPERTY persist.sys.boot.reason ${reason} report_bootstat_logs ${reason} From cabbe4ff356973e457db063c92920c98f69a1922 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Mon, 23 Oct 2017 13:52:39 -0700 Subject: [PATCH 4/5] bootstat: add reboot,2sec Test: system/core/bootreason/boot_reason_test.sh Bug: 63736262 Change-Id: Ie2e5872adb14e0979ff87eb4d2f57ab2849facd4 --- bootstat/bootstat.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp index 22701339d..d1fe9c743 100644 --- a/bootstat/bootstat.cpp +++ b/bootstat/bootstat.cpp @@ -223,6 +223,7 @@ const std::map kBootReasonMap = { {"2sec_reboot", 83}, {"reboot,by_key", 84}, {"reboot,longkey", 85}, + {"reboot,2sec", 86}, }; // Converts a string value representing the reason the system booted to an @@ -406,6 +407,7 @@ std::string BootReasonStrToReason(const std::string& boot_reason) { {"shutdown,thermal", "thermal"}, {"warm,s3_wakeup", "s3_wakeup"}, {"hard,hw_reset", "hw_reset"}, + {"reboot,2sec", "2sec_reboot"}, {"bootloader", ""}, }; From c89f9da0607936b0f3d90ccaeb672dc2f3a1bfd1 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 24 Oct 2017 15:35:34 -0700 Subject: [PATCH 5/5] bootstat: add shutdown,thermal,battery Test: system/core/bootreason/boot_reason_test.sh Bug: 63736262 Change-Id: I30d6b5308fd8616eae31ad13e925d66c9fc07367 --- bootstat/bootstat.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp index d1fe9c743..c1d799e51 100644 --- a/bootstat/bootstat.cpp +++ b/bootstat/bootstat.cpp @@ -224,6 +224,7 @@ const std::map kBootReasonMap = { {"reboot,by_key", 84}, {"reboot,longkey", 85}, {"reboot,2sec", 86}, + {"shutdown,thermal,battery", 87}, }; // Converts a string value representing the reason the system booted to an