blob: ece57622fc65a4a666274303df707c36657f6aa3 [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)
Colin Crossb6f707c2017-04-10 19:04:59 -070056$$(dmart_target): $(TEST_ART_RUN_TEST_DEPENDENCIES) | $(TEST_ART_RUN_TEST_ORDERONLY_DEPENDENCIES)
57ifeq ($(ANDROID_COMPILE_WITH_JACK),true)
58$$(dmart_target): $(TARGET_JACK_CLASSPATH_DEPENDENCIES)
59endif
60$$(dmart_target):
Ian Rogersafd9acc2014-06-17 08:21:54 -070061 $(hide) rm -rf $$(dir $$@) && mkdir -p $$(dir $$@)
62 $(hide) DX=$(abspath $(DX)) JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) \
Andreas Gampe8fda9f22014-10-03 16:15:37 -070063 SMALI=$(abspath $(HOST_OUT_EXECUTABLES)/smali) \
64 DXMERGER=$(abspath $(HOST_OUT_EXECUTABLES)/dexmerger) \
Yohann Rousselcc6bb932016-01-19 23:29:29 +010065 JACK_VERSION=$(JACK_DEFAULT_VERSION) \
Sebastien Hertz19ac0272015-02-24 17:39:50 +010066 JACK=$(abspath $(JACK)) \
Yohann Rousselaaa779a2016-01-19 17:07:18 +010067 JACK_VERSION=$(JACK_DEFAULT_VERSION) \
Sebastien Hertz19ac0272015-02-24 17:39:50 +010068 JACK_CLASSPATH=$(TARGET_JACK_CLASSPATH) \
Sebastien Hertz19ac0272015-02-24 17:39:50 +010069 $(LOCAL_PATH)/run-test $$(PRIVATE_RUN_TEST_OPTIONS) --output-path $$(abspath $$(dir $$@)) $(1)
Ian Rogersafd9acc2014-06-17 08:21:54 -070070 $(hide) touch $$@
71
Dan Willemsen7fb2c2c2016-08-01 22:58:31 -070072$$(dmart_install_target): $$(dmart_target)
73 $(hide) rm -rf $$(dir $$@) && mkdir -p $$(dir $$@)
74 $(hide) cp $$(dir $$<)/* $$(dir $$@)/
75
76 TEST_ART_RUN_TEST_BUILD_RULES += $$(dmart_install_target)
Ian Rogersafd9acc2014-06-17 08:21:54 -070077 dmart_target :=
Dan Willemsen7fb2c2c2016-08-01 22:58:31 -070078 dmart_install_target :=
Sebastien Hertz19ac0272015-02-24 17:39:50 +010079 run_test_options :=
Ian Rogersafd9acc2014-06-17 08:21:54 -070080endef
Ian Rogersbf66bce2014-06-24 23:15:34 -070081$(foreach test, $(TEST_ART_RUN_TESTS), $(eval $(call define-build-art-run-test,$(test))))
Ian Rogersafd9acc2014-06-17 08:21:54 -070082
83include $(CLEAR_VARS)
84LOCAL_MODULE_TAGS := tests
85LOCAL_MODULE := art-run-tests
Ian Rogersabbf2422014-10-15 11:57:01 -070086LOCAL_ADDITIONAL_DEPENDENCIES := $(TEST_ART_RUN_TEST_BUILD_RULES)
Ian Rogersafd9acc2014-06-17 08:21:54 -070087# The build system use this flag to pick up files generated by declare-make-art-run-test.
Dan Willemsen7fb2c2c2016-08-01 22:58:31 -070088LOCAL_PICKUP_FILES := $(art_run_tests_install_dir)
Ian Rogersafd9acc2014-06-17 08:21:54 -070089
90include $(BUILD_PHONY_PACKAGE)
91
Shubham Ajmera6f3d5902017-02-06 06:39:11 +000092# 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 -070093define name-to-var
94$(shell echo $(1) | tr '[:lower:]' '[:upper:]' | tr '-' '_')
95endef # name-to-var
96
Andreas Gampe63fc30e2014-10-24 21:58:16 -070097# We need dex2oat and dalvikvm on the target as well as the core images (all images as we sync
98# only once).
99TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_EXECUTABLES) $(TARGET_CORE_IMG_OUTS)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700100
Alex Light7233c7e2016-07-28 10:07:45 -0700101# Also need libartagent.
Colin Crossafd3c9e2016-09-16 13:47:21 -0700102TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libartagent)
103TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libartagentd)
Alex Light7233c7e2016-07-28 10:07:45 -0700104ifdef TARGET_2ND_ARCH
Colin Crossafd3c9e2016-09-16 13:47:21 -0700105TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libartagent)
106TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libartagentd)
Alex Light7233c7e2016-07-28 10:07:45 -0700107endif
108
Alex Light49948e92016-08-11 15:35:28 -0700109# Also need libtiagent.
Colin Crossafd3c9e2016-09-16 13:47:21 -0700110TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libtiagent)
111TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libtiagentd)
Alex Light49948e92016-08-11 15:35:28 -0700112ifdef TARGET_2ND_ARCH
Colin Crossafd3c9e2016-09-16 13:47:21 -0700113TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libtiagent)
114TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libtiagentd)
Alex Light49948e92016-08-11 15:35:28 -0700115endif
116
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700117# Also need libarttest.
Colin Crossafd3c9e2016-09-16 13:47:21 -0700118TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libarttest)
119TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libarttestd)
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700120ifdef TARGET_2ND_ARCH
Colin Crossafd3c9e2016-09-16 13:47:21 -0700121TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libarttest)
122TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libarttestd)
Andreas Gampe1c83cbc2014-07-22 18:52:29 -0700123endif
124
Andreas Gampe855564b2014-07-25 02:32:19 -0700125# Also need libnativebridgetest.
Colin Crossafd3c9e2016-09-16 13:47:21 -0700126TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libnativebridgetest)
Andreas Gampe855564b2014-07-25 02:32:19 -0700127ifdef TARGET_2ND_ARCH
Colin Crossafd3c9e2016-09-16 13:47:21 -0700128TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libnativebridgetest)
Andreas Gampe855564b2014-07-25 02:32:19 -0700129endif
130
Nicolas Geoffrayd026ee52016-11-23 10:47:02 +0000131# Also need libopenjdkjvmti.
Nicolas Geoffrayae02d2e2016-11-23 16:25:15 +0000132TEST_ART_TARGET_SYNC_DEPS += libopenjdkjvmti
133TEST_ART_TARGET_SYNC_DEPS += libopenjdkjvmtid
Nicolas Geoffrayd026ee52016-11-23 10:47:02 +0000134
Nicolas Geoffray320ccca2017-03-01 10:03:08 +0000135TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/core-libart-testdex.jar
136TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/core-oj-testdex.jar
137TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/okhttp-testdex.jar
138TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/bouncycastle-testdex.jar
139TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/conscrypt-testdex.jar
140
Andreas Gampe63fc30e2014-10-24 21:58:16 -0700141# All tests require the host executables. The tests also depend on the core images, but on
142# specific version depending on the compiler.
Ian Rogersafd9acc2014-06-17 08:21:54 -0700143ART_TEST_HOST_RUN_TEST_DEPENDENCIES := \
144 $(ART_HOST_EXECUTABLES) \
Nicolas Geoffraya6fbe392017-03-25 14:05:28 +0000145 $(HOST_OUT_EXECUTABLES)/hprof-conv \
Colin Crossafd3c9e2016-09-16 13:47:21 -0700146 $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libtiagent) \
147 $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libtiagentd) \
148 $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libartagent) \
149 $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libartagentd) \
150 $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libarttest) \
151 $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libarttestd) \
152 $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libnativebridgetest) \
Narayan Kamath67ef2c92015-11-16 10:17:35 +0000153 $(ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION) \
Andreas Gampe10edbb12016-01-06 17:59:49 -0800154 $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdk$(ART_HOST_SHLIB_EXTENSION) \
Andreas Gampef2c5dbd2016-11-17 22:50:33 -0800155 $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkd$(ART_HOST_SHLIB_EXTENSION) \
156 $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmti$(ART_HOST_SHLIB_EXTENSION) \
157 $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmtid$(ART_HOST_SHLIB_EXTENSION) \
Ian Rogers665de8a2014-06-24 21:34:09 -0700158
159ifneq ($(HOST_PREFER_32_BIT),true)
160ART_TEST_HOST_RUN_TEST_DEPENDENCIES += \
Colin Crossafd3c9e2016-09-16 13:47:21 -0700161 $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libtiagent) \
162 $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libtiagentd) \
163 $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libartagent) \
164 $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libartagentd) \
165 $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libarttest) \
166 $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libarttestd) \
167 $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libnativebridgetest) \
Narayan Kamath67ef2c92015-11-16 10:17:35 +0000168 $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION) \
Andreas Gampe10edbb12016-01-06 17:59:49 -0800169 $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdk$(ART_HOST_SHLIB_EXTENSION) \
Andreas Gampef2c5dbd2016-11-17 22:50:33 -0800170 $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkd$(ART_HOST_SHLIB_EXTENSION) \
171 $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmti$(ART_HOST_SHLIB_EXTENSION) \
172 $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmtid$(ART_HOST_SHLIB_EXTENSION) \
173
Ian Rogers665de8a2014-06-24 21:34:09 -0700174endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700175
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000176# Host executables.
177host_prereq_rules := $(ART_TEST_HOST_RUN_TEST_DEPENDENCIES)
178
Colin Crossb6f707c2017-04-10 19:04:59 -0700179ifeq ($(ANDROID_COMPILE_WITH_JACK),true)
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000180# Classpath for Jack compilation for host.
181host_prereq_rules += $(HOST_JACK_CLASSPATH_DEPENDENCIES)
Colin Crossb6f707c2017-04-10 19:04:59 -0700182endif
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000183
184# Required for dx, jasmin, smali, dexmerger, jack.
185host_prereq_rules += $(TEST_ART_RUN_TEST_DEPENDENCIES)
186
Colin Crossb6f707c2017-04-10 19:04:59 -0700187ifeq ($(ANDROID_COMPILE_WITH_JACK),true)
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000188# Classpath for Jack compilation for target.
189target_prereq_rules := $(TARGET_JACK_CLASSPATH_DEPENDENCIES)
Colin Crossb6f707c2017-04-10 19:04:59 -0700190endif
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000191
192# Sync test files to the target, depends upon all things that must be pushed
193#to the target.
194target_prereq_rules += test-art-target-sync
195
196define core-image-dependencies
197 image_suffix := $(3)
198 ifeq ($(3),regalloc_gc)
199 image_suffix:=optimizing
200 else
201 ifeq ($(3),jit)
202 image_suffix:=interpreter
203 endif
204 endif
205 ifeq ($(2),no-image)
Richard Uhlerbb00f812017-02-16 14:21:10 +0000206 $(1)_prereq_rules += $$($(call name-to-var,$(1))_CORE_IMAGE_$$(image_suffix)_$(4))
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000207 else
Richard Uhlerbb00f812017-02-16 14:21:10 +0000208 ifeq ($(2),picimage)
209 $(1)_prereq_rules += $$($(call name-to-var,$(1))_CORE_IMAGE_$$(image_suffix)_$(4))
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000210 else
Richard Uhlerbb00f812017-02-16 14:21:10 +0000211 ifeq ($(2),multipicimage)
212 $(1)_prereq_rules += $$($(call name-to-var,$(1))_CORE_IMAGE_$$(image_suffix)_multi_$(4))
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000213 endif
214 endif
215 endif
216endef
217
Shubham Ajmera4a5a1622017-03-22 10:07:19 -0700218TARGET_TYPES := host target
Jeff Hao002b9312017-03-27 16:23:08 -0700219COMPILER_TYPES := jit interpreter optimizing regalloc_gc jit interp-ac speed-profile
Shubham Ajmera4a5a1622017-03-22 10:07:19 -0700220IMAGE_TYPES := picimage no-image multipicimage
221ALL_ADDRESS_SIZES := 64 32
Shubham Ajmera07a8c702017-02-16 19:50:12 +0000222
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000223# Add core image dependencies required for given target - HOST or TARGET,
224# IMAGE_TYPE, COMPILER_TYPE and ADDRESS_SIZE to the prereq_rules.
225$(foreach target, $(TARGET_TYPES), \
Shubham Ajmera4a5a1622017-03-22 10:07:19 -0700226 $(foreach image, $(IMAGE_TYPES), \
227 $(foreach compiler, $(COMPILER_TYPES), \
228 $(foreach address_size, $(ALL_ADDRESS_SIZES), $(eval \
Shubham Ajmera65adb8b2017-02-06 16:04:25 +0000229 $(call core-image-dependencies,$(target),$(image),$(compiler),$(address_size)))))))
230
231test-art-host-run-test-dependencies : $(host_prereq_rules)
232test-art-target-run-test-dependencies : $(target_prereq_rules)
233test-art-run-test-dependencies : test-art-host-run-test-dependencies test-art-target-run-test-dependencies
234
Shubham Ajmera4a5a1622017-03-22 10:07:19 -0700235# Create a rule to build and run a test group of the following form:
236# test-art-{1: host target}-run-test
237define define-test-art-host-or-target-run-test-group
238 build_target := test-art-$(1)-run-test
239 .PHONY: $$(build_target)
240
241 $$(build_target) : args := --$(1) --verbose
242 $$(build_target) : test-art-$(1)-run-test-dependencies
243 ./art/test/testrunner/testrunner.py $$(args)
244 build_target :=
245 args :=
246endef # define-test-art-host-or-target-run-test-group
247
248$(foreach target, $(TARGET_TYPES), $(eval \
249 $(call define-test-art-host-or-target-run-test-group,$(target))))
250
251test-art-run-test : test-art-host-run-test test-art-target-run-test
252
253host_prereq_rules :=
254target_prereq_rules :=
255core-image-dependencies :=
256name-to-var :=
Shubham Ajmera4a5a1622017-03-22 10:07:19 -0700257define-test-art-host-or-target-run-test-group :=
258TARGET_TYPES :=
259COMPILER_TYPES :=
260IMAGE_TYPES :=
261ALL_ADDRESS_SIZES :=
Alex Light7233c7e2016-07-28 10:07:45 -0700262LOCAL_PATH :=