If the platform has no bootloader or pstore support, kernel_panic
test should fail if the results are not correct. Drop skipping of
failed test if pstore support is lacking.
If device demonstrably has pstore content support, the result must
be exacting kernel_panic,sysrq. Otherwise accept the less precise
result.
Test: On hikey960 (which currently lacks reliable pstore, or a
compliant bootloader reporting bootreason), expect failure of:
system/core/bootstat/boot_reason_test.sh kernel_panic
Bug: 63736262
Change-Id: I071a2a9c00dc522ec037c8a8997fea524d17e6e4
Integer overflow sanitized builds are throwing an error on the while
loop decrement in the rfind function. This refactors the loop to prevent
decrementing the value on the final iteration.
Test: Compiled and device boots without runtime error.
Bug: 30969751
Change-Id: Ice4532cce933062b3c14adf2d9749cfdea4ad84c
Create a private rfind that allows a fuzzy match based on a bit error
rate (BER) of 1 every 8 bits. last kmsg is affected by pstore ramoops
backing that suffers from data corruption. Add some additional
validation based on possible data corruption scenarios, as a noisy
match means higher chance of noisy data.
Noisy data notably can affect the battery level detection, but do not
typically result in false positives. Battery level, or failure, is
the responsibility of the BatteryStats service, providing a positive
signal and strong device-independent algorithm. The checking done in
bootstat is likely to be deprecated in favour of an API request to
BatteryStats once their algorithms deal with surprise outages due to
aging.
The kernel logging heuristic and BER fixup handily deals with a
prevalent issue where some bootloaders failure to properly notify us
of panics. This is where the gains are noticed with this improvement.
Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I93b4210f12fb47c5c036f4d6eb4cafeee4896d35
Replace simple strtoull with loop that ensures no leading zeros.
Restrict size of value buffer being checked as allocation was
going to end of retrieved buffer, which can cause unnecessary
memory pressure during boot.
Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: Ifdc1d4fd3a73794c001577024ce7cbfde9c25028
If we sniff an unknown boot reason from last kmsg, make sure it
has a "reboot," prefix.
Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: Ia1c401b8899d1f0c56bd4f5d8d2d19b7fc889a30
Add the test injection to known list, and deal with an error
propagation issue.
Test: system/core/bootstat/boot_reason_test.sh Its_Just_So_Hard_reboot
Bug: 63736262
Change-Id: I4799956978a8884c69c830fcedd7febd143651fd
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
Deal with regression from 557a9d4054
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
Deal with regression from 9a3870490a
where additional content is logged and should be ignored.
Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I70709ba5b00ea18a653ff8d1658556b7d4c48775
Adding a set of automated engineering unit tests with a strict list of
prerequisites. Not meant for "user" builds. Must have a crafted
bootloader that does not set the boot reason. Only works on platforms
where the bootloader either by accident or specifically does not set
the ro.boot.bootreason via kernel command line configuration
androidboot.bootreason=. If the tests do not have the prerequisites,
the test will report success, but with protest.
These new tests should work on current Hikey and Hikey960 bootloaders
but could very well become obsolete if those platform bootloaders
start setting the boot reason.
We do not want a platform solution as it could allow a third party to
override the bootloader boot reason.
Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I1793184a8484b83e1d9077475bc65af9816dadf7
Use actual test durations to refine future duration estimates.
Better estimates are cosmetic, but lend confidence to the test
results.
SideEffects: none
Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I49143b78a6dc6fb21838a3d6c70b7eb5a8b4cba5
Add cold,powerkey, warm,s3_wakeup and hard,hw_reset so that
sys.boot.reason values can also be enumerated. Also add
some reserved speculative entries associated with forced
suspend to RAM and DISK; shutdown,suspend and shutdown,hibernate
respectively.
Test: system/core/bootstat/boot_reason_test.sh
Bug: 67636061
Change-Id: Ic43523748e6006aaca882f8eec7c1f0c08431bd8
Empty boot reason is mostly unexpected but may take up the bulk of
unknown reported boot reason values.
Bug: none
Test: none
Change-Id: I9978658c2b052d5cf5d28299861b0d1125ba9fc0
To make parsing easier for last reboot reason. This also ensures that
last boot reason matches the content that is typically returned by the
bootloader or in turn landed in the canonical system boot reason.
Simplify parsing in bootstat. Adjust and fix boot_reason_test.sh for
new reality. Allow boot reason tests battery and kernel_panic to pass
if device does not support pstore (empty before and after the test).
If device somehow landed in fastboot mode while waiting for the
display, issue a fastboot reboot to move the test along. Some cleanup
and standardization changes to the test script.
Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I97d5467c0b4a6d65df3525f1a2d0051db813d5ad
Change HandleSigtermSignal() handler to report shutdown,container. Add
the new reason to bootstat. Remove log stutter as
HandlPowerctlMessage will also do a LOG(INFO) reporting
shutdown,container as reason.
Sending SIGTERM to init is to allow a host OS to ask an Android
Container instance to shutdown. The temptation is to report
shutdown,sigterm but that does not accurately describe the usage
scenario.
Test: compile
Bug: 63736262
Change-Id: I3c5798921bdbef5d2689ad22a2e8103741b570b4
Establish a tighter trust relationship with digitization of the
battery level. Validate the reboot reason collected from the last
kmsg. Validate the last reboot reason before using for enhancing
system reboot reason.
Test: system/core/bootstat/boot_reason_test.sh
Bug: 63636262
Change-Id: I45fbac4a33c09295cda89de3b73c93a884033e3b
Code style has drifted too far from our current clang-format
settings.
Test: compile
Side-Effects: none
Bug: 63736262
Change-Id: Ie390459db123cfadf09aa06c8dafb1ae69a72af8
If bootloader reports kernel_panic, gives us permission for a
deeper check of which kind occurred. Resolve a problem with
some kernels that do not have the 'sysrq: SysRq :' log stutter.
Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: Idb8978de7a4f4e3c671c6ab7efc5ebe841f7bbd8
Run bootstat as a oneshot service rather than as a series of inline
exec commands. exec commands impact boot time.
Test: cts-tradefed run cts-dev --module CtsBootStatsTestCases
system/core/bootstat/boot_reason_test.sh all
(make sure it filters out new init reports)
Bug: 65736247
Change-Id: Ic9d509a8cbee4bc1e278081de1001e25ae0915fd
Send the message multiple times into the last dmesg log so that one
may be picked up without data corruption.
Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: Ie42ad1940b1eb4915e4cf6cc61815d0275a70ffe
If the bootloader insists on reporting reboot for cold, warm and
hard, we need to reconstruct canonical reason from the
persist.sys.boot.reason property.
Some log lines contained bootstate, letting their noise through
during testing, changed regex to look for bootstat[^e].
Test: system/core/bootstat/boot_reason_test.sh
Bug: 63736262
Change-Id: I3788c6cf8aca7fc73dd01bf95acb596d18ed7ee4
For reboot [reboot_arg] requests via either reboot or adb reboot,
if reboot_arg is empty then report "shell" or "adb" respectively.
Test: boot_reason_test.sh shell_reboot adb_reboot
Bug: 63736262
Change-Id: Ie613d9e62db6a705885e4e7520aede27af3aa1b9