Merge "adb_remount_test allow to run on eng builds."
am: 99ff4dd35d
Change-Id: Id4057f13145573cbf59ead2b59110eb7184adc28
This commit is contained in:
commit
5fb43a8787
1 changed files with 25 additions and 0 deletions
|
|
@ -164,12 +164,26 @@ NB: This can be flakey on devices due to USB state
|
||||||
|
|
||||||
Returns: true if device in root state" ]
|
Returns: true if device in root state" ]
|
||||||
adb_root() {
|
adb_root() {
|
||||||
|
[ `adb_sh echo '${USER}'` != root ] || return 0
|
||||||
adb root >/dev/null </dev/null 2>/dev/null
|
adb root >/dev/null </dev/null 2>/dev/null
|
||||||
sleep 2
|
sleep 2
|
||||||
adb_wait 2m &&
|
adb_wait 2m &&
|
||||||
[ `adb_sh echo '${USER}'` = root ]
|
[ `adb_sh echo '${USER}'` = root ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ "USAGE: adb_unroot
|
||||||
|
|
||||||
|
NB: This can be flakey on devices due to USB state
|
||||||
|
|
||||||
|
Returns: true if device in un root state" ]
|
||||||
|
adb_unroot() {
|
||||||
|
[ `adb_sh echo '${USER}'` = root ] || return 0
|
||||||
|
adb unroot >/dev/null </dev/null 2>/dev/null
|
||||||
|
sleep 2
|
||||||
|
adb_wait 2m &&
|
||||||
|
[ `adb_sh echo '${USER}'` != root ]
|
||||||
|
}
|
||||||
|
|
||||||
[ "USAGE: fastboot_getvar var expected
|
[ "USAGE: fastboot_getvar var expected
|
||||||
|
|
||||||
Returns: true if var output matches expected" ]
|
Returns: true if var output matches expected" ]
|
||||||
|
|
@ -194,6 +208,15 @@ fastboot_getvar() {
|
||||||
echo ${O} >&2
|
echo ${O} >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ "USAGE: cleanup
|
||||||
|
|
||||||
|
Do nothing: should be redefined when necessary
|
||||||
|
|
||||||
|
Returns: cleans up any latent resources, reverses configurations" ]
|
||||||
|
cleanup () {
|
||||||
|
:
|
||||||
|
}
|
||||||
|
|
||||||
[ "USAGE: die [-d|-t <epoch>] [message] >/dev/stderr
|
[ "USAGE: die [-d|-t <epoch>] [message] >/dev/stderr
|
||||||
|
|
||||||
If -d, or -t <epoch> argument is supplied, dump logcat.
|
If -d, or -t <epoch> argument is supplied, dump logcat.
|
||||||
|
|
@ -212,6 +235,7 @@ die() {
|
||||||
shift 2
|
shift 2
|
||||||
fi
|
fi
|
||||||
echo "${RED}[ FAILED ]${NORMAL} ${@}" >&2
|
echo "${RED}[ FAILED ]${NORMAL} ${@}" >&2
|
||||||
|
cleanup
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -558,6 +582,7 @@ check_eq "${A}" "${B}" /system after reboot
|
||||||
echo "${GREEN}[ OK ]${NORMAL} /system content remains after reboot" >&2
|
echo "${GREEN}[ OK ]${NORMAL} /system content remains after reboot" >&2
|
||||||
# Only root can read vendor if sepolicy permissions are as expected
|
# Only root can read vendor if sepolicy permissions are as expected
|
||||||
if ${enforcing}; then
|
if ${enforcing}; then
|
||||||
|
adb_unroot
|
||||||
B="`adb_cat /vendor/hello`" &&
|
B="`adb_cat /vendor/hello`" &&
|
||||||
die "re-read /vendor/hello after reboot w/o root"
|
die "re-read /vendor/hello after reboot w/o root"
|
||||||
check_eq "cat: /vendor/hello: Permission denied" "${B}" vendor after reboot w/o root
|
check_eq "cat: /vendor/hello: Permission denied" "${B}" vendor after reboot w/o root
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue