Merge changes I2eef0a3c,I263a1774

* changes:
  Also check Zygote runtime options when testing flag `enable_apex_image`.
  Refactor Zygote runtime option checking in runtime_native_boot-flags-test.sh.
This commit is contained in:
Roland Levillain
2019-03-01 19:17:26 +00:00
committed by Gerrit Code Review

View File

@@ -139,35 +139,33 @@ function find_zygote_runtime_option {
adb logcat -d -s "$zygote" | grep -q -e "option\[[0-9]\+\]=$runtime_option" adb logcat -d -s "$zygote" | grep -q -e "option\[[0-9]\+\]=$runtime_option"
} }
# check_zygote_gc_runtime_option CONTEXT VALUE # check_zygote_runtime_option CONTEXT RUNTIME_OPTION
# -------------------------------------------- # --------------------------------------------------
# Check that all zygote processes are passed device configuration flag VALUE as # Check that all zygote processes are passed RUNTIME_OPTION as runtime option. Use
# GC runtime option. Use CONTEXT in logging. # CONTEXT in logging.
function check_zygote_gc_runtime_option { function check_zygote_runtime_option {
local context=$1 local context=$1
local value=$2 local runtime_option=$2
say \ say \
"[$context] Check that all zygote processes are passed the flag value as a GC runtime option..." "[$context] Check that all zygote processes are passed \`$runtime_option\` as runtime option..."
local runtime_option="-Xgc:$value"
for zygote in $zygotes; do for zygote in $zygotes; do
find_zygote_runtime_option "$zygote" "$runtime_option"\ find_zygote_runtime_option "$zygote" "$runtime_option" \
|| fail "Found no \`$runtime_option\` among runtime options passed to \`$zygote\`" || fail "Found no \`$runtime_option\` among runtime options passed to \`$zygote\`"
done done
} }
# check_no_zygote_gc_runtime_option CONTEXT VALUE # check_no_zygote_runtime_option CONTEXT RUNTIME_OPTION
# ----------------------------------------------- # -----------------------------------------------------
# Check that no zygote process is passed device configuration flag VALUE as GC # Check that no zygote process is passed RUNTIME_OPTION as runtime option. Use
# runtime option. Use CONTEXT in logging. # CONTEXT in logging.
function check_no_zygote_gc_runtime_option { function check_no_zygote_runtime_option {
local context=$1 local context=$1
local value=$2 local runtime_option=$2
say "[$context] Check no zygote process is passed the flag value as a GC runtime option..." say "[$context] Check that no zygote process is passed \`$runtime_option\` as runtime option..."
local runtime_option="-Xgc:$value"
for zygote in $zygotes; do for zygote in $zygotes; do
find_zygote_runtime_option "$zygote" "$runtime_option"\ find_zygote_runtime_option "$zygote" "$runtime_option" \
&& fail "Found \`$runtime_option\` among runtime options passed to \`$zygote\`" && fail "Found \`$runtime_option\` among runtime options passed to \`$zygote\`"
done done
} }
@@ -270,17 +268,17 @@ esac
# ========================================== # ==========================================
function check_nogenerational_cc { function check_nogenerational_cc {
check_zygote_gc_runtime_option "$1" nogenerational_cc check_zygote_runtime_option "$1" "-Xgc:nogenerational_cc"
} }
function check_no_nogenerational_cc { function check_no_nogenerational_cc {
check_no_zygote_gc_runtime_option "$1" nogenerational_cc check_no_zygote_runtime_option "$1" "-Xgc:nogenerational_cc"
} }
function check_generational_cc { function check_generational_cc {
check_zygote_gc_runtime_option "$1" generational_cc check_zygote_runtime_option "$1" "-Xgc:generational_cc"
} }
function check_no_generational_cc { function check_no_generational_cc {
check_no_zygote_gc_runtime_option "$1" generational_cc check_no_zygote_runtime_option "$1" "-Xgc:generational_cc"
} }
test_android_runtime_flag \ test_android_runtime_flag \
@@ -299,11 +297,14 @@ function check_no_default_boot_image {
check_no_android_runtime_message "$1" "$default_boot_image_message" check_no_android_runtime_message "$1" "$default_boot_image_message"
} }
apex_boot_image_message="Using Apex boot image: '-Ximage:/system/framework/apex.art'" apex_boot_image_option="-Ximage:/system/framework/apex.art"
apex_boot_image_message="Using Apex boot image: '$apex_boot_image_option'"
function check_apex_boot_image { function check_apex_boot_image {
check_zygote_runtime_option "$1" "$apex_boot_image_option"
check_android_runtime_message "$1" "$apex_boot_image_message" check_android_runtime_message "$1" "$apex_boot_image_message"
} }
function check_no_apex_boot_image { function check_no_apex_boot_image {
check_no_zygote_runtime_option "$1" "$apex_boot_image_option"
check_no_android_runtime_message "$1" "$apex_boot_image_message" check_no_android_runtime_message "$1" "$apex_boot_image_message"
} }