diff options
-rw-r--r-- | test/testing/art_fake_heapprofd_client_api/Android.bp | 29 | ||||
-rw-r--r-- | test/testing/art_fake_heapprofd_client_api/heapprofd_client_api.c | 34 | ||||
-rwxr-xr-x | tools/buildbot-build.sh | 53 |
3 files changed, 74 insertions, 42 deletions
diff --git a/test/testing/art_fake_heapprofd_client_api/Android.bp b/test/testing/art_fake_heapprofd_client_api/Android.bp new file mode 100644 index 0000000000..ef033016b4 --- /dev/null +++ b/test/testing/art_fake_heapprofd_client_api/Android.bp @@ -0,0 +1,29 @@ +// +// Copyright (C) 2024 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library_shared { + name: "art_fake_heapprofd_client_api", + srcs: ["heapprofd_client_api.c"], + stem: "heapprofd_client_api", + relative_install_path: "art_fake", // Avoid conflict with the real lib. + stl: "none", + compile_multilib: "both", + visibility: ["//visibility:private"], +} diff --git a/test/testing/art_fake_heapprofd_client_api/heapprofd_client_api.c b/test/testing/art_fake_heapprofd_client_api/heapprofd_client_api.c new file mode 100644 index 0000000000..9d2445bf4a --- /dev/null +++ b/test/testing/art_fake_heapprofd_client_api/heapprofd_client_api.c @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <stdlib.h> + +#include "android/set_abort_message.h" + +#define FAKE(method_name) \ + void method_name() { \ + android_set_abort_message("Fake!"); \ + abort(); \ + } + +FAKE(AHeapProfileEnableCallbackInfo_getSamplingInterval); +FAKE(AHeapProfile_reportSample); +FAKE(AHeapProfile_reportFree); +FAKE(AHeapProfile_reportAllocation); +FAKE(AHeapProfile_registerHeap); +FAKE(AHeapInfo_setEnabledCallback); +FAKE(AHeapInfo_setDisabledCallback); +FAKE(AHeapInfo_create); diff --git a/tools/buildbot-build.sh b/tools/buildbot-build.sh index 3a14e6b3d9..8d21279244 100755 --- a/tools/buildbot-build.sh +++ b/tools/buildbot-build.sh @@ -108,14 +108,10 @@ if [[ $build_host == "no" ]] && [[ $build_target == "no" ]]; then build_target="yes" fi -implementation_libs=( - "heapprofd_client_api" -) - if [ -d frameworks/base ]; then # In full manifest branches, build the implementation libraries from source # instead of using prebuilts. - common_targets="$common_targets ${implementation_libs[*]}" + common_targets="$common_targets" else # Necessary to build successfully in master-art. extra_args="SOONG_ALLOW_MISSING_DEPENDENCIES=true" @@ -159,11 +155,11 @@ if [[ $build_target == "yes" ]]; then make_command+=" build-art-target-gtests" test $skip_run_tests_build == "yes" || make_command+=" build-art-target-run-tests" make_command+=" debuggerd sh su toybox" - make_command+=" libartpalette_fake" - # Indirect dependencies in the platform, e.g. through heapprofd_client_api. + make_command+=" libartpalette_fake art_fake_heapprofd_client_api" + # Indirect dependencies in the platform. # These are built to go into system/lib(64) to be part of the system linker # namespace. - make_command+=" libnetd_client-target libprocinfo libtombstoned_client libunwindstack" + make_command+=" libnetd_client-target libtombstoned_client" # Stubs for other APEX SDKs, for use by vogar. Referenced from DEVICE_JARS in # external/vogar/src/vogar/ModeId.java. # Note these go into out/target/common/obj/JAVA_LIBRARIES which isn't removed @@ -206,15 +202,17 @@ if [[ $build_target == "yes" ]]; then ANDROID_HOST_OUT=$out_dir/host/linux-x86 fi - # Use a fake libartpalette implementation to prevent chroot tests from talking to the platform - # through libartpalette. + # Use fake implementations to prevent chroot tests from talking to the platform (e.g., through + # libartpalette). for l in lib lib64; do if [ ! -d "$ANDROID_PRODUCT_OUT/system/$l" ]; then continue fi - cmd="cp -p \"$ANDROID_PRODUCT_OUT/system/$l/art_fake/libartpalette-system.so\" \"$ANDROID_PRODUCT_OUT/system/$l/libartpalette-system.so\"" - msginfo "Executing" "$cmd" - eval "$cmd" + for lib in libartpalette-system heapprofd_client_api; do + cmd="cp -p \"$ANDROID_PRODUCT_OUT/system/$l/art_fake/$lib.so\" \"$ANDROID_PRODUCT_OUT/system/$l/$lib.so\"" + msginfo "Executing" "$cmd" + eval "$cmd" + done done # Extract prebuilt APEXes. @@ -238,35 +236,6 @@ if [[ $build_target == "yes" ]]; then fi done - # Replace stub libraries with implementation libraries: because we do chroot - # testing, we need to install an implementation of the libraries (and cannot - # rely on the one already installed on the device, if the device is post R and - # has it). - if [ -d prebuilts/runtime/mainline/platform/impl -a ! -d frameworks/base ]; then - if [[ $TARGET_ARCH = arm* ]]; then - arch32=arm - arch64=arm64 - elif [[ $TARGET_ARCH = riscv64 ]]; then - arch32=none # there is no 32-bit arch for RISC-V - arch64=riscv64 - else - arch32=x86 - arch64=x86_64 - fi - for so in ${implementation_libs[@]}; do - if [ -d "$ANDROID_PRODUCT_OUT/system/lib" -a $arch32 != none ]; then - cmd="cp -p prebuilts/runtime/mainline/platform/impl/$arch32/${so}.so $ANDROID_PRODUCT_OUT/system/lib/${so}.so" - msginfo "Executing" "$cmd" - eval "$cmd" - fi - if [ -d "$ANDROID_PRODUCT_OUT/system/lib64" -a $arch64 != none ]; then - cmd="cp -p prebuilts/runtime/mainline/platform/impl/$arch64/${so}.so $ANDROID_PRODUCT_OUT/system/lib64/${so}.so" - msginfo "Executing" "$cmd" - eval "$cmd" - fi - done - fi - # Create canonical name -> file name symlink in the symbol directory for the # Testing ART APEX. # |