blob: 703b911f0f823f35064c9f9210ab2bee9d1f8a91 [file] [log] [blame]
Ian Rogersafd9acc2014-06-17 08:21:54 -07001# Copyright (C) 2011 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15
16LOCAL_PATH := $(call my-dir)
Shubham Ajmera6f3d5902017-02-06 06:39:11 +000017
Ian Rogersafd9acc2014-06-17 08:21:54 -070018include art/build/Android.common_test.mk
19
20# List of all tests of the form 003-omnibus-opcodes.
21TEST_ART_RUN_TESTS := $(wildcard $(LOCAL_PATH)/[0-9]*)
22TEST_ART_RUN_TESTS := $(subst $(LOCAL_PATH)/,, $(TEST_ART_RUN_TESTS))
23
Ian Rogersf5c44b32014-08-19 16:52:36 -070024########################################################################
25# The art-run-tests module, used to build all run-tests into an image.
Alex Light9dcc4572014-08-14 14:16:26 -070026
Ian Rogersafd9acc2014-06-17 08:21:54 -070027# The path where build only targets will be output, e.g.
28# out/target/product/generic_x86_64/obj/PACKAGING/art-run-tests_intermediates/DATA
Dan Willemsen7fb2c2c2016-08-01 22:58:31 -070029art_run_tests_build_dir := $(call intermediates-dir-for,JAVA_LIBRARIES,art-run-tests)/DATA
30art_run_tests_install_dir := $(call intermediates-dir-for,PACKAGING,art-run-tests)/DATA
Ian Rogersafd9acc2014-06-17 08:21:54 -070031
32# A generated list of prerequisites that call 'run-test --build-only', the actual prerequisite is
33# an empty file touched in the intermediate directory.
34TEST_ART_RUN_TEST_BUILD_RULES :=
35
Nicolas Geoffray07f2bc12015-05-29 13:40:25 +010036# Dependencies for actually running a run-test.
Sebastien Hertz19ac0272015-02-24 17:39:50 +010037TEST_ART_RUN_TEST_DEPENDENCIES := \
38 $(DX) \
39 $(HOST_OUT_EXECUTABLES)/jasmin \
40 $(HOST_OUT_EXECUTABLES)/smali \
Sebastien Hertz2b763c32016-03-31 09:22:50 +020041 $(HOST_OUT_EXECUTABLES)/dexmerger \
42 $(JACK)
Sebastien Hertz19ac0272015-02-24 17:39:50 +010043
Sebastien Hertz2b763c32016-03-31 09:22:50 +020044TEST_ART_RUN_TEST_ORDERONLY_DEPENDENCIES := setup-jack-server
Nicolas Geoffray07f2bc12015-05-29 13:40:25 +010045
Ian Rogersafd9acc2014-06-17 08:21:54 -070046# Helper to create individual build targets for tests. Must be called with $(eval).
47# $(1): the test number
48define define-build-art-run-test
Dan Willemsen7fb2c2c2016-08-01 22:58:31 -070049 dmart_target := $(art_run_tests_build_dir)/art-run-tests/$(1)/touch
50 dmart_install_target := $(art_run_tests_install_dir)/art-run-tests/$(1)/touch
Sebastien Hertz19ac0272015-02-24 17:39:50 +010051 run_test_options = --build-only
Alex Light91de25f2015-10-28 17:00:06 -070052 ifeq ($(ART_TEST_QUIET),true)
53 run_test_options += --quiet
54 endif
Sebastien Hertz19ac0272015-02-24 17:39:50 +010055$$(dmart_target): PRIVATE_RUN_TEST_OPTIONS := $$(run_test_options)
Yohann Roussel05b91252015-12-09 12:02:46 +010056$$(dmart_target): $(TEST_ART_RUN_TEST_DEPENDENCIES) $(TARGET_JACK_CLASSPATH_DEPENDENCIES) | $(TEST_ART_RUN_TEST_ORDERONLY_DEPENDENCIES)
Ian Rogersafd9acc2014-06-17 08:21:54 -070057 $(hide) rm -rf $$(dir $$@) && mkdir -p $$(dir $$@)
58 $(hide) DX=$(abspath $(DX)) JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) \
Andreas Gampe8fda9f22014-10-03 16:15:37 -070059 SMALI=$(abspath $(HOST_OUT_EXECUTABLES)/smali) \
60 DXMERGER=$(abspath $(HOST_OUT_EXECUTABLES)/dexmerger) \
Yohann Rousselcc6bb932016-01-19 23:29:29 +010061 JACK_VERSION=$(JACK_DEFAULT_VERSION) \
Sebastien Hertz19ac0272015-02-24 17:39:50 +010062 JACK=$(abspath $(JACK)) \
Yohann Rousselaaa779a2016-01-19 17:07:18 +010063 JACK_VERSION=$(JACK_DEFAULT_VERSION) \
Sebastien Hertz19ac0272015-02-24 17:39:50 +010064 JACK_CLASSPATH=$(TARGET_JACK_CLASSPATH) \
Sebastien Hertz19ac0272015-02-24 17:39:50 +010065 $(LOCAL_PATH)/run-test $$(PRIVATE_RUN_TEST_OPTIONS) --output-path $$(abspath $$(dir $$@)) $(1)
Ian Rogersafd9acc2014-06-17 08:21:54 -070066 $(hide) touch $$@
67
Dan Willemsen7fb2c2c2016-08-01 22:58:31 -070068$$(dmart_install_target): $$(dmart_target)
69 $(hide) rm -rf $$(dir $$@) && mkdir -p $$(dir $$@)
70 $(hide) cp $$(dir $$<)/* $$(dir $$@)/
71
72 TEST_ART_RUN_TEST_BUILD_RULES += $$(dmart_install_target)
Ian Rogersafd9acc2014-06-17 08:21:54 -070073 dmart_target :=
Dan Willemsen7fb2c2c2016-08-01 22:58:31 -070074 dmart_install_target :=
Sebastien Hertz19ac0272015-02-24 17:39:50 +010075 run_test_options :=
Ian Rogersafd9acc2014-06-17 08:21:54 -070076endef
Ian Rogersbf66bce2014-06-24 23:15:34 -070077$(foreach test, $(TEST_ART_RUN_TESTS), $(eval $(call define-build-art-run-test,$(test))))
Ian Rogersafd9acc2014-06-17 08:21:54 -070078
79include $(CLEAR_VARS)
80LOCAL_MODULE_TAGS := tests
81LOCAL_MODULE := art-run-tests
Ian Rogersabbf2422014-10-15 11:57:01 -070082LOCAL_ADDITIONAL_DEPENDENCIES := $(TEST_ART_RUN_TEST_BUILD_RULES)
Ian Rogersafd9acc2014-06-17 08:21:54 -070083# The build system use this flag to pick up files generated by declare-make-art-run-test.
Dan Willemsen7fb2c2c2016-08-01 22:58:31 -070084LOCAL_PICKUP_FILES := $(art_run_tests_install_dir)
Ian Rogersafd9acc2014-06-17 08:21:54 -070085
86include $(BUILD_PHONY_PACKAGE)
87
Shubham Ajmera6f3d5902017-02-06 06:39:11 +000088# Convert's a rule name to the form used in variables, e.g. no-relocate to NO_RELOCATE
Ian Rogersf5c44b32014-08-19 16:52:36 -070089define name-to-var
90$(shell echo $(1) | tr '[:lower:]' '[:upper:]' | tr '-' '_')
91endef # name-to-var
92
Andreas Gampe63fc30e2014-10-24 21:58:16 -070093# We need dex2oat and dalvikvm on the target as well as the core images (all images as we sync
94# only once).
95TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_EXECUTABLES) $(TARGET_CORE_IMG_OUTS)
Ian Rogersafd9acc2014-06-17 08:21:54 -070096
Alex Light7233c7e2016-07-28 10:07:45 -070097# Also need libartagent.
Colin Crossafd3c9e2016-09-16 13:47:21 -070098TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libartagent)
99TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libartagentd)
Alex Light7233c7e2016-07-28 10:07:45 -0700100ifdef TARGET_2ND_ARCH
Colin Crossafd3c9e2016-09-16 13:47:21 -0700101TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libartagent)
102TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libartagentd)
Alex Light7233c7e2016-07-28 10:07:45 -0700103endif
104
Alex Light49948e92016-08-11 15:35:28 -0700105# Also need libtiagent.
Colin Crossafd3c9e2016-09-16 13:47:21 -0700106TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libtiagent)
107TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libtiagentd)
Alex Light49948e92016-08-11 15:35:28 -0700108ifdef TARGET_2ND_ARCH
Colin Crossafd3c9e2016-09-16 13:47:21 -0700109TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libtiagent)
110TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libtiagentd)
Alex Light49948e92016-08-11 15:35:28 -0700111endif
112
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700113# Also need libarttest.
Colin Crossafd3c9e2016-09-16 13:47:21 -0700114TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libarttest)
115TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libarttestd)
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700116ifdef TARGET_2ND_ARCH
Colin Crossafd3c9e2016-09-16 13:47:21 -0700117TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libarttest)
118TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libarttestd)
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700119endif
120
Andreas Gampe855564b2014-07-25 02:32:19 -0700121# Also need libnativebridgetest.
Colin Crossafd3c9e2016-09-16 13:47:21 -0700122TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libnativebridgetest)
Andreas Gampe855564b2014-07-25 02:32:19 -0700123ifdef TARGET_2ND_ARCH
Colin Crossafd3c9e2016-09-16 13:47:21 -0700124TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libnativebridgetest)
Andreas Gampe855564b2014-07-25 02:32:19 -0700125endif
126
Nicolas Geoffrayd026ee52016-11-23 10:47:02 +0000127# Also need libopenjdkjvmti.
Nicolas Geoffrayae02d2e2016-11-23 16:25:15 +0000128TEST_ART_TARGET_SYNC_DEPS += libopenjdkjvmti
129TEST_ART_TARGET_SYNC_DEPS += libopenjdkjvmtid
Nicolas Geoffrayd026ee52016-11-23 10:47:02 +0000130
Nicolas Geoffray320ccca2017-03-01 10:03:08 +0000131TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/core-libart-testdex.jar
132TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/core-oj-testdex.jar
133TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/okhttp-testdex.jar
134TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/bouncycastle-testdex.jar
135TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/conscrypt-testdex.jar
136
Andreas Gampe63fc30e2014-10-24 21:58:16 -0700137# All tests require the host executables. The tests also depend on the core images, but on
138# specific version depending on the compiler.
Ian Rogersafd9acc2014-06-17 08:21:54 -0700139ART_TEST_HOST_RUN_TEST_DEPENDENCIES := \
140 $(ART_HOST_EXECUTABLES) \
Colin Crossafd3c9e2016-09-16 13:47:21 -0700141 $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libtiagent) \
142 $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libtiagentd) \
143 $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libartagent) \
144 $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libartagentd) \
145 $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libarttest) \
146 $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libarttestd) \
147 $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libnativebridgetest) \
Narayan Kamath67ef2c92015-11-16 10:17:35 +0000148 $(ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION) \
Andreas Gampe10edbb12016-01-06 17:59:49 -0800149 $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdk$(ART_HOST_SHLIB_EXTENSION) \
Andreas Gampef2c5dbd2016-11-17 22:50:33 -0800150 $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkd$(ART_HOST_SHLIB_EXTENSION) \
151 $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmti$(ART_HOST_SHLIB_EXTENSION) \
152 $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmtid$(ART_HOST_SHLIB_EXTENSION) \
Ian Rogers665de8a2014-06-24 21:34:09 -0700153
154ifneq ($(HOST_PREFER_32_BIT),true)
155ART_TEST_HOST_RUN_TEST_DEPENDENCIES += \
Colin Crossafd3c9e2016-09-16 13:47:21 -0700156 $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libtiagent) \
157 $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libtiagentd) \
158 $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libartagent) \
159 $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libartagentd) \
160 $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libarttest) \
161 $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libarttestd) \
162 $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libnativebridgetest) \
Narayan Kamath67ef2c92015-11-16 10:17:35 +0000163 $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION) \
Andreas Gampe10edbb12016-01-06 17:59:49 -0800164 $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdk$(ART_HOST_SHLIB_EXTENSION) \
Andreas Gampef2c5dbd2016-11-17 22:50:33 -0800165 $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkd$(ART_HOST_SHLIB_EXTENSION) \
166 $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmti$(ART_HOST_SHLIB_EXTENSION) \
167 $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmtid$(ART_HOST_SHLIB_EXTENSION) \
168
Ian Rogers665de8a2014-06-24 21:34:09 -0700169endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700170
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000171# Host executables.
172host_prereq_rules := $(ART_TEST_HOST_RUN_TEST_DEPENDENCIES)
173
174# Classpath for Jack compilation for host.
175host_prereq_rules += $(HOST_JACK_CLASSPATH_DEPENDENCIES)
176
177# Required for dx, jasmin, smali, dexmerger, jack.
178host_prereq_rules += $(TEST_ART_RUN_TEST_DEPENDENCIES)
179
180host_prereq_rules += $(HOST_OUT_EXECUTABLES)/hprof-conv
181
182# Classpath for Jack compilation for target.
183target_prereq_rules := $(TARGET_JACK_CLASSPATH_DEPENDENCIES)
184
185# Sync test files to the target, depends upon all things that must be pushed
186#to the target.
187target_prereq_rules += test-art-target-sync
188
189define core-image-dependencies
190 image_suffix := $(3)
191 ifeq ($(3),regalloc_gc)
192 image_suffix:=optimizing
193 else
194 ifeq ($(3),jit)
195 image_suffix:=interpreter
196 endif
197 endif
198 ifeq ($(2),no-image)
Richard Uhlerbb00f812017-02-16 14:21:10 +0000199 $(1)_prereq_rules += $$($(call name-to-var,$(1))_CORE_IMAGE_$$(image_suffix)_$(4))
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000200 else
Richard Uhlerbb00f812017-02-16 14:21:10 +0000201 ifeq ($(2),picimage)
202 $(1)_prereq_rules += $$($(call name-to-var,$(1))_CORE_IMAGE_$$(image_suffix)_$(4))
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000203 else
Richard Uhlerbb00f812017-02-16 14:21:10 +0000204 ifeq ($(2),multipicimage)
205 $(1)_prereq_rules += $$($(call name-to-var,$(1))_CORE_IMAGE_$$(image_suffix)_multi_$(4))
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000206 endif
207 endif
208 endif
209endef
210
Shubham Ajmera4a5a1622017-03-22 10:07:19 -0700211TARGET_TYPES := host target
212COMPILER_TYPES := jit interpreter optimizing regalloc_gc jit interp-ac
213IMAGE_TYPES := picimage no-image multipicimage
214ALL_ADDRESS_SIZES := 64 32
Shubham Ajmera07a8c702017-02-16 19:50:12 +0000215
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000216# Add core image dependencies required for given target - HOST or TARGET,
217# IMAGE_TYPE, COMPILER_TYPE and ADDRESS_SIZE to the prereq_rules.
218$(foreach target, $(TARGET_TYPES), \
Shubham Ajmera4a5a1622017-03-22 10:07:19 -0700219 $(foreach image, $(IMAGE_TYPES), \
220 $(foreach compiler, $(COMPILER_TYPES), \
221 $(foreach address_size, $(ALL_ADDRESS_SIZES), $(eval \
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000222 $(call core-image-dependencies,$(target),$(image),$(compiler),$(address_size)))))))
223
224test-art-host-run-test-dependencies : $(host_prereq_rules)
225test-art-target-run-test-dependencies : $(target_prereq_rules)
226test-art-run-test-dependencies : test-art-host-run-test-dependencies test-art-target-run-test-dependencies
227
Shubham Ajmera4a5a1622017-03-22 10:07:19 -0700228# Generate list of dependencies required for given target - HOST or TARGET, IMAGE_TYPE,
229# COMPILER_TYPE and ADDRESS_SIZE.
Shubham Ajmera6f3d5902017-02-06 06:39:11 +0000230$(foreach target, $(TARGET_TYPES), \
231 $(foreach image, $(IMAGE_TYPES), \
Shubham Ajmera4a5a1622017-03-22 10:07:19 -0700232 $(foreach compiler, $(COMPILER_TYPES), \
233 $(foreach address_size, $(ALL_ADDRESS_SIZES), $(eval \
234 $(call core-image-dependencies,$(target),$(image),$(compiler),$(address_size)))))))
Shubham Ajmera6f3d5902017-02-06 06:39:11 +0000235
Shubham Ajmera4a5a1622017-03-22 10:07:19 -0700236test-art-host-run-test-dependencies : $(host_prereq_rules)
237test-art-target-run-test-dependencies : $(target_prereq_rules)
238test-art-run-test-dependencies : test-art-host-run-test-dependencies test-art-target-run-test-dependencies
239
240# Create a rule to build and run a test group of the following form:
241# test-art-{1: host target}-run-test
242define define-test-art-host-or-target-run-test-group
243 build_target := test-art-$(1)-run-test
244 .PHONY: $$(build_target)
245
246 $$(build_target) : args := --$(1) --verbose
247 $$(build_target) : test-art-$(1)-run-test-dependencies
248 ./art/test/testrunner/testrunner.py $$(args)
249 build_target :=
250 args :=
251endef # define-test-art-host-or-target-run-test-group
252
253$(foreach target, $(TARGET_TYPES), $(eval \
254 $(call define-test-art-host-or-target-run-test-group,$(target))))
255
256test-art-run-test : test-art-host-run-test test-art-target-run-test
257
258host_prereq_rules :=
259target_prereq_rules :=
260core-image-dependencies :=
261name-to-var :=
262ART_TEST_HOST_RUN_TEST_DEPENDENCIES :=
263TEST_ART_TARGET_SYNC_DEPS :=
264define-test-art-host-or-target-run-test-group :=
265TARGET_TYPES :=
266COMPILER_TYPES :=
267IMAGE_TYPES :=
268ALL_ADDRESS_SIZES :=
Alex Light7233c7e2016-07-28 10:07:45 -0700269LOCAL_PATH :=