From b43448941a08442777161497b142f62014f50aa0 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Fri, 22 Mar 2019 09:17:06 -0700 Subject: [PATCH] fs_mgr: overlay: test is alarming on legacy eng builds. On taimen-eng build, the test reports: [ WARNING ] user fastboot missing required to invalidate, ignoring a failure ERROR: expected "cat: /vendor/hello: No such file or directory" got "Hello World! Fri Mar 22 08:56:32 PDT 2019" [ FAILED ] vendor content after flash vendor Which is a result of a corner case problem on devices that need to use overlayfs to support adb remount, but do not have fastbootd as required by Dynamic Android Partitions (DAP). These legacy non-DAP devices we consider this a Known Issue. The message however is too alarming when reporting this Known Issue that the test has notified you it accepts. Use standard notification output format, and change the result to a series of WARNING instead. The output would then look like: [ WARNING ] user fastboot missing required to invalidate, ignoring a failure [ WARNING ] expected "cat: /vendor/hello: No such file or directory" [ WARNING ] got "Hello World! Fri Mar 22 08:56:32 PDT 2019" [ WARNING ] vendor content after flash vendor Which still tells us there is an issue, but does not cause a state of extreme alarm when looking at the test output. Test: adb-remount-test.sh Bug: 120448575 Bug: 128876541 Bug: 123079041 Change-Id: I1d8d60f23f7670ade7eae1be629264f7507e0cfd --- fs_mgr/tests/adb-remount-test.sh | 47 ++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/fs_mgr/tests/adb-remount-test.sh b/fs_mgr/tests/adb-remount-test.sh index b95e54ea6..c09dc3d56 100755 --- a/fs_mgr/tests/adb-remount-test.sh +++ b/fs_mgr/tests/adb-remount-test.sh @@ -447,59 +447,71 @@ die() { exit 1 } -[ "USAGE: EXPECT_EQ [message] +[ "USAGE: EXPECT_EQ [--warning [message]] Returns true if (regex) lval matches rval" ] EXPECT_EQ() { local lval="${1}" local rval="${2}" shift 2 + local error=1 + local prefix="${RED}[ ERROR ]${NORMAL}" + if [ X"${1}" = X"--warning" ]; then + prefix="${RED}[ WARNING ]${NORMAL}" + error=0 + shift 1 + fi if ! ( echo X"${rval}" | grep '^X'"${lval}"'$' >/dev/null 2>/dev/null ); then if [ `echo ${lval}${rval}${*} | wc -c` -gt 50 -o "${rval}" != "${rval% *}" ]; then - echo "ERROR: expected \"${lval}\"" >&2 - echo " got \"${rval}\"" | + echo "${prefix} expected \"${lval}\"" >&2 + echo "${prefix} got \"${rval}\"" | sed ': again N s/\(\n\)\([^ ]\)/\1 \2/ t again' >&2 if [ -n "${*}" ] ; then - echo " ${*}" >&2 + echo "${prefix} ${*}" >&2 fi else - echo "ERROR: expected \"${lval}\" got \"${rval}\" ${*}" >&2 + echo "${prefix} expected \"${lval}\" got \"${rval}\" ${*}" >&2 fi - return 1 + return ${error} fi if [ -n "${*}" ] ; then - if [ X"${lval}" != X"${rval}" ]; then + prefix="${GREEN}[ INFO ]${NORMAL}" + if [ X"${lval}" != X"${rval}" ]; then # we were supplied a regex? if [ `echo ${lval}${rval}${*} | wc -c` -gt 60 -o "${rval}" != "${rval% *}" ]; then - echo "INFO: ok \"${lval}\"" >&2 + echo "${prefix} ok \"${lval}\"" >&2 echo " = \"${rval}\"" | sed ': again N s/\(\n\)\([^ ]\)/\1 \2/ t again' >&2 if [ -n "${*}" ] ; then - echo " ${*}" >&2 + echo "${prefix} ${*}" >&2 fi else - echo "INFO: ok \"${lval}\" = \"${rval}\" ${*}" >&2 + echo "${prefix} ok \"${lval}\" = \"${rval}\" ${*}" >&2 fi else - echo "INFO: ok \"${lval}\" ${*}" >&2 + echo "${prefix} ok \"${lval}\" ${*}" >&2 fi fi return 0 } -[ "USAGE: check_eq [message] +[ "USAGE: check_eq [--warning [message]] Exits if (regex) lval mismatches rval" ] check_eq() { local lval="${1}" local rval="${2}" shift 2 + if [ X"${1}" = X"--warning" ]; then + EXPECT_EQ "${lval}" "${rval}" ${*} + return + fi EXPECT_EQ "${lval}" "${rval}" || die "${@}" } @@ -1085,14 +1097,9 @@ else check_eq "cat: /vendor/hello: No such file or directory" "${B}" \ vendor content after flash vendor else - ( - echo "${ORANGE}[ WARNING ]${NORMAL} user fastboot missing required to invalidate, ignoring a failure" >&2 - restore() { - true - } - check_eq "cat: /vendor/hello: No such file or directory" "${B}" \ - vendor content after flash vendor - ) + echo "${ORANGE}[ WARNING ]${NORMAL} user fastboot missing required to invalidate, ignoring a failure" >&2 + check_eq "cat: /vendor/hello: No such file or directory" "${B}" \ + --warning vendor content after flash vendor fi fi