From 764edada313a9fc7e129e97c7c64bb02f1a8968c Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Fri, 1 Mar 2019 15:33:40 +0000 Subject: [PATCH 1/2] Refactor Zygote runtime option checking in runtime_native_boot-flags-test.sh. Generalize runtime option checking functions, so that they can be used to check options other than the ones starting with `-Xgc:` Test: core/jni/runtime_native_boot-flags-test.sh Bug: 72446017 Bug: 120794191 Bug: 123754583 Bug: 119800099 Change-Id: I263a177486f8e24ce92928973f7c8853baf0983b --- core/jni/runtime_native_boot-flags-test.sh | 42 +++++++++++----------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/core/jni/runtime_native_boot-flags-test.sh b/core/jni/runtime_native_boot-flags-test.sh index a5d7a5a9ca612..bfb5cc758cb32 100755 --- a/core/jni/runtime_native_boot-flags-test.sh +++ b/core/jni/runtime_native_boot-flags-test.sh @@ -139,35 +139,33 @@ function find_zygote_runtime_option { adb logcat -d -s "$zygote" | grep -q -e "option\[[0-9]\+\]=$runtime_option" } -# check_zygote_gc_runtime_option CONTEXT VALUE -# -------------------------------------------- -# Check that all zygote processes are passed device configuration flag VALUE as -# GC runtime option. Use CONTEXT in logging. -function check_zygote_gc_runtime_option { +# check_zygote_runtime_option CONTEXT RUNTIME_OPTION +# -------------------------------------------------- +# Check that all zygote processes are passed RUNTIME_OPTION as runtime option. Use +# CONTEXT in logging. +function check_zygote_runtime_option { local context=$1 - local value=$2 + local runtime_option=$2 say \ - "[$context] Check that all zygote processes are passed the flag value as a GC runtime option..." - local runtime_option="-Xgc:$value" + "[$context] Check that all zygote processes are passed \`$runtime_option\` as runtime option..." 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\`" done } -# check_no_zygote_gc_runtime_option CONTEXT VALUE -# ----------------------------------------------- -# Check that no zygote process is passed device configuration flag VALUE as GC -# runtime option. Use CONTEXT in logging. -function check_no_zygote_gc_runtime_option { +# check_no_zygote_runtime_option CONTEXT RUNTIME_OPTION +# ----------------------------------------------------- +# Check that no zygote process is passed RUNTIME_OPTION as runtime option. Use +# CONTEXT in logging. +function check_no_zygote_runtime_option { 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..." - local runtime_option="-Xgc:$value" + say "[$context] Check that no zygote process is passed \`$runtime_option\` as runtime option..." 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\`" done } @@ -270,17 +268,17 @@ esac # ========================================== 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 { - check_no_zygote_gc_runtime_option "$1" nogenerational_cc + check_no_zygote_runtime_option "$1" "-Xgc:nogenerational_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 { - check_no_zygote_gc_runtime_option "$1" generational_cc + check_no_zygote_runtime_option "$1" "-Xgc:generational_cc" } test_android_runtime_flag \ From ac1d5a9c32cb3afbcf866a0a18b79819f7a6d3e3 Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Fri, 1 Mar 2019 15:38:54 +0000 Subject: [PATCH 2/2] Also check Zygote runtime options when testing flag `enable_apex_image`. Test: core/jni/runtime_native_boot-flags-test.sh Bug: 119800099 Change-Id: I2eef0a3c1f5254b5e270b35477649047c9db40a6 --- core/jni/runtime_native_boot-flags-test.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/jni/runtime_native_boot-flags-test.sh b/core/jni/runtime_native_boot-flags-test.sh index bfb5cc758cb32..cdfeffcc7bbb1 100755 --- a/core/jni/runtime_native_boot-flags-test.sh +++ b/core/jni/runtime_native_boot-flags-test.sh @@ -297,11 +297,14 @@ function check_no_default_boot_image { 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 { + check_zygote_runtime_option "$1" "$apex_boot_image_option" check_android_runtime_message "$1" "$apex_boot_image_message" } 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" }