Richard Uhler | b730b78 | 2015-07-15 16:01:58 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2015 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
| 17 | LOCAL_PATH := $(call my-dir) |
| 18 | |
Dan Willemsen | cd8a057 | 2016-09-16 17:11:36 -0700 | [diff] [blame] | 19 | include art/build/Android.common_path.mk |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 20 | |
Richard Uhler | d2c7516 | 2017-09-22 12:50:17 +0100 | [diff] [blame] | 21 | # The ahat tests rely on running ART to generate a heap dump for test, but ART |
| 22 | # doesn't run on darwin. Only build and run the tests for linux. |
Richard Uhler | bdff6fe | 2017-09-25 13:33:35 +0100 | [diff] [blame] | 23 | # There are also issues with running under instrumentation. |
Richard Uhler | d2c7516 | 2017-09-22 12:50:17 +0100 | [diff] [blame] | 24 | ifeq ($(HOST_OS),linux) |
Richard Uhler | bdff6fe | 2017-09-25 13:33:35 +0100 | [diff] [blame] | 25 | ifneq ($(EMMA_INSTRUMENT),true) |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 26 | |
Richard Uhler | 0b21333 | 2017-04-24 14:17:55 -0700 | [diff] [blame] | 27 | # Determine the location of the test-dump.jar, test-dump.hprof, and proguard |
Colin Cross | 069cafc | 2019-04-23 12:49:47 -0700 | [diff] [blame] | 28 | AHAT_TEST_DUMP_JAR := $(call intermediates-dir-for,JAVA_LIBRARIES,ahat-test-dump)/javalib.jar |
| 29 | AHAT_TEST_DUMP_COMMON := $(call intermediates-dir-for,JAVA_LIBRARIES,ahat-test-dump,,COMMON) |
| 30 | AHAT_TEST_DUMP_HPROF := $(AHAT_TEST_DUMP_COMMON)/test-dump.hprof |
| 31 | AHAT_TEST_DUMP_BASE_HPROF := $(AHAT_TEST_DUMP_COMMON)/test-dump-base.hprof |
| 32 | AHAT_TEST_DUMP_PROGUARD_MAP := $(AHAT_TEST_DUMP_COMMON)/test-dump.map |
| 33 | AHAT_TEST_DUMP_PROGUARD_DICTIONARY := $(AHAT_TEST_DUMP_COMMON)/proguard_dictionary |
Richard Uhler | 72f0ec7 | 2017-09-13 17:18:37 +0100 | [diff] [blame] | 34 | |
Colin Cross | bf47bc5 | 2017-10-22 12:24:30 -0700 | [diff] [blame] | 35 | # Directories to use for ANDROID_DATA when generating the test dumps to |
| 36 | # ensure we don't pollute the source tree with any artifacts from running |
| 37 | # dalvikvm. |
Colin Cross | 069cafc | 2019-04-23 12:49:47 -0700 | [diff] [blame] | 38 | AHAT_TEST_DUMP_ANDROID_DATA := $(AHAT_TEST_DUMP_COMMON)/test-dump-android_data |
| 39 | AHAT_TEST_DUMP_BASE_ANDROID_DATA := $(AHAT_TEST_DUMP_COMMON)/test-dump-base-android_data |
Colin Cross | bf47bc5 | 2017-10-22 12:24:30 -0700 | [diff] [blame] | 40 | |
Richard Uhler | 72f0ec7 | 2017-09-13 17:18:37 +0100 | [diff] [blame] | 41 | # Generate the proguard map in the desired location by copying it from |
| 42 | # wherever the build system generates it by default. |
Colin Cross | 069cafc | 2019-04-23 12:49:47 -0700 | [diff] [blame] | 43 | $(AHAT_TEST_DUMP_PROGUARD_MAP): PRIVATE_AHAT_SOURCE_PROGUARD_MAP := $(AHAT_TEST_DUMP_PROGUARD_DICTIONARY) |
| 44 | $(AHAT_TEST_DUMP_PROGUARD_MAP): $(AHAT_TEST_DUMP_PROGUARD_DICTIONARY) |
Richard Uhler | 72f0ec7 | 2017-09-13 17:18:37 +0100 | [diff] [blame] | 45 | cp $(PRIVATE_AHAT_SOURCE_PROGUARD_MAP) $@ |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 46 | |
Andreas Gampe | 0326897 | 2018-09-07 16:22:35 -0700 | [diff] [blame] | 47 | ifeq (true,$(HOST_PREFER_32_BIT)) |
| 48 | AHAT_TEST_DALVIKVM_DEP := $(HOST_OUT_EXECUTABLES)/dalvikvm32 |
| 49 | AHAT_TEST_DALVIKVM_ARG := --32 |
| 50 | else |
| 51 | AHAT_TEST_DALVIKVM_DEP := $(HOST_OUT_EXECUTABLES)/dalvikvm64 |
| 52 | AHAT_TEST_DALVIKVM_ARG := --64 |
| 53 | endif |
| 54 | |
Richard Uhler | f629cfd | 2016-12-12 13:11:26 +0000 | [diff] [blame] | 55 | # Run ahat-test-dump.jar to generate test-dump.hprof and test-dump-base.hprof |
David Srbecky | 8834699 | 2019-02-27 15:49:32 +0000 | [diff] [blame] | 56 | # The scripts below are run with --no-compile to avoid dependency on dex2oat. |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 57 | AHAT_TEST_DUMP_DEPENDENCIES := \ |
Andreas Gampe | 0326897 | 2018-09-07 16:22:35 -0700 | [diff] [blame] | 58 | $(AHAT_TEST_DALVIKVM_DEP) \ |
Vladimir Marko | 0776942 | 2018-11-30 12:01:36 +0000 | [diff] [blame] | 59 | $(ART_HOST_SHARED_LIBRARY_DEPENDENCIES) \ |
Andreas Gampe | 096d3ae | 2018-01-26 12:58:20 -0800 | [diff] [blame] | 60 | $(ART_HOST_SHARED_LIBRARY_DEBUG_DEPENDENCIES) \ |
Victor Chang | 6a8f8c5 | 2020-05-07 13:35:08 +0100 | [diff] [blame] | 61 | $(ART_HOST_DEX_DEPENDENCIES) \ |
Richard Uhler | c5a0004 | 2016-07-01 13:10:56 -0700 | [diff] [blame] | 62 | $(HOST_OUT_EXECUTABLES)/art \ |
David Srbecky | 928d28e | 2020-04-01 17:50:51 +0100 | [diff] [blame] | 63 | $(HOST_CORE_IMG_OUTS) |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 64 | |
| 65 | $(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_ART := $(HOST_OUT_EXECUTABLES)/art |
| 66 | $(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_DUMP_JAR := $(AHAT_TEST_DUMP_JAR) |
Colin Cross | bf47bc5 | 2017-10-22 12:24:30 -0700 | [diff] [blame] | 67 | $(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_ANDROID_DATA := $(AHAT_TEST_DUMP_ANDROID_DATA) |
Andreas Gampe | 0326897 | 2018-09-07 16:22:35 -0700 | [diff] [blame] | 68 | $(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_DALVIKVM_ARG := $(AHAT_TEST_DALVIKVM_ARG) |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 69 | $(AHAT_TEST_DUMP_HPROF): $(AHAT_TEST_DUMP_JAR) $(AHAT_TEST_DUMP_DEPENDENCIES) |
Colin Cross | bf47bc5 | 2017-10-22 12:24:30 -0700 | [diff] [blame] | 70 | rm -rf $(PRIVATE_AHAT_TEST_ANDROID_DATA) |
| 71 | mkdir -p $(PRIVATE_AHAT_TEST_ANDROID_DATA) |
| 72 | ANDROID_DATA=$(PRIVATE_AHAT_TEST_ANDROID_DATA) \ |
David Srbecky | 8834699 | 2019-02-27 15:49:32 +0000 | [diff] [blame] | 73 | $(PRIVATE_AHAT_TEST_ART) --no-compile -d $(PRIVATE_AHAT_TEST_DALVIKVM_ARG) \ |
Andreas Gampe | 0326897 | 2018-09-07 16:22:35 -0700 | [diff] [blame] | 74 | -cp $(PRIVATE_AHAT_TEST_DUMP_JAR) Main $@ |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 75 | |
Richard Uhler | f629cfd | 2016-12-12 13:11:26 +0000 | [diff] [blame] | 76 | $(AHAT_TEST_DUMP_BASE_HPROF): PRIVATE_AHAT_TEST_ART := $(HOST_OUT_EXECUTABLES)/art |
| 77 | $(AHAT_TEST_DUMP_BASE_HPROF): PRIVATE_AHAT_TEST_DUMP_JAR := $(AHAT_TEST_DUMP_JAR) |
Colin Cross | bf47bc5 | 2017-10-22 12:24:30 -0700 | [diff] [blame] | 78 | $(AHAT_TEST_DUMP_BASE_HPROF): PRIVATE_AHAT_TEST_ANDROID_DATA := $(AHAT_TEST_DUMP_BASE_ANDROID_DATA) |
Andreas Gampe | 0326897 | 2018-09-07 16:22:35 -0700 | [diff] [blame] | 79 | $(AHAT_TEST_DUMP_BASE_HPROF): PRIVATE_AHAT_TEST_DALVIKVM_ARG := $(AHAT_TEST_DALVIKVM_ARG) |
Richard Uhler | f629cfd | 2016-12-12 13:11:26 +0000 | [diff] [blame] | 80 | $(AHAT_TEST_DUMP_BASE_HPROF): $(AHAT_TEST_DUMP_JAR) $(AHAT_TEST_DUMP_DEPENDENCIES) |
Colin Cross | bf47bc5 | 2017-10-22 12:24:30 -0700 | [diff] [blame] | 81 | rm -rf $(PRIVATE_AHAT_TEST_ANDROID_DATA) |
| 82 | mkdir -p $(PRIVATE_AHAT_TEST_ANDROID_DATA) |
| 83 | ANDROID_DATA=$(PRIVATE_AHAT_TEST_ANDROID_DATA) \ |
David Srbecky | 8834699 | 2019-02-27 15:49:32 +0000 | [diff] [blame] | 84 | $(PRIVATE_AHAT_TEST_ART) --no-compile -d $(PRIVATE_AHAT_TEST_DALVIKVM_ARG) \ |
Andreas Gampe | 0326897 | 2018-09-07 16:22:35 -0700 | [diff] [blame] | 85 | -cp $(PRIVATE_AHAT_TEST_DUMP_JAR) Main $@ --base |
Richard Uhler | f629cfd | 2016-12-12 13:11:26 +0000 | [diff] [blame] | 86 | |
Richard Uhler | b957c89 | 2018-07-06 10:20:37 +0100 | [diff] [blame] | 87 | |
| 88 | # Determine the location of the ri-test-dump.jar and ri-test-dump.hprof. |
Colin Cross | 069cafc | 2019-04-23 12:49:47 -0700 | [diff] [blame] | 89 | AHAT_RI_TEST_DUMP_JAR := $(call intermediates-dir-for,JAVA_LIBRARIES,ahat-ri-test-dump,HOST)/javalib.jar |
| 90 | AHAT_RI_TEST_DUMP_COMMON := $(call intermediates-dir-for,JAVA_LIBRARIES,ahat-ri-test-dump,HOST,COMMON) |
| 91 | AHAT_RI_TEST_DUMP_HPROF := $(AHAT_RI_TEST_DUMP_COMMON)/ri-test-dump.hprof |
Richard Uhler | b957c89 | 2018-07-06 10:20:37 +0100 | [diff] [blame] | 92 | |
| 93 | # Run ahat-ri-test-dump.jar to generate ri-test-dump.hprof |
| 94 | $(AHAT_RI_TEST_DUMP_HPROF): PRIVATE_AHAT_RI_TEST_DUMP_JAR := $(AHAT_RI_TEST_DUMP_JAR) |
| 95 | $(AHAT_RI_TEST_DUMP_HPROF): $(AHAT_RI_TEST_DUMP_JAR) |
| 96 | rm -rf $@ |
| 97 | java -cp $(PRIVATE_AHAT_RI_TEST_DUMP_JAR) Main $@ |
| 98 | |
Richard Uhler | 72f0ec7 | 2017-09-13 17:18:37 +0100 | [diff] [blame] | 99 | # --- ahat-tests.jar -------------- |
Richard Uhler | 09a262e | 2018-09-03 14:46:38 +0100 | [diff] [blame] | 100 | # To run these tests, use: atest ahat-tests --host |
Richard Uhler | 72f0ec7 | 2017-09-13 17:18:37 +0100 | [diff] [blame] | 101 | include $(CLEAR_VARS) |
Richard Uhler | 8cc2134 | 2017-10-10 17:23:33 +0100 | [diff] [blame] | 102 | LOCAL_SRC_FILES := $(call all-java-files-under, src/test) |
| 103 | LOCAL_JAR_MANIFEST := etc/ahat-tests.mf |
Richard Uhler | 72f0ec7 | 2017-09-13 17:18:37 +0100 | [diff] [blame] | 104 | LOCAL_JAVA_RESOURCE_FILES := \ |
| 105 | $(AHAT_TEST_DUMP_HPROF) \ |
| 106 | $(AHAT_TEST_DUMP_BASE_HPROF) \ |
| 107 | $(AHAT_TEST_DUMP_PROGUARD_MAP) \ |
Richard Uhler | b957c89 | 2018-07-06 10:20:37 +0100 | [diff] [blame] | 108 | $(AHAT_RI_TEST_DUMP_HPROF) \ |
Richard Uhler | 8cc2134 | 2017-10-10 17:23:33 +0100 | [diff] [blame] | 109 | $(LOCAL_PATH)/etc/L.hprof \ |
| 110 | $(LOCAL_PATH)/etc/O.hprof \ |
| 111 | $(LOCAL_PATH)/etc/RI.hprof |
Richard Uhler | 72f0ec7 | 2017-09-13 17:18:37 +0100 | [diff] [blame] | 112 | LOCAL_STATIC_JAVA_LIBRARIES := ahat junit-host |
| 113 | LOCAL_IS_HOST_MODULE := true |
| 114 | LOCAL_MODULE_TAGS := tests |
| 115 | LOCAL_MODULE := ahat-tests |
nelsonli | 42034d7 | 2018-08-08 10:25:29 +0800 | [diff] [blame] | 116 | LOCAL_TEST_CONFIG := ahat-tests.xml |
Richard Uhler | 26d465f | 2018-06-07 13:08:08 +0100 | [diff] [blame] | 117 | LOCAL_COMPATIBILITY_SUITE := general-tests |
Richard Uhler | 72f0ec7 | 2017-09-13 17:18:37 +0100 | [diff] [blame] | 118 | include $(BUILD_HOST_JAVA_LIBRARY) |
| 119 | AHAT_TEST_JAR := $(LOCAL_BUILT_MODULE) |
| 120 | |
Richard Uhler | bdff6fe | 2017-09-25 13:33:35 +0100 | [diff] [blame] | 121 | endif # EMMA_INSTRUMENT |
Richard Uhler | d2c7516 | 2017-09-22 12:50:17 +0100 | [diff] [blame] | 122 | endif # linux |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 123 | |
| 124 | # Clean up local variables. |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 125 | AHAT_TEST_JAR := |
Richard Uhler | 0b21333 | 2017-04-24 14:17:55 -0700 | [diff] [blame] | 126 | AHAT_TEST_DUMP_JAR := |
Colin Cross | 069cafc | 2019-04-23 12:49:47 -0700 | [diff] [blame] | 127 | AHAT_TEST_DUMP_COMMON := |
Richard Uhler | 0b21333 | 2017-04-24 14:17:55 -0700 | [diff] [blame] | 128 | AHAT_TEST_DUMP_HPROF := |
| 129 | AHAT_TEST_DUMP_BASE_HPROF := |
| 130 | AHAT_TEST_DUMP_PROGUARD_MAP := |
| 131 | AHAT_TEST_DUMP_DEPENDENCIES := |
Colin Cross | bf47bc5 | 2017-10-22 12:24:30 -0700 | [diff] [blame] | 132 | AHAT_TEST_DUMP_ANDROID_DATA := |
| 133 | AHAT_TEST_DUMP_BASE_ANDROID_DATA := |
Richard Uhler | 3524472 | 2015-09-10 16:45:54 -0700 | [diff] [blame] | 134 | |
Colin Cross | 069cafc | 2019-04-23 12:49:47 -0700 | [diff] [blame] | 135 | AHAT_RI_TEST_DUMP_JAR := |
| 136 | AHAT_RI_TEST_DUMP_COMMON := |
| 137 | AHAT_RI_TEST_DUMP_HPROF := |