bootstat: test error out only on first bad bootloader reason

Hopefully the quick property test is first, setting the stage for
ignoring future failures.  This solves a problem with multiple
test failures directly attributed to a CTS compliance issue
with the bootloader's boot reason.  One test fails, the remainder
get a pass on this one issue.

Test: boot_reason_test.sh
Bug: 63736262
Change-Id: Id56946b6f2f3a33d65bd1830543838f153290759
This commit is contained in:
Mark Salyzyn 2018-03-20 11:44:38 -07:00
parent ef454589e4
commit 855d205817
1 changed files with 16 additions and 3 deletions

View File

@ -239,6 +239,8 @@ EXPECT_EQ() {
return 0
}
BAD_BOOTLOADER_REASON=
[ "USAGE: EXPECT_PROPERTY <prop> <value> [--allow_failure]
Returns true (0) if current return (regex) value is true and the result matches
@ -249,9 +251,20 @@ EXPECT_PROPERTY() {
value="${2}"
shift 2
val=`adb shell getprop ${property} 2>&1`
EXPECT_EQ "${value}" "${val}" for Android property ${property} ||
[ -n "${1}" ] ||
save_ret=${?}
EXPECT_EQ "${value}" "${val}" for Android property ${property}
local_ret=${?}
if [ 0 != ${local_ret} -a "ro.boot.bootreason" = "${property}" ]; then
if [ -z "${BAD_BOOTLOADER_REASON}" ]; then
BAD_BOOTLOADER_REASON=${val}
elif [ X"${BAD_BOOTLOADER_REASON}" = X"${val}" ]; then
local_ret=0
fi
fi
if [ 0 != ${local_ret} ]; then
if [ -z "${1}" ] ; then
save_ret=${local_ret}
fi
fi
return ${save_ret}
}