diff options
| author | 2018-12-05 22:37:35 +0000 | |
|---|---|---|
| committer | 2018-12-05 22:37:35 +0000 | |
| commit | cfc4b3ac67b364d753d970d1adcf97668114e959 (patch) | |
| tree | f53a785c675d23c0932adfe6b935df5372c8b2e8 | |
| parent | 274ed2ea9d496f75030f849c4259b35ecb4d35c1 (diff) | |
| parent | 36703dc24125b52b62c05e934a050f2a298cc617 (diff) | |
Merge "Add apex com.android.runtime.host artifact"
| -rw-r--r-- | build/apex/Android.bp | 36 | ||||
| -rwxr-xr-x | build/apex/runtests.sh | 234 |
2 files changed, 186 insertions, 84 deletions
diff --git a/build/apex/Android.bp b/build/apex/Android.bp index f1a21e8428..1f93885afa 100644 --- a/build/apex/Android.bp +++ b/build/apex/Android.bp @@ -49,10 +49,13 @@ art_runtime_debug_native_shared_libs = [ ] // Modules listed in LOCAL_REQUIRED_MODULES for module art-tools in art/Android.mk. -art_tools_binaries = [ +art_tools_common_binaries = [ "dexdiag", "dexdump", "dexlist", +] + +art_tools_device_binaries = [ "oatdump", ] @@ -66,6 +69,8 @@ art_tools_host_binaries = [ // ... ] +art_tools_binaries = art_tools_common_binaries + art_tools_device_binaries + apex_key { name: "com.android.runtime.key", public_key: "com.android.runtime.avbpubkey", @@ -135,3 +140,32 @@ apex { prebuilts: ["com.android.runtime.ld.config.txt"], key: "com.android.runtime.key", } + +apex { + name: "com.android.runtime.host", + compile_multilib: "both", + payload_type: "zip", + // TODO: We need this and the multilib is different from above b/c ART sets + // different prefer32 on host and device. We should change this. + host_supported: true, + device_supported: false, + // The files are the same on both. + manifest: "manifest.json", + native_shared_libs: art_runtime_base_native_shared_libs + + art_runtime_fake_native_shared_libs + + art_runtime_debug_native_shared_libs, + multilib: { + both: { + // TODO: Add logic to create a `dalvikvm` symlink to `dalvikvm32` or `dalvikvm64` + // (see `symlink_preferred_arch` in art/dalvikvm/Android.bp). + binaries: art_runtime_base_binaries_both, + }, + first: { + // TODO: oatdump cannot link with host linux_bionic due to not using clang ld + binaries: art_tools_common_binaries + + art_runtime_base_binaries_prefer32 + + art_runtime_debug_binaries_prefer32, + } + }, + key: "com.android.runtime.key", +} diff --git a/build/apex/runtests.sh b/build/apex/runtests.sh index 86cd8cb758..c19c7bd94c 100755 --- a/build/apex/runtests.sh +++ b/build/apex/runtests.sh @@ -69,29 +69,129 @@ done work_dir=$(mktemp -d) mount_point="$work_dir/image" +function check_binary { + [[ -x "$mount_point/bin/$1" ]] || die "Cannot find binary '$1' in mounted image" +} + +function check_multilib_binary { + # TODO: Use $TARGET_ARCH (e.g. check whether it is "arm" or "arm64") to improve + # the precision of this test? + [[ -x "$mount_point/bin/${1}32" ]] || [[ -x "$mount_point/bin/${1}64" ]] \ + || die "Cannot find binary '$1' in mounted image" +} + +function check_binary_symlink { + [[ -h "$mount_point/bin/$1" ]] || die "Cannot find symbolic link '$1' in mounted image" +} + +function check_library { + # TODO: Use $TARGET_ARCH (e.g. check whether it is "arm" or "arm64") to improve + # the precision of this test? + [[ -f "$mount_point/lib/$1" ]] || [[ -f "$mount_point/lib64/$1" ]] \ + || die "Cannot find library '$1' in mounted image" +} + +function build_apex { + if $build_apex_p; then + say "Building package $1" && make "$1" || die "Cannot build $1" + fi +} + +function check_contents { + + # Check that the mounted image contains a manifest. + [[ -f "$mount_point/apex_manifest.json" ]] || die "no manifest" + + # Check that the mounted image contains ART base binaries. + check_multilib_binary dalvikvm + # TODO: Does not work yet. + : check_binary_symlink dalvikvm + check_binary dex2oat + check_binary dexoptanalyzer + check_binary profman + + # Check that the mounted image contains ART tools binaries. + check_binary dexdiag + check_binary dexdump + check_binary dexlist + # oatdump is only in device apex's due to build rules + # check_binary oatdump + + # Check that the mounted image contains ART debug binaries. + check_binary dex2oatd + check_binary dexoptanalyzerd + check_binary profmand + + # Check that the mounted image contains ART libraries. + check_library libart-compiler.so + check_library libart.so + check_library libopenjdkjvm.so + check_library libopenjdkjvmti.so + check_library libadbconnection.so + # TODO: Should we check for these libraries too, even if they are not explicitly + # listed as dependencies in the Android Runtime APEX module rule? + check_library libartbase.so + check_library libart-dexlayout.so + check_library libdexfile.so + check_library libprofile.so + + # Check that the mounted image contains ART debug libraries. + check_library libartd-compiler.so + check_library libartd.so + check_library libopenjdkd.so + check_library libopenjdkjvmd.so + check_library libopenjdkjvmtid.so + check_library libadbconnectiond.so + # TODO: Should we check for these libraries too, even if they are not explicitly + # listed as dependencies in the Android Runtime APEX module rule? + check_library libdexfiled.so + check_library libartbased.so + check_library libartd-dexlayout.so + check_library libprofiled.so + + # TODO: Should we check for other libraries, such as: + # + # libbacktrace.so + # libbase.so + # liblog.so + # libsigchain.so + # libtombstoned_client.so + # libunwindstack.so + # libvixl.so + # libvixld.so + # ... + # + # ? +} + + +# ***************************************** +# * Testing for com.android.runtime.debug * +# ***************************************** + # Garbage collection. -function finish { +function finish_device_debug { # Don't fail early during cleanup. set +e guestunmount "$mount_point" rm -rf "$work_dir" } -trap finish EXIT +trap finish_device_debug EXIT # TODO: Also exercise the Release Runtime APEX (`com.android.runtime.release`). apex_module="com.android.runtime.debug" # Build the Android Runtime APEX package (optional). -$build_apex_p && say "Building package" && make "$apex_module" +build_apex $apex_module system_apexdir="$ANDROID_PRODUCT_OUT/system/apex" apex_package="$system_apexdir/$apex_module.apex" say "Extracting and mounting image" -# Extract the image from the Android Runtime APEX. -image_filename="image.img" +# Extract the payload from the Android Runtime APEX. +image_filename="apex_payload.img" unzip -q "$apex_package" "$image_filename" -d "$work_dir" mkdir "$mount_point" image_file="$work_dir/$image_filename" @@ -111,90 +211,58 @@ $list_image_files_p && say "Listing image files" && ls -ld "$mount_point" && tre say "Running tests" -# Check that the mounted image contains a manifest. -[[ -f "$mount_point/manifest.json" ]] +check_contents -function check_binary { - [[ -x "$mount_point/bin/$1" ]] || die "Cannot find binary '$1' in mounted image" -} +# Check for files pulled in from device-only oatdump. +check_binary oatdump +check_library libart-disassembler.so -function check_multilib_binary { - # TODO: Use $TARGET_ARCH (e.g. check whether it is "arm" or "arm64") to improve - # the precision of this test? - [[ -x "$mount_point/bin/${1}32" ]] || [[ -x "$mount_point/bin/${1}64" ]] \ - || die "Cannot find binary '$1' in mounted image" -} +# Cleanup +trap - EXIT +guestunmount "$mount_point" +rm -rf "$work_dir" -function check_binary_symlink { - [[ -h "$mount_point/bin/$1" ]] || die "Cannot find symbolic link '$1' in mounted image" -} +say "$apex_module Tests passed" -function check_library { - # TODO: Use $TARGET_ARCH (e.g. check whether it is "arm" or "arm64") to improve - # the precision of this test? - [[ -f "$mount_point/lib/$1" ]] || [[ -f "$mount_point/lib64/$1" ]] \ - || die "Cannot find library '$1' in mounted image" +# **************************************** +# * Testing for com.android.runtime.host * +# **************************************** + +# Garbage collection. +function finish_host { + # Don't fail early during cleanup. + set +e + rm -rf "$work_dir" } -# Check that the mounted image contains ART base binaries. -check_multilib_binary dalvikvm -# TODO: Does not work yet. -: check_binary_symlink dalvikvm -check_binary dex2oat -check_binary dexoptanalyzer -check_binary profman - -# Check that the mounted image contains ART tools binaries. -check_binary dexdiag -check_binary dexdump -check_binary dexlist -check_binary oatdump +work_dir=$(mktemp -d) +mount_point="$work_dir/zip" -# Check that the mounted image contains ART debug binaries. -check_binary dex2oatd -check_binary dexoptanalyzerd -check_binary profmand - -# Check that the mounted image contains ART libraries. -check_library libart-compiler.so -check_library libart.so -check_library libopenjdkjvm.so -check_library libopenjdkjvmti.so -check_library libadbconnection.so -# TODO: Should we check for these libraries too, even if they are not explicitly -# listed as dependencies in the Android Runtime APEX module rule? -check_library libartbase.so -check_library libart-dexlayout.so -check_library libart-disassembler.so -check_library libdexfile.so -check_library libprofile.so - -# Check that the mounted image contains ART debug libraries. -check_library libartd-compiler.so -check_library libartd.so -check_library libdexfiled.so -check_library libopenjdkd.so -check_library libopenjdkjvmd.so -check_library libopenjdkjvmtid.so -check_library libadbconnectiond.so -# TODO: Should we check for these libraries too, even if they are not explicitly -# listed as dependencies in the Android Runtime APEX module rule? -check_library libartbased.so -check_library libartd-dexlayout.so -check_library libprofiled.so - -# TODO: Should we check for other libraries, such as: -# -# libbacktrace.so -# libbase.so -# liblog.so -# libsigchain.so -# libtombstoned_client.so -# libunwindstack.so -# libvixl.so -# libvixld.so -# ... -# -# ? +trap finish_host EXIT + +apex_module="com.android.runtime.host" + +# Build the Android Runtime APEX package (optional). +build_apex $apex_module + +system_apexdir="$ANDROID_HOST_OUT/apex" +apex_package="$system_apexdir/$apex_module.zipapex" + +say "Extracting payload" + +# Extract the payload from the Android Runtime APEX. +image_filename="apex_payload.zip" +unzip -q "$apex_package" "$image_filename" -d "$work_dir" +mkdir "$mount_point" +image_file="$work_dir/$image_filename" + +# Unzipping the payload +unzip -q "$image_file" -d "$mount_point" + +say "Running tests" + +check_contents + +say "$apex_module Tests passed" say "Tests passed" |