From b7bb0a134cbe35b92b42acfd73f1d9a97750c5b7 Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Thu, 28 Feb 2019 20:52:41 +0000 Subject: [PATCH] Check Android Runtime (Boot) device configuration flag `enable_apex_image`. Test: core/jni/runtime_native_boot-flags-test.sh Bug: 119800099 Change-Id: I10c6ed68eceebef14207bc38cab4e96fb2f75939 --- core/jni/runtime_native_boot-flags-test.sh | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/core/jni/runtime_native_boot-flags-test.sh b/core/jni/runtime_native_boot-flags-test.sh index a39078f61039b..a5d7a5a9ca612 100755 --- a/core/jni/runtime_native_boot-flags-test.sh +++ b/core/jni/runtime_native_boot-flags-test.sh @@ -172,6 +172,32 @@ function check_no_zygote_gc_runtime_option { done } +# check_android_runtime_message CONTEXT MESSAGE +# --------------------------------------------- +# Return whether AndroidRuntime generated MESSAGE in logcat. Use CONTEXT in +# logging. +function check_android_runtime_message { + local context=$1 + local message=$2 + + say "[$context] Check that AndroidRuntime generated expected message in logcat..." + adb logcat -d -s AndroidRuntime | grep -F -q "$message" \ + || fail "Found no message \"$message\" generated by AndroidRuntime" +} + +# check_no_android_runtime_message CONTEXT MESSAGE +# ------------------------------------------------ +# Return whether AndroidRuntime did not generate MESSAGE in logcat. Use CONTEXT +# in logging. +function check_no_android_runtime_message { + local context=$1 + local message=$2 + + say "[$context] Check that AndroidRuntime did not generate unexpected message in logcat..." + adb logcat -d -s AndroidRuntime | grep -F -q -v "$message" \ + || fail "Found message \"$message\" generated by AndroidRuntime" +} + # test_android_runtime_flag FLAG VALUE CHECK_EFFECT CHECK_NO_EFFECT # ----------------------------------------------------------------- # Test device configuration FLAG with VALUE. CHECK_EFFECT and CHECK_NO_EFFECT @@ -262,6 +288,30 @@ test_android_runtime_flag \ test_android_runtime_flag \ enable_generational_cc true check_generational_cc check_no_generational_cc +# Test "enable_apex_image" flag values. +# ===================================== + +default_boot_image_message="Using default boot image" +function check_default_boot_image { + check_android_runtime_message "$1" "$default_boot_image_message" +} +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'" +function check_apex_boot_image { + check_android_runtime_message "$1" "$apex_boot_image_message" +} +function check_no_apex_boot_image { + check_no_android_runtime_message "$1" "$apex_boot_image_message" +} + +test_android_runtime_flag \ + enable_apex_image false check_default_boot_image check_no_default_boot_image +test_android_runtime_flag \ + enable_apex_image true check_apex_boot_image check_no_apex_boot_image + # Post-test actions. # ==================