blob: f8271130041b4f77612cef07732f2a2efc1fe476 [file] [log] [blame]
Richard Uhlerb730b782015-07-15 16:01:58 -07001#
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
17LOCAL_PATH := $(call my-dir)
18
Dan Willemsencd8a0572016-09-16 17:11:36 -070019include art/build/Android.common_path.mk
Richard Uhler35244722015-09-10 16:45:54 -070020
Richard Uhlerd2c75162017-09-22 12:50:17 +010021# 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 Uhlerbdff6fe2017-09-25 13:33:35 +010023# There are also issues with running under instrumentation.
Richard Uhlerd2c75162017-09-22 12:50:17 +010024ifeq ($(HOST_OS),linux)
Richard Uhlerbdff6fe2017-09-25 13:33:35 +010025ifneq ($(EMMA_INSTRUMENT),true)
Richard Uhler35244722015-09-10 16:45:54 -070026
Richard Uhler0b213332017-04-24 14:17:55 -070027# Determine the location of the test-dump.jar, test-dump.hprof, and proguard
Colin Cross069cafc2019-04-23 12:49:47 -070028AHAT_TEST_DUMP_JAR := $(call intermediates-dir-for,JAVA_LIBRARIES,ahat-test-dump)/javalib.jar
29AHAT_TEST_DUMP_COMMON := $(call intermediates-dir-for,JAVA_LIBRARIES,ahat-test-dump,,COMMON)
30AHAT_TEST_DUMP_HPROF := $(AHAT_TEST_DUMP_COMMON)/test-dump.hprof
31AHAT_TEST_DUMP_BASE_HPROF := $(AHAT_TEST_DUMP_COMMON)/test-dump-base.hprof
32AHAT_TEST_DUMP_PROGUARD_MAP := $(AHAT_TEST_DUMP_COMMON)/test-dump.map
33AHAT_TEST_DUMP_PROGUARD_DICTIONARY := $(AHAT_TEST_DUMP_COMMON)/proguard_dictionary
Richard Uhler72f0ec72017-09-13 17:18:37 +010034
Colin Crossbf47bc52017-10-22 12:24:30 -070035# 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 Cross069cafc2019-04-23 12:49:47 -070038AHAT_TEST_DUMP_ANDROID_DATA := $(AHAT_TEST_DUMP_COMMON)/test-dump-android_data
39AHAT_TEST_DUMP_BASE_ANDROID_DATA := $(AHAT_TEST_DUMP_COMMON)/test-dump-base-android_data
Colin Crossbf47bc52017-10-22 12:24:30 -070040
Richard Uhler72f0ec72017-09-13 17:18:37 +010041# Generate the proguard map in the desired location by copying it from
42# wherever the build system generates it by default.
Colin Cross069cafc2019-04-23 12:49:47 -070043$(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 Uhler72f0ec72017-09-13 17:18:37 +010045 cp $(PRIVATE_AHAT_SOURCE_PROGUARD_MAP) $@
Richard Uhler35244722015-09-10 16:45:54 -070046
Andreas Gampe03268972018-09-07 16:22:35 -070047ifeq (true,$(HOST_PREFER_32_BIT))
48 AHAT_TEST_DALVIKVM_DEP := $(HOST_OUT_EXECUTABLES)/dalvikvm32
49 AHAT_TEST_DALVIKVM_ARG := --32
50else
51 AHAT_TEST_DALVIKVM_DEP := $(HOST_OUT_EXECUTABLES)/dalvikvm64
52 AHAT_TEST_DALVIKVM_ARG := --64
53endif
54
Richard Uhlerf629cfd2016-12-12 13:11:26 +000055# Run ahat-test-dump.jar to generate test-dump.hprof and test-dump-base.hprof
David Srbecky88346992019-02-27 15:49:32 +000056# The scripts below are run with --no-compile to avoid dependency on dex2oat.
Richard Uhler35244722015-09-10 16:45:54 -070057AHAT_TEST_DUMP_DEPENDENCIES := \
Andreas Gampe03268972018-09-07 16:22:35 -070058 $(AHAT_TEST_DALVIKVM_DEP) \
Vladimir Marko07769422018-11-30 12:01:36 +000059 $(ART_HOST_SHARED_LIBRARY_DEPENDENCIES) \
Andreas Gampe096d3ae2018-01-26 12:58:20 -080060 $(ART_HOST_SHARED_LIBRARY_DEBUG_DEPENDENCIES) \
Victor Chang6a8f8c52020-05-07 13:35:08 +010061 $(ART_HOST_DEX_DEPENDENCIES) \
Richard Uhlerc5a00042016-07-01 13:10:56 -070062 $(HOST_OUT_EXECUTABLES)/art \
David Srbecky928d28e2020-04-01 17:50:51 +010063 $(HOST_CORE_IMG_OUTS)
Richard Uhler35244722015-09-10 16:45:54 -070064
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 Crossbf47bc52017-10-22 12:24:30 -070067$(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_ANDROID_DATA := $(AHAT_TEST_DUMP_ANDROID_DATA)
Andreas Gampe03268972018-09-07 16:22:35 -070068$(AHAT_TEST_DUMP_HPROF): PRIVATE_AHAT_TEST_DALVIKVM_ARG := $(AHAT_TEST_DALVIKVM_ARG)
Richard Uhler35244722015-09-10 16:45:54 -070069$(AHAT_TEST_DUMP_HPROF): $(AHAT_TEST_DUMP_JAR) $(AHAT_TEST_DUMP_DEPENDENCIES)
Colin Crossbf47bc52017-10-22 12:24:30 -070070 rm -rf $(PRIVATE_AHAT_TEST_ANDROID_DATA)
71 mkdir -p $(PRIVATE_AHAT_TEST_ANDROID_DATA)
72 ANDROID_DATA=$(PRIVATE_AHAT_TEST_ANDROID_DATA) \
David Srbecky88346992019-02-27 15:49:32 +000073 $(PRIVATE_AHAT_TEST_ART) --no-compile -d $(PRIVATE_AHAT_TEST_DALVIKVM_ARG) \
Andreas Gampe03268972018-09-07 16:22:35 -070074 -cp $(PRIVATE_AHAT_TEST_DUMP_JAR) Main $@
Richard Uhler35244722015-09-10 16:45:54 -070075
Richard Uhlerf629cfd2016-12-12 13:11:26 +000076$(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 Crossbf47bc52017-10-22 12:24:30 -070078$(AHAT_TEST_DUMP_BASE_HPROF): PRIVATE_AHAT_TEST_ANDROID_DATA := $(AHAT_TEST_DUMP_BASE_ANDROID_DATA)
Andreas Gampe03268972018-09-07 16:22:35 -070079$(AHAT_TEST_DUMP_BASE_HPROF): PRIVATE_AHAT_TEST_DALVIKVM_ARG := $(AHAT_TEST_DALVIKVM_ARG)
Richard Uhlerf629cfd2016-12-12 13:11:26 +000080$(AHAT_TEST_DUMP_BASE_HPROF): $(AHAT_TEST_DUMP_JAR) $(AHAT_TEST_DUMP_DEPENDENCIES)
Colin Crossbf47bc52017-10-22 12:24:30 -070081 rm -rf $(PRIVATE_AHAT_TEST_ANDROID_DATA)
82 mkdir -p $(PRIVATE_AHAT_TEST_ANDROID_DATA)
83 ANDROID_DATA=$(PRIVATE_AHAT_TEST_ANDROID_DATA) \
David Srbecky88346992019-02-27 15:49:32 +000084 $(PRIVATE_AHAT_TEST_ART) --no-compile -d $(PRIVATE_AHAT_TEST_DALVIKVM_ARG) \
Andreas Gampe03268972018-09-07 16:22:35 -070085 -cp $(PRIVATE_AHAT_TEST_DUMP_JAR) Main $@ --base
Richard Uhlerf629cfd2016-12-12 13:11:26 +000086
Richard Uhlerb957c892018-07-06 10:20:37 +010087
88# Determine the location of the ri-test-dump.jar and ri-test-dump.hprof.
Colin Cross069cafc2019-04-23 12:49:47 -070089AHAT_RI_TEST_DUMP_JAR := $(call intermediates-dir-for,JAVA_LIBRARIES,ahat-ri-test-dump,HOST)/javalib.jar
90AHAT_RI_TEST_DUMP_COMMON := $(call intermediates-dir-for,JAVA_LIBRARIES,ahat-ri-test-dump,HOST,COMMON)
91AHAT_RI_TEST_DUMP_HPROF := $(AHAT_RI_TEST_DUMP_COMMON)/ri-test-dump.hprof
Richard Uhlerb957c892018-07-06 10:20:37 +010092
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 Uhler72f0ec72017-09-13 17:18:37 +010099# --- ahat-tests.jar --------------
Richard Uhler09a262e2018-09-03 14:46:38 +0100100# To run these tests, use: atest ahat-tests --host
Richard Uhler72f0ec72017-09-13 17:18:37 +0100101include $(CLEAR_VARS)
Richard Uhler8cc21342017-10-10 17:23:33 +0100102LOCAL_SRC_FILES := $(call all-java-files-under, src/test)
103LOCAL_JAR_MANIFEST := etc/ahat-tests.mf
Richard Uhler72f0ec72017-09-13 17:18:37 +0100104LOCAL_JAVA_RESOURCE_FILES := \
105 $(AHAT_TEST_DUMP_HPROF) \
106 $(AHAT_TEST_DUMP_BASE_HPROF) \
107 $(AHAT_TEST_DUMP_PROGUARD_MAP) \
Richard Uhlerb957c892018-07-06 10:20:37 +0100108 $(AHAT_RI_TEST_DUMP_HPROF) \
Richard Uhler8cc21342017-10-10 17:23:33 +0100109 $(LOCAL_PATH)/etc/L.hprof \
110 $(LOCAL_PATH)/etc/O.hprof \
111 $(LOCAL_PATH)/etc/RI.hprof
Richard Uhler72f0ec72017-09-13 17:18:37 +0100112LOCAL_STATIC_JAVA_LIBRARIES := ahat junit-host
113LOCAL_IS_HOST_MODULE := true
114LOCAL_MODULE_TAGS := tests
115LOCAL_MODULE := ahat-tests
nelsonli42034d72018-08-08 10:25:29 +0800116LOCAL_TEST_CONFIG := ahat-tests.xml
Richard Uhler26d465f2018-06-07 13:08:08 +0100117LOCAL_COMPATIBILITY_SUITE := general-tests
Richard Uhler72f0ec72017-09-13 17:18:37 +0100118include $(BUILD_HOST_JAVA_LIBRARY)
119AHAT_TEST_JAR := $(LOCAL_BUILT_MODULE)
120
Richard Uhlerbdff6fe2017-09-25 13:33:35 +0100121endif # EMMA_INSTRUMENT
Richard Uhlerd2c75162017-09-22 12:50:17 +0100122endif # linux
Richard Uhler35244722015-09-10 16:45:54 -0700123
124# Clean up local variables.
Richard Uhler35244722015-09-10 16:45:54 -0700125AHAT_TEST_JAR :=
Richard Uhler0b213332017-04-24 14:17:55 -0700126AHAT_TEST_DUMP_JAR :=
Colin Cross069cafc2019-04-23 12:49:47 -0700127AHAT_TEST_DUMP_COMMON :=
Richard Uhler0b213332017-04-24 14:17:55 -0700128AHAT_TEST_DUMP_HPROF :=
129AHAT_TEST_DUMP_BASE_HPROF :=
130AHAT_TEST_DUMP_PROGUARD_MAP :=
131AHAT_TEST_DUMP_DEPENDENCIES :=
Colin Crossbf47bc52017-10-22 12:24:30 -0700132AHAT_TEST_DUMP_ANDROID_DATA :=
133AHAT_TEST_DUMP_BASE_ANDROID_DATA :=
Richard Uhler35244722015-09-10 16:45:54 -0700134
Colin Cross069cafc2019-04-23 12:49:47 -0700135AHAT_RI_TEST_DUMP_JAR :=
136AHAT_RI_TEST_DUMP_COMMON :=
137AHAT_RI_TEST_DUMP_HPROF :=