blob: f7f65acd98bf5b49f98ad7e2513c28358a6b4f4c [file] [log] [blame]
Carl Shapiro7b216702011-06-17 15:09:26 -07001#
2# Copyright (C) 2011 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)
Carl Shapiro7b216702011-06-17 15:09:26 -070018
Brian Carlstrom7940e442013-07-12 13:46:57 -070019art_path := $(LOCAL_PATH)
20art_build_path := $(art_path)/build
Brian Carlstrom1f8730b2013-11-13 17:36:23 -080021include $(art_build_path)/Android.common.mk
Brian Carlstromcdc8de42011-07-19 14:23:17 -070022
Brian Carlstromb2793372012-03-17 18:27:16 -070023########################################################################
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070024# clean-oat targets
25#
26
27# following the example of build's dont_bother for clean targets
28ifneq (,$(filter clean-oat,$(MAKECMDGOALS)))
29art_dont_bother := true
30endif
31ifneq (,$(filter clean-oat-host,$(MAKECMDGOALS)))
32art_dont_bother := true
33endif
34ifneq (,$(filter clean-oat-target,$(MAKECMDGOALS)))
35art_dont_bother := true
36endif
37
38.PHONY: clean-oat
39clean-oat: clean-oat-host clean-oat-target
40
41.PHONY: clean-oat-host
42clean-oat-host:
Brian Carlstromf662e062014-05-19 16:09:42 -070043 rm -rf $(ART_NATIVETEST_OUT)
44 rm -rf $(ART_TEST_OUT)
45 rm -f $(HOST_CORE_IMG_OUT)
46 rm -f $(HOST_CORE_OAT_OUT)
47 rm -f $(HOST_OUT_JAVA_LIBRARIES)/$(ART_HOST_ARCH)/*.odex
48 rm -f $(TARGET_CORE_IMG_OUT)
49 rm -f $(TARGET_CORE_OAT_OUT)
50ifdef TARGET_2ND_ARCH
51 rm -f $(2ND_TARGET_CORE_IMG_OUT)
52 rm -f $(2ND_TARGET_CORE_OAT_OUT)
53endif
54 rm -rf $(DEXPREOPT_PRODUCT_DIR_FULL_PATH)
Brian Carlstrom999cd432013-06-22 23:08:53 -070055 rm -f $(TARGET_OUT_UNSTRIPPED)/system/framework/*.odex
Brian Carlstrom1d6848c2013-03-06 15:03:52 -080056 rm -f $(TARGET_OUT_UNSTRIPPED)/system/framework/*.oat
Brian Carlstrom999cd432013-06-22 23:08:53 -070057 rm -f $(TARGET_OUT_APPS)/*.odex
Brian Carlstrom30e2ea42013-06-19 23:25:37 -070058 rm -f $(TARGET_OUT_INTERMEDIATES)/JAVA_LIBRARIES/*_intermediates/javalib.odex
59 rm -f $(TARGET_OUT_INTERMEDIATES)/APPS/*_intermediates/*.odex
Colin Crossdc781a12014-02-04 16:22:03 -080060ifdef TARGET_2ND_ARCH
61 rm -f $(2ND_TARGET_OUT_INTERMEDIATES)/JAVA_LIBRARIES/*_intermediates/javalib.odex
62 rm -f $(2ND_TARGET_OUT_INTERMEDIATES)/APPS/*_intermediates/*.odex
63endif
Dmitry Petrochenko81c56e72014-03-05 15:05:46 +070064 rm -rf /tmp/$(USER)/test-*/dalvik-cache/*
Brian Carlstromae089612014-05-01 13:52:23 -070065 rm -rf /tmp/android-data/dalvik-cache/*
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070066
67.PHONY: clean-oat-target
68clean-oat-target:
69 adb remount
Brian Carlstromf662e062014-05-19 16:09:42 -070070 adb shell rm -rf $(ART_NATIVETEST_DIR)
71 adb shell rm -rf $(ART_TEST_DIR)
Brian Carlstromae089612014-05-01 13:52:23 -070072 adb shell rm -rf $(ART_DALVIK_CACHE_DIR)/*
Brian Carlstromf662e062014-05-19 16:09:42 -070073 adb shell rm -rf $(DEXPREOPT_BOOT_JAR_DIR)/$(DEX2OAT_TARGET_ARCH)
74 adb shell rm -rf system/app/$(DEX2OAT_TARGET_ARCH)
75ifdef TARGET_2ND_ARCH
76 adb shell rm -rf $(DEXPREOPT_BOOT_JAR_DIR)/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH)
77 adb shell rm -rf system/app/$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH)
78endif
Brian Carlstromae089612014-05-01 13:52:23 -070079 adb shell rm -rf data/run-test/test-*/dalvik-cache/*
Brian Carlstrom62e3ee32012-06-18 14:58:55 -070080
81ifneq ($(art_dont_bother),true)
82
83########################################################################
Brian Carlstromb2793372012-03-17 18:27:16 -070084# product targets
Brian Carlstrom7940e442013-07-12 13:46:57 -070085include $(art_path)/runtime/Android.mk
86include $(art_path)/compiler/Android.mk
87include $(art_path)/dex2oat/Android.mk
Ian Rogers02ed4c02013-09-06 13:10:04 -070088include $(art_path)/disassembler/Android.mk
Brian Carlstrom7940e442013-07-12 13:46:57 -070089include $(art_path)/oatdump/Android.mk
Brian Carlstromfa50baa2013-08-02 01:00:27 -070090include $(art_path)/dalvikvm/Android.mk
Nicolas Geoffray9583fbc2014-02-28 15:21:07 +000091include $(art_path)/tools/Android.mk
Brian Carlstrom7940e442013-07-12 13:46:57 -070092include $(art_build_path)/Android.oat.mk
Dave Allisonf4b80bc2014-05-14 15:41:25 -070093include $(art_path)/sigchainlib/Android.mk
94
Carl Shapiro7b216702011-06-17 15:09:26 -070095
Andreas Gampe2fe07922014-04-21 07:50:39 -070096
97
Brian Carlstromb2793372012-03-17 18:27:16 -070098# ART_HOST_DEPENDENCIES depends on Android.executable.mk above for ART_HOST_EXECUTABLES
Brian Carlstromfd7ad0a2013-12-10 18:20:45 -080099ART_HOST_DEPENDENCIES := $(ART_HOST_EXECUTABLES) $(HOST_OUT_JAVA_LIBRARIES)/core-libart-hostdex.jar
Ying Wang07935e52014-06-10 12:06:16 -0700100ART_HOST_DEPENDENCIES += $(HOST_LIBRARY_PATH)/libjavacore$(ART_HOST_SHLIB_EXTENSION)
Brian Carlstromfd7ad0a2013-12-10 18:20:45 -0800101ART_TARGET_DEPENDENCIES := $(ART_TARGET_EXECUTABLES) $(TARGET_OUT_JAVA_LIBRARIES)/core-libart.jar $(TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so
Andreas Gampefb040d02014-05-21 11:02:08 -0700102ifdef TARGET_2ND_ARCH
103ART_TARGET_DEPENDENCIES += $(2ND_TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so
104endif
Brian Carlstrom15803792012-03-13 00:53:08 -0700105
Brian Carlstromb2793372012-03-17 18:27:16 -0700106########################################################################
107# test targets
Brian Carlstrom15803792012-03-13 00:53:08 -0700108
Brian Carlstrom7940e442013-07-12 13:46:57 -0700109include $(art_path)/test/Android.mk
110include $(art_build_path)/Android.gtest.mk
Brian Carlstromb2793372012-03-17 18:27:16 -0700111
Andreas Gampe2fe07922014-04-21 07:50:39 -0700112$(eval $(call combine-art-multi-target-var,ART_TARGET_GTEST_TARGETS))
113$(eval $(call combine-art-multi-target-var,ART_TARGET_GTEST_EXECUTABLES))
114
Brian Carlstromb2793372012-03-17 18:27:16 -0700115# The ART_*_TEST_DEPENDENCIES definitions:
116# - depend on Android.oattest.mk above for ART_TEST_*_DEX_FILES
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800117# - depend on Android.gtest.mk above for ART_*_GTEST_EXECUTABLES
118ART_HOST_TEST_DEPENDENCIES := $(ART_HOST_DEPENDENCIES) $(ART_HOST_GTEST_EXECUTABLES) $(ART_TEST_HOST_DEX_FILES) $(HOST_CORE_IMG_OUT)
Andreas Gampe2fe07922014-04-21 07:50:39 -0700119
120define declare-art-target-test-dependencies-var
121ART_TARGET_TEST_DEPENDENCIES$(1) := $(ART_TARGET_DEPENDENCIES) $(ART_TARGET_GTEST_EXECUTABLES$(1)) $(ART_TEST_TARGET_DEX_FILES$(1)) $(TARGET_CORE_IMG_OUT$(1))
122endef
123$(eval $(call call-art-multi-target-var,declare-art-target-test-dependencies-var,ART_TARGET_TEST_DEPENDENCIES))
Brian Carlstrom16192862011-09-12 17:50:06 -0700124
Brian Carlstrom7940e442013-07-12 13:46:57 -0700125include $(art_build_path)/Android.libarttest.mk
Brian Carlstrom934486c2011-07-12 23:42:50 -0700126
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700127# "mm test-art" to build and run all tests on host and device
128.PHONY: test-art
129test-art: test-art-host test-art-target
Brian Carlstrom395520e2011-09-25 19:35:00 -0700130 @echo test-art PASSED
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700131
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700132.PHONY: test-art-gtest
Brian Carlstromb2793372012-03-17 18:27:16 -0700133test-art-gtest: test-art-host-gtest test-art-target-gtest
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700134 @echo test-art-gtest PASSED
135
Brian Carlstromb2793372012-03-17 18:27:16 -0700136.PHONY: test-art-oat
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700137test-art-oat: test-art-host-oat test-art-target-oat
Brian Carlstromb2793372012-03-17 18:27:16 -0700138 @echo test-art-oat PASSED
Elliott Hughes2cae5a22011-08-14 14:27:25 -0700139
Brian Carlstrom08981ab2012-05-25 18:40:15 -0700140.PHONY: test-art-run-test
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700141test-art-run-test: test-art-host-run-test test-art-target-run-test
Brian Carlstrom08981ab2012-05-25 18:40:15 -0700142 @echo test-art-run-test PASSED
143
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700144########################################################################
145# host test targets
146
Andreas Gampe3c033572014-05-13 08:41:48 -0700147.PHONY: test-art-host-vixl
Ian Rogers7a4c1c12014-05-18 13:03:52 -0700148VIXL_TEST_DEPENDENCY :=
149# We can only run the vixl tests on 64-bit hosts (vixl testing issue) when its a
150# top-level build (to declare the vixl test rule).
Ying Wangc6585b72014-04-23 18:19:44 -0700151ifneq ($(HOST_IS_64_BIT),)
Ian Rogers7a4c1c12014-05-18 13:03:52 -0700152ifeq ($(ONE_SHOT_MAKEFILE),)
153VIXL_TEST_DEPENDENCY := run-vixl-tests
Andreas Gampe3c033572014-05-13 08:41:48 -0700154endif
Ian Rogers7a4c1c12014-05-18 13:03:52 -0700155endif
156
157test-art-host-vixl: $(VIXL_TEST_DEPENDENCY)
Andreas Gampe3c033572014-05-13 08:41:48 -0700158
Brian Carlstrom934486c2011-07-12 23:42:50 -0700159# "mm test-art-host" to build and run all host tests
160.PHONY: test-art-host
Andreas Gampe3c033572014-05-13 08:41:48 -0700161test-art-host: test-art-host-gtest test-art-host-oat test-art-host-run-test test-art-host-vixl
Brian Carlstrom395520e2011-09-25 19:35:00 -0700162 @echo test-art-host PASSED
Brian Carlstrom59848da2011-07-23 20:35:19 -0700163
Ian Rogers85d9ba62013-01-16 22:32:12 -0800164.PHONY: test-art-host-interpreter
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700165test-art-host-interpreter: test-art-host-oat-interpreter test-art-host-run-test-interpreter
Ian Rogers85d9ba62013-01-16 22:32:12 -0800166 @echo test-art-host-interpreter PASSED
167
Brian Carlstromb0aa9d32012-04-07 23:12:22 -0700168.PHONY: test-art-host-dependencies
Ying Wang07935e52014-06-10 12:06:16 -0700169test-art-host-dependencies: $(ART_HOST_TEST_DEPENDENCIES) $(HOST_LIBRARY_PATH)/libarttest$(ART_HOST_SHLIB_EXTENSION) $(HOST_CORE_DEX_LOCATIONS)
Brian Carlstromb0aa9d32012-04-07 23:12:22 -0700170
Brian Carlstromb2793372012-03-17 18:27:16 -0700171.PHONY: test-art-host-gtest
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800172test-art-host-gtest: $(ART_HOST_GTEST_TARGETS)
Brian Carlstromb2793372012-03-17 18:27:16 -0700173 @echo test-art-host-gtest PASSED
Elliott Hughes2cae5a22011-08-14 14:27:25 -0700174
Brian Carlstromb2793372012-03-17 18:27:16 -0700175# "mm valgrind-test-art-host-gtest" to build and run the host gtests under valgrind.
176.PHONY: valgrind-test-art-host-gtest
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800177valgrind-test-art-host-gtest: $(ART_HOST_VALGRIND_GTEST_TARGETS)
Brian Carlstromb2793372012-03-17 18:27:16 -0700178 @echo valgrind-test-art-host-gtest PASSED
179
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700180.PHONY: test-art-host-oat-default
181test-art-host-oat-default: $(ART_TEST_HOST_OAT_DEFAULT_TARGETS)
182 @echo test-art-host-oat-default PASSED
183
184.PHONY: test-art-host-oat-interpreter
185test-art-host-oat-interpreter: $(ART_TEST_HOST_OAT_INTERPRETER_TARGETS)
186 @echo test-art-host-oat-interpreter PASSED
187
Brian Carlstromb2793372012-03-17 18:27:16 -0700188.PHONY: test-art-host-oat
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700189test-art-host-oat: test-art-host-oat-default test-art-host-oat-interpreter
Brian Carlstromb2793372012-03-17 18:27:16 -0700190 @echo test-art-host-oat PASSED
Elliott Hughes5511f212011-08-12 18:07:45 -0700191
Brian Carlstrom4855cd52012-04-03 21:38:13 -0700192define declare-test-art-host-run-test
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700193.PHONY: test-art-host-run-test-default-$(1)
Brian Carlstrom43534862014-02-19 01:13:52 -0800194test-art-host-run-test-default-$(1): test-art-host-dependencies $(DX) $(HOST_OUT_EXECUTABLES)/jasmin
Mathieu Chartier769a5ad2014-05-18 15:30:10 -0700195 DX=$(abspath $(DX)) JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) art/test/run-test $(addprefix --runtime-option ,$(DALVIKVM_FLAGS)) --host $(1)
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700196 @echo test-art-host-run-test-default-$(1) PASSED
Brian Carlstrom4855cd52012-04-03 21:38:13 -0700197
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700198TEST_ART_HOST_RUN_TEST_DEFAULT_TARGETS += test-art-host-run-test-default-$(1)
Ian Rogers27cedf82012-11-21 11:42:43 -0800199
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700200.PHONY: test-art-host-run-test-interpreter-$(1)
Brian Carlstrom43534862014-02-19 01:13:52 -0800201test-art-host-run-test-interpreter-$(1): test-art-host-dependencies $(DX) $(HOST_OUT_EXECUTABLES)/jasmin
Mathieu Chartier769a5ad2014-05-18 15:30:10 -0700202 DX=$(abspath $(DX)) JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) art/test/run-test $(addprefix --runtime-option ,$(DALVIKVM_FLAGS)) --host --interpreter $(1)
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700203 @echo test-art-host-run-test-interpreter-$(1) PASSED
Ian Rogers27cedf82012-11-21 11:42:43 -0800204
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700205TEST_ART_HOST_RUN_TEST_INTERPRETER_TARGETS += test-art-host-run-test-interpreter-$(1)
Brian Carlstroma404db02013-08-28 09:37:40 -0700206
207.PHONY: test-art-host-run-test-$(1)
208test-art-host-run-test-$(1): test-art-host-run-test-default-$(1) test-art-host-run-test-interpreter-$(1)
209
Brian Carlstrom4855cd52012-04-03 21:38:13 -0700210endef
211
Brian Carlstrom934ce802014-04-01 18:09:33 -0700212$(foreach test, $(TEST_ART_RUN_TESTS), $(eval $(call declare-test-art-host-run-test,$(test))))
Brian Carlstrom4855cd52012-04-03 21:38:13 -0700213
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700214.PHONY: test-art-host-run-test-default
215test-art-host-run-test-default: $(TEST_ART_HOST_RUN_TEST_DEFAULT_TARGETS)
216 @echo test-art-host-run-test-default PASSED
Brian Carlstrom4855cd52012-04-03 21:38:13 -0700217
Brian Carlstromdbaa93a2013-07-31 15:13:10 -0700218.PHONY: test-art-host-run-test-interpreter
219test-art-host-run-test-interpreter: $(TEST_ART_HOST_RUN_TEST_INTERPRETER_TARGETS)
220 @echo test-art-host-run-test-interpreter PASSED
221
222.PHONY: test-art-host-run-test
223test-art-host-run-test: test-art-host-run-test-default test-art-host-run-test-interpreter
224 @echo test-art-host-run-test PASSED
Ian Rogers27cedf82012-11-21 11:42:43 -0800225
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700226########################################################################
227# target test targets
228
229# "mm test-art-target" to build and run all target tests
Andreas Gampe2fe07922014-04-21 07:50:39 -0700230define declare-test-art-target
231.PHONY: test-art-target$(1)
232test-art-target$(1): test-art-target-gtest$(1) test-art-target-oat$(1) test-art-target-run-test$(1)
233 @echo test-art-target$(1) PASSED
234endef
235$(eval $(call call-art-multi-target-rule,declare-test-art-target,test-art-target))
Brian Carlstrom86927212011-09-15 11:31:11 -0700236
Andreas Gampe2fe07922014-04-21 07:50:39 -0700237define declare-test-art-target-dependencies
238.PHONY: test-art-target-dependencies$(1)
Brian Carlstrom0e12bdc2014-05-14 17:44:28 -0700239test-art-target-dependencies$(1): $(ART_TARGET_TEST_DEPENDENCIES$(1)) $(ART_TARGET_LIBARTTEST_$(1))
Andreas Gampe2fe07922014-04-21 07:50:39 -0700240endef
241$(eval $(call call-art-multi-target-rule,declare-test-art-target-dependencies,test-art-target-dependencies))
242
Brian Carlstromb0aa9d32012-04-07 23:12:22 -0700243
Brian Carlstrom86927212011-09-15 11:31:11 -0700244.PHONY: test-art-target-sync
Andreas Gampe2fe07922014-04-21 07:50:39 -0700245test-art-target-sync: test-art-target-dependencies$(ART_PHONY_TEST_TARGET_SUFFIX) test-art-target-dependencies$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700246 adb remount
247 adb sync
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700248 adb shell mkdir -p $(ART_TEST_DIR)
Brian Carlstrom86927212011-09-15 11:31:11 -0700249
Brian Carlstrom86927212011-09-15 11:31:11 -0700250
Andreas Gampe2fe07922014-04-21 07:50:39 -0700251define declare-test-art-target-gtest
252.PHONY: test-art-target-gtest$(1)
253test-art-target-gtest$(1): $(ART_TARGET_GTEST_TARGETS$(1))
Andreas Gampea63229c2014-04-21 09:51:07 -0700254 @echo test-art-target-gtest$(1) PASSED
Andreas Gampe2fe07922014-04-21 07:50:39 -0700255endef
256$(eval $(call call-art-multi-target-rule,declare-test-art-target-gtest,test-art-target-gtest))
257
258
259define declare-test-art-target-oat
260.PHONY: test-art-target-oat$(1)
261test-art-target-oat$(1): $(ART_TEST_TARGET_OAT_TARGETS$(1))
262 @echo test-art-target-oat$(1) PASSED
263endef
264$(eval $(call call-art-multi-target-rule,declare-test-art-target-oat,test-art-target-oat))
265
Brian Carlstrom4a96b602011-07-26 16:40:23 -0700266
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700267define declare-test-art-target-run-test-impl
Andreas Gampe2fe07922014-04-21 07:50:39 -0700268$(2)run_test_$(1) :=
269ifeq ($($(2)ART_PHONY_TEST_TARGET_SUFFIX),64)
270 $(2)run_test_$(1) := --64
271endif
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700272.PHONY: test-art-target-run-test-$(1)$($(2)ART_PHONY_TEST_TARGET_SUFFIX)
273test-art-target-run-test-$(1)$($(2)ART_PHONY_TEST_TARGET_SUFFIX): test-art-target-sync $(DX) $(HOST_OUT_EXECUTABLES)/jasmin
Mathieu Chartier769a5ad2014-05-18 15:30:10 -0700274 DX=$(abspath $(DX)) JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) art/test/run-test $(addprefix --runtime-option ,$(DALVIKVM_FLAGS)) $$($(2)run_test_$(1)) $(1)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700275 @echo test-art-target-run-test-$(1)$($(2)ART_PHONY_TEST_TARGET_SUFFIX) PASSED
276endef
Brian Carlstrome24fa612011-09-29 00:53:55 -0700277
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700278define declare-test-art-target-run-test
279
280 ifdef TARGET_2ND_ARCH
Andreas Gampe2fe07922014-04-21 07:50:39 -0700281 $(call declare-test-art-target-run-test-impl,$(1),2ND_)
282
283 TEST_ART_TARGET_RUN_TEST_TARGETS$(2ND_ART_PHONY_TEST_TARGET_SUFFIX) += test-art-target-run-test-$(1)$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700284
285 ifneq ($(ART_PHONY_TEST_TARGET_SUFFIX),)
286 # Link primary to non-suffix
287test-art-target-run-test-$(1): test-art-target-run-test-$(1)$(ART_PHONY_TEST_TARGET_SUFFIX)
288 endif
289 endif
Andreas Gampe2fe07922014-04-21 07:50:39 -0700290 $(call declare-test-art-target-run-test-impl,$(1),)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700291
Andreas Gampe2fe07922014-04-21 07:50:39 -0700292 TEST_ART_TARGET_RUN_TEST_TARGETS$(ART_PHONY_TEST_TARGET_SUFFIX) += test-art-target-run-test-$(1)$(ART_PHONY_TEST_TARGET_SUFFIX)
Brian Carlstroma404db02013-08-28 09:37:40 -0700293
294test-art-run-test-$(1): test-art-host-run-test-$(1) test-art-target-run-test-$(1)
295
Brian Carlstrom37c44442012-03-06 22:21:18 -0800296endef
297
Brian Carlstrom934ce802014-04-01 18:09:33 -0700298$(foreach test, $(TEST_ART_RUN_TESTS), $(eval $(call declare-test-art-target-run-test,$(test))))
Brian Carlstrom37c44442012-03-06 22:21:18 -0800299
Andreas Gampe2fe07922014-04-21 07:50:39 -0700300
301define declare-test-art-target-run-test
302.PHONY: test-art-target-run-test$(1)
303test-art-target-run-test$(1): $(TEST_ART_TARGET_RUN_TEST_TARGETS$(1))
304 @echo test-art-target-run-test$(1) PASSED
305endef
306$(eval $(call call-art-multi-target-rule,declare-test-art-target-run-test,test-art-target-run-test))
307
Brian Carlstrome24fa612011-09-29 00:53:55 -0700308
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700309########################################################################
Brian Carlstrom04941d92012-02-19 01:47:51 -0800310# oat-target and oat-target-sync targets
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700311
Brian Carlstrom04941d92012-02-19 01:47:51 -0800312OAT_TARGET_TARGETS :=
313
314# $(1): input jar or apk target location
315define declare-oat-target-target
Brian Carlstrom46b8a622012-06-19 23:13:22 -0700316ifneq (,$(filter $(1),$(addprefix system/app/,$(addsuffix .apk,$(PRODUCT_DEX_PREOPT_PACKAGES_IN_DATA)))))
Brian Carlstrom999cd432013-06-22 23:08:53 -0700317OUT_OAT_FILE := $(call dalvik-cache-out,$(1)/classes.dex)
Brian Carlstrom46b8a622012-06-19 23:13:22 -0700318else
Brian Carlstrom999cd432013-06-22 23:08:53 -0700319OUT_OAT_FILE := $(PRODUCT_OUT)/$(basename $(1)).odex
Brian Carlstrom46b8a622012-06-19 23:13:22 -0700320endif
Shih-wei Liao2e01f242012-05-28 03:11:59 -0700321
322ifeq ($(ONE_SHOT_MAKEFILE),)
Brian Carlstrom90e27412013-03-13 21:51:47 -0700323# ONE_SHOT_MAKEFILE is empty for a top level build and we don't want
324# to define the oat-target-* rules there because they will conflict
325# with the build/core/dex_preopt.mk defined rules.
Brian Carlstrom04941d92012-02-19 01:47:51 -0800326.PHONY: oat-target-$(1)
Brian Carlstrom90e27412013-03-13 21:51:47 -0700327oat-target-$(1):
Shih-wei Liao2e01f242012-05-28 03:11:59 -0700328
329else
330.PHONY: oat-target-$(1)
Shih-wei Liao7eea0e82012-05-28 23:56:21 -0700331oat-target-$(1): $$(OUT_OAT_FILE)
Shih-wei Liao2e01f242012-05-28 03:11:59 -0700332
Nicolas Geoffray1db132d2014-03-26 10:56:24 +0000333$$(OUT_OAT_FILE): $(PRODUCT_OUT)/$(1) $(DEFAULT_DEX_PREOPT_BUILT_IMAGE) $(DEX2OATD_DEPENDENCY)
Brian Carlstrom90e27412013-03-13 21:51:47 -0700334 @mkdir -p $$(dir $$@)
Ian Rogers9b797762014-04-18 15:40:37 -0700335 $(DEX2OATD) --runtime-arg -Xms64m --runtime-arg -Xmx64m \
336 --boot-image=$(DEFAULT_DEX_PREOPT_BUILT_IMAGE) --dex-file=$(PRODUCT_OUT)/$(1) \
337 --dex-location=/$(1) --oat-file=$$@ \
338 --instruction-set=$(DEX2OAT_TARGET_ARCH) \
339 --instruction-set-features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
340 --android-root=$(PRODUCT_OUT)/system
Shih-wei Liao2e01f242012-05-28 03:11:59 -0700341
342endif
Brian Carlstrom04941d92012-02-19 01:47:51 -0800343
344OAT_TARGET_TARGETS += oat-target-$(1)
Brian Carlstroma9f19782011-10-13 00:14:47 -0700345endef
346
Brian Carlstrombd411022012-02-07 12:09:09 -0800347$(foreach file,\
348 $(filter-out\
Brian Carlstrom7ab763c2013-12-09 00:38:02 -0800349 $(addprefix $(TARGET_OUT_JAVA_LIBRARIES)/,$(addsuffix .jar,$(LIBART_TARGET_BOOT_JARS))),\
Brian Carlstrombd411022012-02-07 12:09:09 -0800350 $(wildcard $(TARGET_OUT_APPS)/*.apk) $(wildcard $(TARGET_OUT_JAVA_LIBRARIES)/*.jar)),\
Brian Carlstrom04941d92012-02-19 01:47:51 -0800351 $(eval $(call declare-oat-target-target,$(subst $(PRODUCT_OUT)/,,$(file)))))
352
353.PHONY: oat-target
Brian Carlstrom7ab763c2013-12-09 00:38:02 -0800354oat-target: $(ART_TARGET_DEPENDENCIES) $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) $(OAT_TARGET_TARGETS)
Ian Rogersbeb60e22012-01-31 10:40:40 -0800355
Brian Carlstroma6cc8932012-01-04 14:44:07 -0800356.PHONY: oat-target-sync
Brian Carlstrom04941d92012-02-19 01:47:51 -0800357oat-target-sync: oat-target
Brian Carlstrom0796af02011-10-12 14:31:45 -0700358 adb remount
359 adb sync
360
Brian Carlstrom76aa0c02011-10-11 15:29:43 -0700361########################################################################
Brian Carlstromfa50baa2013-08-02 01:00:27 -0700362# "m build-art" for quick minimal build
363.PHONY: build-art
364build-art: build-art-host build-art-target
365
366.PHONY: build-art-host
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800367build-art-host: $(ART_HOST_EXECUTABLES) $(ART_HOST_GTEST_EXECUTABLES) $(HOST_CORE_IMG_OUT) $(HOST_OUT)/lib/libjavacore.so
Brian Carlstromfa50baa2013-08-02 01:00:27 -0700368
369.PHONY: build-art-target
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800370build-art-target: $(ART_TARGET_EXECUTABLES) $(ART_TARGET_GTEST_EXECUTABLES) $(TARGET_CORE_IMG_OUT) $(TARGET_OUT)/lib/libjavacore.so
Brian Carlstromfa50baa2013-08-02 01:00:27 -0700371
372########################################################################
Nicolas Geoffray9583fbc2014-02-28 15:21:07 +0000373# "m art-host" for just building the files needed to run the art script
374.PHONY: art-host
Nicolas Geoffray27a935a2014-05-20 09:43:15 +0100375art-host: $(HOST_OUT_EXECUTABLES)/art $(HOST_OUT)/bin/dalvikvm $(HOST_OUT)/lib/libart.so $(HOST_OUT)/bin/dex2oat $(HOST_CORE_IMG_OUT) $(HOST_OUT)/lib/libjavacore.so
Nicolas Geoffray9583fbc2014-02-28 15:21:07 +0000376
377.PHONY: art-host-debug
378art-host-debug: art-host $(HOST_OUT)/lib/libartd.so $(HOST_OUT)/bin/dex2oatd
379
380########################################################################
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700381# oatdump targets
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700382
Ian Rogersfa824272013-11-05 16:12:57 -0800383ART_DUMP_OAT_PATH ?= $(OUT_DIR)
384
Brian Carlstrom7ab763c2013-12-09 00:38:02 -0800385OATDUMP := $(HOST_OUT_EXECUTABLES)/oatdump$(HOST_EXECUTABLE_SUFFIX)
386OATDUMPD := $(HOST_OUT_EXECUTABLES)/oatdumpd$(HOST_EXECUTABLE_SUFFIX)
387# TODO: for now, override with debug version for better error reporting
388OATDUMP := $(OATDUMPD)
389
Brian Carlstrom395520e2011-09-25 19:35:00 -0700390.PHONY: dump-oat
Ian Rogers62d6c772013-02-27 08:32:07 -0800391dump-oat: dump-oat-core dump-oat-boot
Brian Carlstrom395520e2011-09-25 19:35:00 -0700392
Brian Carlstrome10b6972011-09-26 13:49:03 -0700393.PHONY: dump-oat-core
Brian Carlstrom13c492b2012-03-22 17:09:17 -0700394dump-oat-core: dump-oat-core-host dump-oat-core-target
395
396.PHONY: dump-oat-core-host
Brian Carlstrom265091e2013-01-30 14:08:26 -0800397ifeq ($(ART_BUILD_HOST),true)
Brian Carlstrom13c492b2012-03-22 17:09:17 -0700398dump-oat-core-host: $(HOST_CORE_IMG_OUT) $(OATDUMP)
Brian Carlstrom0e12bdc2014-05-14 17:44:28 -0700399 $(OATDUMP) --image=$(HOST_CORE_IMG_LOCATION) --output=$(ART_DUMP_OAT_PATH)/core.host.oatdump.txt
Ian Rogersfa824272013-11-05 16:12:57 -0800400 @echo Output in $(ART_DUMP_OAT_PATH)/core.host.oatdump.txt
Brian Carlstrom265091e2013-01-30 14:08:26 -0800401endif
Brian Carlstrom13c492b2012-03-22 17:09:17 -0700402
403.PHONY: dump-oat-core-target
Brian Carlstrom265091e2013-01-30 14:08:26 -0800404ifeq ($(ART_BUILD_TARGET),true)
Brian Carlstrom13c492b2012-03-22 17:09:17 -0700405dump-oat-core-target: $(TARGET_CORE_IMG_OUT) $(OATDUMP)
Brian Carlstrom0f5baa02014-05-22 11:54:18 -0700406 $(OATDUMP) --image=$(TARGET_CORE_IMG_LOCATION) --output=$(ART_DUMP_OAT_PATH)/core.target.oatdump.txt --instruction-set=$(TARGET_ARCH)
Ian Rogersfa824272013-11-05 16:12:57 -0800407 @echo Output in $(ART_DUMP_OAT_PATH)/core.target.oatdump.txt
Brian Carlstrom265091e2013-01-30 14:08:26 -0800408endif
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700409
Brian Carlstrom7a6b2802014-05-25 14:38:17 -0700410.PHONY: dump-oat-boot-$(TARGET_ARCH)
Brian Carlstrom265091e2013-01-30 14:08:26 -0800411ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Brian Carlstrom7a6b2802014-05-25 14:38:17 -0700412dump-oat-boot-$(TARGET_ARCH): $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) $(OATDUMP)
413 $(OATDUMP) --image=$(DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION) --output=$(ART_DUMP_OAT_PATH)/boot.$(TARGET_ARCH).oatdump.txt --instruction-set=$(TARGET_ARCH)
414 @echo Output in $(ART_DUMP_OAT_PATH)/boot.$(TARGET_ARCH).oatdump.txt
415endif
416
417ifdef TARGET_2ND_ARCH
418dump-oat-boot-$(TARGET_2ND_ARCH): $(2ND_DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) $(OATDUMP)
419 $(OATDUMP) --image=$(2ND_DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION) --output=$(ART_DUMP_OAT_PATH)/boot.$(TARGET_2ND_ARCH).oatdump.txt --instruction-set=$(TARGET_2ND_ARCH)
420 @echo Output in $(ART_DUMP_OAT_PATH)/boot.$(TARGET_2ND_ARCH).oatdump.txt
421endif
422
423.PHONY: dump-oat-boot
424dump-oat-boot: dump-oat-boot-$(TARGET_ARCH)
425ifdef TARGET_2ND_ARCH
426dump-oat-boot: dump-oat-boot-$(TARGET_2ND_ARCH)
Brian Carlstrom265091e2013-01-30 14:08:26 -0800427endif
Brian Carlstrom78128a62011-09-15 17:21:19 -0700428
Brian Carlstrom2e92fd62012-10-18 00:04:10 -0700429.PHONY: dump-oat-Calculator
Brian Carlstrom265091e2013-01-30 14:08:26 -0800430ifeq ($(ART_BUILD_TARGET_NDEBUG),true)
Brian Carlstrom7ab763c2013-12-09 00:38:02 -0800431dump-oat-Calculator: $(TARGET_OUT_APPS)/Calculator.odex $(DEFAULT_DEX_PREOPT_BUILT_IMAGE) $(OATDUMP)
Ian Rogersfa824272013-11-05 16:12:57 -0800432 $(OATDUMP) --oat-file=$< --output=$(ART_DUMP_OAT_PATH)/Calculator.oatdump.txt
433 @echo Output in $(ART_DUMP_OAT_PATH)/Calculator.oatdump.txt
Brian Carlstrom265091e2013-01-30 14:08:26 -0800434endif
Brian Carlstrom2e92fd62012-10-18 00:04:10 -0700435
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700436########################################################################
Brian Carlstromfc0e3212013-07-17 14:40:12 -0700437# cpplint targets to style check art source files
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700438
Brian Carlstrom05eecea2013-07-18 21:59:52 -0700439include $(art_build_path)/Android.cpplint.mk
Brian Carlstrom27ec9612011-09-19 20:20:38 -0700440
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700441########################################################################
Brian Carlstroma7a60a82013-06-24 17:41:19 -0700442# targets to switch back and forth from libdvm to libart
443
444.PHONY: use-art
445use-art:
446 adb root && sleep 3
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800447 adb shell stop
Brian Carlstrom346265e2014-05-28 14:56:39 -0700448 adb shell setprop persist.sys.dalvik.vm.lib.2 libart.so
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800449 adb shell start
Brian Carlstroma7a60a82013-06-24 17:41:19 -0700450
451.PHONY: use-artd
452use-artd:
453 adb root && sleep 3
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800454 adb shell stop
Brian Carlstrom346265e2014-05-28 14:56:39 -0700455 adb shell setprop persist.sys.dalvik.vm.lib.2 libartd.so
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800456 adb shell start
Brian Carlstroma7a60a82013-06-24 17:41:19 -0700457
458.PHONY: use-dalvik
459use-dalvik:
460 adb root && sleep 3
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800461 adb shell stop
Brian Carlstrom346265e2014-05-28 14:56:39 -0700462 adb shell setprop persist.sys.dalvik.vm.lib.2 libdvm.so
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800463 adb shell start
464
465.PHONY: use-art-full
466use-art-full:
467 adb root && sleep 3
468 adb shell stop
Brian Carlstrom83ae6d22014-05-09 16:08:48 -0700469 adb shell rm -rf $(ART_DALVIK_CACHE_DIR)/*
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800470 adb shell setprop dalvik.vm.dex2oat-flags ""
471 adb shell setprop dalvik.vm.image-dex2oat-flags ""
Brian Carlstrom346265e2014-05-28 14:56:39 -0700472 adb shell setprop persist.sys.dalvik.vm.lib.2 libart.so
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800473 adb shell start
474
Hiroshi Yamauchicb9bccd2014-05-19 12:29:36 -0700475.PHONY: use-artd-full
476use-artd-full:
477 adb root && sleep 3
478 adb shell stop
479 adb shell rm -rf $(ART_DALVIK_CACHE_DIR)/*
480 adb shell setprop dalvik.vm.dex2oat-flags ""
481 adb shell setprop dalvik.vm.image-dex2oat-flags ""
Brian Carlstrom346265e2014-05-28 14:56:39 -0700482 adb shell setprop persist.sys.dalvik.vm.lib.2 libartd.so
Hiroshi Yamauchicb9bccd2014-05-19 12:29:36 -0700483 adb shell start
484
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800485.PHONY: use-art-smart
486use-art-smart:
487 adb root && sleep 3
488 adb shell stop
Brian Carlstrom83ae6d22014-05-09 16:08:48 -0700489 adb shell rm -rf $(ART_DALVIK_CACHE_DIR)/*
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800490 adb shell setprop dalvik.vm.dex2oat-flags "--compiler-filter=interpret-only"
491 adb shell setprop dalvik.vm.image-dex2oat-flags ""
Brian Carlstrom346265e2014-05-28 14:56:39 -0700492 adb shell setprop persist.sys.dalvik.vm.lib.2 libart.so
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800493 adb shell start
494
495.PHONY: use-art-interpret-only
496use-art-interpret-only:
497 adb root && sleep 3
498 adb shell stop
Brian Carlstrom83ae6d22014-05-09 16:08:48 -0700499 adb shell rm -rf $(ART_DALVIK_CACHE_DIR)/*
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800500 adb shell setprop dalvik.vm.dex2oat-flags "--compiler-filter=interpret-only"
501 adb shell setprop dalvik.vm.image-dex2oat-flags "--compiler-filter=interpret-only"
Brian Carlstrom346265e2014-05-28 14:56:39 -0700502 adb shell setprop persist.sys.dalvik.vm.lib.2 libart.so
Brian Carlstrom1e895cd2014-03-06 23:17:15 -0800503 adb shell start
Brian Carlstroma7a60a82013-06-24 17:41:19 -0700504
Jeff Hao4a200f52014-04-01 14:58:49 -0700505.PHONY: use-art-verify-none
506use-art-verify-none:
507 adb root && sleep 3
508 adb shell stop
Brian Carlstrom83ae6d22014-05-09 16:08:48 -0700509 adb shell rm -rf $(ART_DALVIK_CACHE_DIR)/*
Jeff Hao4a200f52014-04-01 14:58:49 -0700510 adb shell setprop dalvik.vm.dex2oat-flags "--compiler-filter=verify-none"
511 adb shell setprop dalvik.vm.image-dex2oat-flags "--compiler-filter=verify-none"
Brian Carlstrom346265e2014-05-28 14:56:39 -0700512 adb shell setprop persist.sys.dalvik.vm.lib.2 libart.so
Jeff Hao4a200f52014-04-01 14:58:49 -0700513 adb shell start
514
Brian Carlstroma7a60a82013-06-24 17:41:19 -0700515########################################################################
Brian Carlstrombc2f3e32011-09-22 17:16:54 -0700516
Brian Carlstrom62e3ee32012-06-18 14:58:55 -0700517endif # !art_dont_bother