Android.run-test.mk revision 31c88580deb129f99f6b9835c6e21cb86a875f88
1# 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)
17
18include 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
24########################################################################
25# The art-run-tests module, used to build all run-tests into an image.
26
27# 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
29art_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
31
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
36# Dependencies for actually running a run-test.
37TEST_ART_RUN_TEST_DEPENDENCIES := \
38  $(DX) \
39  $(HOST_OUT_EXECUTABLES)/jasmin \
40  $(HOST_OUT_EXECUTABLES)/smali \
41  $(HOST_OUT_EXECUTABLES)/dexmerger \
42  $(JACK)
43
44TEST_ART_RUN_TEST_ORDERONLY_DEPENDENCIES := setup-jack-server
45
46ifeq ($(ART_TEST_DEBUG_GC),true)
47  ART_TEST_WITH_STRACE := true
48endif
49
50ifeq ($(ART_TEST_BISECTION),true)
51  # Need to keep rebuilding the test to bisection search it.
52  ART_TEST_RUN_TEST_NO_PREBUILD := true
53  ART_TEST_RUN_TEST_PREBUILD := false
54  # Bisection search writes to standard output.
55  ART_TEST_QUIET := false
56endif
57
58# Helper to create individual build targets for tests. Must be called with $(eval).
59# $(1): the test number
60define define-build-art-run-test
61  dmart_target := $(art_run_tests_build_dir)/art-run-tests/$(1)/touch
62  dmart_install_target := $(art_run_tests_install_dir)/art-run-tests/$(1)/touch
63  run_test_options = --build-only
64  ifeq ($(ART_TEST_QUIET),true)
65    run_test_options += --quiet
66  endif
67$$(dmart_target): PRIVATE_RUN_TEST_OPTIONS := $$(run_test_options)
68$$(dmart_target): $(TEST_ART_RUN_TEST_DEPENDENCIES) $(TARGET_JACK_CLASSPATH_DEPENDENCIES) | $(TEST_ART_RUN_TEST_ORDERONLY_DEPENDENCIES)
69	$(hide) rm -rf $$(dir $$@) && mkdir -p $$(dir $$@)
70	$(hide) DX=$(abspath $(DX)) JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) \
71	  SMALI=$(abspath $(HOST_OUT_EXECUTABLES)/smali) \
72	  DXMERGER=$(abspath $(HOST_OUT_EXECUTABLES)/dexmerger) \
73	  JACK_VERSION=$(JACK_DEFAULT_VERSION) \
74	  JACK=$(abspath $(JACK)) \
75	  JACK_VERSION=$(JACK_DEFAULT_VERSION) \
76	  JACK_CLASSPATH=$(TARGET_JACK_CLASSPATH) \
77	  $(LOCAL_PATH)/run-test $$(PRIVATE_RUN_TEST_OPTIONS) --output-path $$(abspath $$(dir $$@)) $(1)
78	$(hide) touch $$@
79
80$$(dmart_install_target): $$(dmart_target)
81	$(hide) rm -rf $$(dir $$@) && mkdir -p $$(dir $$@)
82	$(hide) cp $$(dir $$<)/* $$(dir $$@)/
83
84  TEST_ART_RUN_TEST_BUILD_RULES += $$(dmart_install_target)
85  dmart_target :=
86  dmart_install_target :=
87  run_test_options :=
88endef
89$(foreach test, $(TEST_ART_RUN_TESTS), $(eval $(call define-build-art-run-test,$(test))))
90
91include $(CLEAR_VARS)
92LOCAL_MODULE_TAGS := tests
93LOCAL_MODULE := art-run-tests
94LOCAL_ADDITIONAL_DEPENDENCIES := $(TEST_ART_RUN_TEST_BUILD_RULES)
95# The build system use this flag to pick up files generated by declare-make-art-run-test.
96LOCAL_PICKUP_FILES := $(art_run_tests_install_dir)
97
98include $(BUILD_PHONY_PACKAGE)
99
100# Clear temp vars.
101art_run_tests_build_dir :=
102art_run_tests_install_dir :=
103define-build-art-run-test :=
104TEST_ART_RUN_TEST_BUILD_RULES :=
105
106########################################################################
107# General rules to build and run a run-test.
108
109TARGET_TYPES := host target
110PREBUILD_TYPES :=
111ifeq ($(ART_TEST_RUN_TEST_PREBUILD),true)
112  PREBUILD_TYPES += prebuild
113endif
114ifeq ($(ART_TEST_RUN_TEST_NO_PREBUILD),true)
115  PREBUILD_TYPES += no-prebuild
116endif
117ifeq ($(ART_TEST_RUN_TEST_NO_DEX2OAT),true)
118  PREBUILD_TYPES += no-dex2oat
119endif
120COMPILER_TYPES :=
121ifeq ($(ART_TEST_INTERPRETER_ACCESS_CHECKS),true)
122  COMPILER_TYPES += interp-ac
123endif
124ifeq ($(ART_TEST_INTERPRETER),true)
125  COMPILER_TYPES += interpreter
126endif
127ifeq ($(ART_TEST_JIT),true)
128  COMPILER_TYPES += jit
129endif
130OPTIMIZING_COMPILER_TYPES :=
131ifeq ($(ART_TEST_OPTIMIZING),true)
132  COMPILER_TYPES += optimizing
133  OPTIMIZING_COMPILER_TYPES += optimizing
134endif
135ifeq ($(ART_TEST_OPTIMIZING_GRAPH_COLOR),true)
136  COMPILER_TYPES += regalloc_gc
137  OPTIMIZING_COMPILER_TYPES += regalloc_gc
138endif
139RELOCATE_TYPES := no-relocate
140ifeq ($(ART_TEST_RUN_TEST_RELOCATE),true)
141  RELOCATE_TYPES += relocate
142endif
143ifeq ($(ART_TEST_RUN_TEST_RELOCATE_NO_PATCHOAT),true)
144  RELOCATE_TYPES += relocate-npatchoat
145endif
146TRACE_TYPES := ntrace
147ifeq ($(ART_TEST_TRACE),true)
148  TRACE_TYPES += trace
149endif
150ifeq ($(ART_TEST_TRACE_STREAM),true)
151  TRACE_TYPES += stream
152endif
153GC_TYPES := cms
154ifeq ($(ART_TEST_GC_STRESS),true)
155  GC_TYPES += gcstress
156endif
157ifeq ($(ART_TEST_GC_VERIFY),true)
158  GC_TYPES += gcverify
159endif
160JNI_TYPES := checkjni
161ifeq ($(ART_TEST_JNI_FORCECOPY),true)
162  JNI_TYPES += forcecopy
163endif
164ifeq ($(ART_TEST_RUN_TEST_IMAGE),true)
165IMAGE_TYPES := picimage
166endif
167ifeq ($(ART_TEST_RUN_TEST_NO_IMAGE),true)
168  IMAGE_TYPES += no-image
169endif
170ifeq ($(ART_TEST_RUN_TEST_MULTI_IMAGE),true)
171  IMAGE_TYPES := multipicimage
172endif
173PICTEST_TYPES := npictest
174ifeq ($(ART_TEST_PIC_TEST),true)
175  PICTEST_TYPES += pictest
176endif
177RUN_TYPES :=
178ifeq ($(ART_TEST_RUN_TEST_DEBUG),true)
179  RUN_TYPES += debug
180endif
181ifeq ($(ART_TEST_RUN_TEST_NDEBUG),true)
182  RUN_TYPES += ndebug
183endif
184DEBUGGABLE_TYPES := ndebuggable
185ifeq ($(ART_TEST_RUN_TEST_DEBUGGABLE),true)
186DEBUGGABLE_TYPES += debuggable
187endif
188ADDRESS_SIZES_TARGET := $(ART_PHONY_TEST_TARGET_SUFFIX)
189ADDRESS_SIZES_HOST := $(ART_PHONY_TEST_HOST_SUFFIX)
190ifeq ($(ART_TEST_RUN_TEST_2ND_ARCH),true)
191  ADDRESS_SIZES_TARGET += $(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
192  ADDRESS_SIZES_HOST += $(2ND_ART_PHONY_TEST_HOST_SUFFIX)
193endif
194ALL_ADDRESS_SIZES := 64 32
195
196# List all run test names with number arguments agreeing with the comment above.
197define all-run-test-names
198  $(foreach target, $(1), \
199    $(foreach run-type, $(2), \
200      $(foreach prebuild, $(3), \
201        $(foreach compiler, $(4), \
202          $(foreach relocate, $(5), \
203            $(foreach trace, $(6), \
204              $(foreach gc, $(7), \
205                $(foreach jni, $(8), \
206                  $(foreach image, $(9), \
207                    $(foreach pictest, $(10), \
208                      $(foreach debuggable, $(11), \
209                        $(foreach test, $(12), \
210                          $(foreach address_size, $(13), \
211                            test-art-$(target)-run-test-$(run-type)-$(prebuild)-$(compiler)-$(relocate)-$(trace)-$(gc)-$(jni)-$(image)-$(pictest)-$(debuggable)-$(test)$(address_size) \
212                    )))))))))))))
213endef  # all-run-test-names
214
215# To generate a full list or tests:
216# $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES),$(COMPILER_TYPES), \
217#        $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
218#        $(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_RUN_TESTS),$(ALL_ADDRESS_SIZES))
219
220# Convert's a rule name to the form used in variables, e.g. no-relocate to NO_RELOCATE
221define name-to-var
222$(shell echo $(1) | tr '[:lower:]' '[:upper:]' | tr '-' '_')
223endef  # name-to-var
224
225# Disable 115-native-bridge, it fails when run through make b/35984597.
226# Disable 153-reference-stress temporarily until a fix arrives. b/33389022.
227# Disable 080-oom-fragmentation due to flakes. b/33795328
228# Disable 497-inlining-and-class-loader and 542-unresolved-access-check until
229#     they are rewritten. These tests use a broken class loader that tries to
230#     register a dex file that's already registered with a different loader.
231#     b/34193123
232ART_TEST_RUN_TEST_SKIP += \
233  115-native-bridge \
234  153-reference-stress \
235  080-oom-fragmentation \
236  497-inlining-and-class-loader \
237  542-unresolved-access-check
238
239ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
240        $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
241        $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(ART_TEST_RUN_TEST_SKIP), $(ALL_ADDRESS_SIZES))
242
243
244# Disable 149-suspend-all-stress, its output is flaky (b/28988206).
245TEST_ART_BROKEN_ALL_TARGET_TESTS := \
246  149-suspend-all-stress \
247
248ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
249    $(COMPILER_TYPES), $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
250    $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_ALL_TARGET_TESTS), \
251    $(ALL_ADDRESS_SIZES))
252
253TEST_ART_BROKEN_ALL_TARGET_TESTS :=
254
255# Tests that are timing sensitive and flaky on heavily loaded systems.
256TEST_ART_TIMING_SENSITIVE_RUN_TESTS := \
257  002-sleep \
258  053-wait-some \
259  055-enum-performance \
260  133-static-invoke-super
261
262# disable timing sensitive tests on "dist" builds.
263ifdef dist_goal
264  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
265        $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
266        $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_TIMING_SENSITIVE_RUN_TESTS), $(ALL_ADDRESS_SIZES))
267endif
268
269# 147-stripped-dex-fallback isn't supported on device because --strip-dex
270# requires the zip command.
271# 569-checker-pattern-replacement tests behaviour present only on host.
272TEST_ART_BROKEN_TARGET_TESTS := \
273  147-stripped-dex-fallback \
274  569-checker-pattern-replacement
275
276ifneq (,$(filter target,$(TARGET_TYPES)))
277  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \
278      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
279      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_TARGET_TESTS), $(ALL_ADDRESS_SIZES))
280endif
281
282TEST_ART_BROKEN_TARGET_TESTS :=
283
284# Tests that require python3.
285TEST_ART_PYTHON3_DEPENDENCY_RUN_TESTS := \
286  960-default-smali \
287  961-default-iface-resolution-gen \
288  964-default-iface-init-gen \
289  968-default-partial-compile-gen \
290  969-iface-super \
291  970-iface-super-resolution-gen \
292  971-iface-super
293
294# Check if we have python3 to run our tests.
295ifeq ($(wildcard /usr/bin/python3),)
296  $(warning "No python3 found. Disabling tests: $(TEST_ART_PYTHON3_DEPENDENCY_RUN_TESTS)")
297
298  # Currently disable tests requiring python3 when it is not installed.
299  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
300        $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
301        $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_PYTHON3_DEPENDENCY_RUN_TESTS), $(ALL_ADDRESS_SIZES))
302endif
303
304TEST_ART_TIMING_SENSITIVE_RUN_TESTS :=
305
306# Note 116-nodex2oat is not broken per-se it just doesn't (and isn't meant to) work with --prebuild.
307TEST_ART_BROKEN_PREBUILD_RUN_TESTS := \
308  116-nodex2oat \
309  118-noimage-dex2oat \
310  134-nodex2oat-nofallback
311
312ifneq (,$(filter prebuild,$(PREBUILD_TYPES)))
313  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),prebuild, \
314      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
315      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_PREBUILD_RUN_TESTS), $(ALL_ADDRESS_SIZES))
316endif
317
318TEST_ART_BROKEN_PREBUILD_RUN_TESTS :=
319
320# 554-jit-profile-file is disabled because it needs a primary oat file to know what it should save.
321# 529 and 555: b/27784033
322TEST_ART_BROKEN_NO_PREBUILD_TESTS := \
323  117-nopatchoat \
324  147-stripped-dex-fallback \
325  554-jit-profile-file \
326  529-checker-unresolved \
327  555-checker-regression-x86const \
328  608-checker-unresolved-lse
329
330ifneq (,$(filter no-prebuild,$(PREBUILD_TYPES)))
331  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),no-prebuild, \
332      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
333      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_NO_PREBUILD_TESTS), $(ALL_ADDRESS_SIZES))
334endif
335
336TEST_ART_BROKEN_NO_PREBUILD_TESTS :=
337
338# Note 117-nopatchoat is not broken per-se it just doesn't work (and isn't meant to) without
339# --prebuild --relocate
340TEST_ART_BROKEN_NO_RELOCATE_TESTS := \
341  117-nopatchoat \
342  118-noimage-dex2oat \
343  119-noimage-patchoat \
344  554-jit-profile-file
345
346ifneq (,$(filter no-relocate,$(RELOCATE_TYPES)))
347  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
348      $(COMPILER_TYPES), no-relocate,$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
349      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_NO_RELOCATE_TESTS), $(ALL_ADDRESS_SIZES))
350endif
351
352TEST_ART_BROKEN_NO_RELOCATE_TESTS :=
353
354# Temporarily disable some broken tests when forcing access checks in interpreter b/22414682
355# 629 requires compilation.
356TEST_ART_BROKEN_INTERPRETER_ACCESS_CHECK_TESTS := \
357  137-cfi \
358  629-vdex-speed
359
360ifneq (,$(filter interp-ac,$(COMPILER_TYPES)))
361  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
362      interp-ac,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
363      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_INTERPRETER_ACCESS_CHECK_TESTS), $(ALL_ADDRESS_SIZES))
364endif
365
366TEST_ART_BROKEN_INTERPRETER_ACCESS_CHECK_TESTS :=
367
368# Tests that are broken with GC stress.
369# * 137-cfi needs to unwind a second forked process. We're using a primitive sleep to wait till we
370#   hope the second process got into the expected state. The slowness of gcstress makes this bad.
371# * 152-dead-large-object requires a heap larger than what gcstress uses.
372# * 908-gc-start-finish expects GCs only to be run at clear points. The reduced heap size makes
373#   this non-deterministic. Same for 913.
374# * 961-default-iface-resolution-gen and 964-default-iface-init-genare very long tests that often
375#   will take more than the timeout to run when gcstress is enabled. This is because gcstress
376#   slows down allocations significantly which these tests do a lot.
377# * 946-obsolete-throw: b/36335999.
378TEST_ART_BROKEN_GCSTRESS_RUN_TESTS := \
379  137-cfi \
380  152-dead-large-object \
381  154-gc-loop \
382  908-gc-start-finish \
383  913-heaps \
384  961-default-iface-resolution-gen \
385  964-default-iface-init-gen \
386  946-obsolete-throw
387
388ifneq (,$(filter gcstress,$(GC_TYPES)))
389  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
390      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),gcstress,$(JNI_TYPES), \
391      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_GCSTRESS_RUN_TESTS), $(ALL_ADDRESS_SIZES))
392endif
393
394TEST_ART_BROKEN_GCSTRESS_RUN_TESTS :=
395
396# 115-native-bridge setup is complicated. Need to implement it correctly for the target.
397ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES),$(COMPILER_TYPES), \
398    $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), 115-native-bridge, \
399    $(ALL_ADDRESS_SIZES))
400
401# 130-hprof dumps the heap and runs hprof-conv to check whether the file is somewhat readable. This
402# is only possible on the host.
403# TODO: Turn off all the other combinations, this is more about testing actual ART code. A gtest is
404#       very hard to write here, as (for a complete test) JDWP must be set up.
405ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \
406    $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
407    $(PICTEST_TYPES),$(DEBUGGABLE_TYPES),130-hprof,$(ALL_ADDRESS_SIZES))
408
409# 131 is an old test. The functionality has been implemented at an earlier stage and is checked
410# in tests 138. Blacklisted for debug builds since these builds have duplicate classes checks which
411# punt to interpreter.
412ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),debug,$(PREBUILD_TYPES), \
413    $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
414    $(PICTEST_TYPES),$(DEBUGGABLE_TYPES),131-structural-change,$(ALL_ADDRESS_SIZES))
415
416# 138-duplicate-classes-check. Turned on for debug builds since debug builds have duplicate classes
417# checks enabled, b/2133391.
418ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),ndebug,$(PREBUILD_TYPES), \
419    $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
420    $(PICTEST_TYPES),$(DEBUGGABLE_TYPES),138-duplicate-classes-check,$(ALL_ADDRESS_SIZES))
421
422# All these tests check that we have sane behavior if we don't have a patchoat or dex2oat.
423# Therefore we shouldn't run them in situations where we actually don't have these since they
424# explicitly test for them. These all also assume we have an image.
425# 147-stripped-dex-fallback is disabled because it requires --prebuild.
426# 554-jit-profile-file is disabled because it needs a primary oat file to know what it should save.
427# 629-vdex-speed requires compiled code.
428TEST_ART_BROKEN_FALLBACK_RUN_TESTS := \
429  116-nodex2oat \
430  117-nopatchoat \
431  118-noimage-dex2oat \
432  119-noimage-patchoat \
433  137-cfi \
434  138-duplicate-classes-check2 \
435  147-stripped-dex-fallback \
436  554-jit-profile-file \
437  629-vdex-speed
438
439# This test fails without an image.
440# 018, 961, 964, 968 often time out. b/34369284
441TEST_ART_BROKEN_NO_IMAGE_RUN_TESTS := \
442  137-cfi \
443  138-duplicate-classes-check \
444  018-stack-overflow \
445  616-cha \
446  616-cha-abstract \
447  912-classes \
448  961-default-iface-resolution-gen \
449  964-default-iface-init \
450  968-default-partial-compile-gen \
451
452ifneq (,$(filter no-dex2oat,$(PREBUILD_TYPES)))
453  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),no-dex2oat, \
454      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
455      $(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_FALLBACK_RUN_TESTS),$(ALL_ADDRESS_SIZES))
456endif
457
458
459ifneq (,$(filter no-image,$(IMAGE_TYPES)))
460  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
461      $(COMPILER_TYPES), $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),no-image, \
462      $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_FALLBACK_RUN_TESTS),$(ALL_ADDRESS_SIZES))
463  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
464      $(COMPILER_TYPES), $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),no-image, \
465      $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_NO_IMAGE_RUN_TESTS),$(ALL_ADDRESS_SIZES))
466endif
467
468ifneq (,$(filter relocate-npatchoat,$(RELOCATE_TYPES)))
469  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
470      $(COMPILER_TYPES), relocate-npatchoat,$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
471      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_FALLBACK_RUN_TESTS),$(ALL_ADDRESS_SIZES))
472endif
473
474TEST_ART_BROKEN_FALLBACK_RUN_TESTS :=
475
476# 137:
477# This test unrolls and expects managed frames, but tracing means we run the interpreter.
478# 802 and 570-checker-osr:
479# This test dynamically enables tracing to force a deoptimization. This makes the test meaningless
480# when already tracing, and writes an error message that we do not want to check for.
481# 130 occasional timeout b/32383962.
482# 629 requires compilation.
483TEST_ART_BROKEN_TRACING_RUN_TESTS := \
484  087-gc-after-link \
485  130-hprof \
486  137-cfi \
487  141-class-unload \
488  570-checker-osr \
489  629-vdex-speed \
490  802-deoptimization
491
492ifneq (,$(filter trace stream,$(TRACE_TYPES)))
493  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
494      $(COMPILER_TYPES),$(RELOCATE_TYPES),trace stream,$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
495      $(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_TRACING_RUN_TESTS),$(ALL_ADDRESS_SIZES))
496endif
497
498TEST_ART_BROKEN_TRACING_RUN_TESTS :=
499
500# These tests expect JIT compilation, which is suppressed when tracing.
501TEST_ART_BROKEN_JIT_TRACING_RUN_TESTS := \
502  604-hot-static-interface \
503  612-jit-dex-cache \
504  613-inlining-dex-cache \
505  616-cha \
506  626-set-resolved-string \
507
508ifneq (,$(filter trace stream,$(TRACE_TYPES)))
509  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
510      jit,$(RELOCATE_TYPES),trace stream,$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
511      $(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_JIT_TRACING_RUN_TESTS),$(ALL_ADDRESS_SIZES))
512endif
513
514TEST_ART_BROKEN_JIT_TRACING_RUN_TESTS :=
515
516# Known broken tests for the interpreter.
517# CFI unwinding expects managed frames.
518# 629 requires compilation.
519TEST_ART_BROKEN_INTERPRETER_RUN_TESTS := \
520  137-cfi \
521  554-jit-profile-file \
522  629-vdex-speed
523
524ifneq (,$(filter interpreter,$(COMPILER_TYPES)))
525  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
526      interpreter,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
527      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_INTERPRETER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
528endif
529
530TEST_ART_BROKEN_INTERPRETER_RUN_TESTS :=
531
532# Known broken tests for the JIT.
533# CFI unwinding expects managed frames, and the test does not iterate enough to even compile. JIT
534# also uses Generic JNI instead of the JNI compiler.
535# 154-gc-loop requires more deterministic GC behavior than what JIT does.
536# Test 906 iterates the heap filtering with different options. No instances should be created
537# between those runs to be able to have precise checks.
538# Test 629 requires compilation.
539# 912: b/34655682
540TEST_ART_BROKEN_JIT_RUN_TESTS := \
541  137-cfi \
542  154-gc-loop \
543  629-vdex-speed \
544  904-object-allocation \
545  906-iterate-heap \
546
547ifneq (,$(filter jit,$(COMPILER_TYPES)))
548  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
549      jit,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
550      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_JIT_RUN_TESTS),$(ALL_ADDRESS_SIZES))
551endif
552
553TEST_ART_BROKEN_JIT_RUN_TESTS :=
554
555# Known broken tests for the graph coloring register allocator.
556# These tests were based on the linear scan allocator, which makes different decisions than
557# the graph coloring allocator. (These attempt to test for code quality, not correctness.)
558TEST_ART_BROKEN_OPTIMIZING_GRAPH_COLOR := \
559  570-checker-select \
560  484-checker-register-hints
561
562ifneq (,$(filter regalloc_gc,$(COMPILER_TYPES)))
563  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
564      regalloc_gc,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
565      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
566      $(TEST_ART_BROKEN_OPTIMIZING_GRAPH_COLOR),$(ALL_ADDRESS_SIZES))
567endif
568
569# Known broken tests for the mips32 optimizing compiler backend.
570TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS := \
571
572ifeq (mips,$(TARGET_ARCH))
573  ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
574    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \
575        $(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
576        $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
577        $(TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS),$(ALL_ADDRESS_SIZES))
578  endif
579endif
580
581TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS :=
582
583# Known broken tests for the mips64 optimizing compiler backend.
584TEST_ART_BROKEN_OPTIMIZING_MIPS64_RUN_TESTS := \
585
586ifeq (mips64,$(TARGET_ARCH))
587  ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
588    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \
589        $(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
590        $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
591        $(TEST_ART_BROKEN_OPTIMIZING_MIPS64_RUN_TESTS),$(ALL_ADDRESS_SIZES))
592  endif
593endif
594
595TEST_ART_BROKEN_OPTIMIZING_MIPS64_RUN_TESTS :=
596
597# Tests that should fail when the optimizing compiler compiles them non-debuggable.
598TEST_ART_BROKEN_OPTIMIZING_NONDEBUGGABLE_RUN_TESTS := \
599  454-get-vreg \
600  457-regs \
601  602-deoptimizeable
602
603ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
604  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
605      $(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
606      $(IMAGE_TYPES),$(PICTEST_TYPES),ndebuggable,$(TEST_ART_BROKEN_OPTIMIZING_NONDEBUGGABLE_RUN_TESTS),$(ALL_ADDRESS_SIZES))
607endif
608
609TEST_ART_BROKEN_OPTIMIZING_NONDEBUGGABLE_RUN_TESTS :=
610
611# Tests that should fail when the optimizing compiler compiles them debuggable.
612TEST_ART_BROKEN_OPTIMIZING_DEBUGGABLE_RUN_TESTS := \
613
614ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
615  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
616      $(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
617      $(IMAGE_TYPES),$(PICTEST_TYPES),debuggable,$(TEST_ART_BROKEN_OPTIMIZING_DEBUGGABLE_RUN_TESTS),$(ALL_ADDRESS_SIZES))
618endif
619
620TEST_ART_BROKEN_OPTIMIZING_DEBUGGABLE_RUN_TESTS :=
621
622# Tests that should fail in the read barrier configuration with the interpreter.
623TEST_ART_BROKEN_INTERPRETER_READ_BARRIER_RUN_TESTS :=
624
625# Tests that should fail in the read barrier configuration with the Optimizing compiler (AOT).
626TEST_ART_BROKEN_OPTIMIZING_READ_BARRIER_RUN_TESTS :=
627
628# Tests that should fail in the read barrier configuration with JIT (Optimizing compiler).
629TEST_ART_BROKEN_JIT_READ_BARRIER_RUN_TESTS :=
630
631# Tests failing in non-Baker read barrier configurations with the Optimizing compiler (AOT).
632# 537 and 641: Expect an array copy to be intrinsified, but calling-on-slowpath intrinsics are not yet
633#      handled in non-Baker read barrier configurations.
634TEST_ART_BROKEN_OPTIMIZING_NON_BAKER_READ_BARRIER_RUN_TESTS := \
635  537-checker-arraycopy \
636  641-checker-arraycopy
637
638# Tests failing in non-Baker read barrier configurations with JIT (Optimizing compiler).
639# 537 and 641: Expect an array copy to be intrinsified, but calling-on-slowpath intrinsics are not yet
640#      handled in non-Baker read barrier configurations.
641TEST_ART_BROKEN_JIT_NON_BAKER_READ_BARRIER_RUN_TESTS := \
642  537-checker-arraycopy \
643  641-checker-arraycopy
644
645ifeq ($(ART_USE_READ_BARRIER),true)
646  ifneq (,$(filter interpreter,$(COMPILER_TYPES)))
647    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
648        $(PREBUILD_TYPES),interpreter,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES), \
649        $(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
650        $(TEST_ART_BROKEN_INTERPRETER_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
651  endif
652
653  ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
654    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
655        $(PREBUILD_TYPES),$(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES), \
656        $(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
657        $(TEST_ART_BROKEN_OPTIMIZING_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
658    ifneq ($(ART_READ_BARRIER_TYPE),BAKER)
659      ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
660          $(PREBUILD_TYPES),$(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES), \
661          $(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
662          $(TEST_ART_BROKEN_OPTIMIZING_NON_BAKER_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
663    endif
664  endif
665
666  ifneq (,$(filter jit,$(COMPILER_TYPES)))
667    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
668        $(PREBUILD_TYPES),jit,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES), \
669        $(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
670        $(TEST_ART_BROKEN_JIT_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
671    ifneq ($(ART_READ_BARRIER_TYPE),BAKER)
672      ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
673          $(PREBUILD_TYPES),jit,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES), \
674          $(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
675          $(TEST_ART_BROKEN_JIT_NON_BAKER_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
676    endif
677  endif
678endif
679
680TEST_ART_BROKEN_OPTIMIZING_READ_BARRIER_RUN_TESTS :=
681TEST_ART_BROKEN_JIT_READ_BARRIER_RUN_TESTS :=
682
683TEST_ART_BROKEN_NPIC_RUN_TESTS := 596-app-images
684ifneq (,$(filter npictest,$(PICTEST_TYPES)))
685  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
686      ${COMPILER_TYPES},$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
687      $(IMAGE_TYPES),npictest,$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_NPIC_RUN_TESTS),$(ALL_ADDRESS_SIZES))
688endif
689
690# Tests that should fail in the heap poisoning configuration with the Optimizing compiler.
691# 055: Exceeds run time limits due to heap poisoning instrumentation (on ARM and ARM64 devices).
692TEST_ART_BROKEN_OPTIMIZING_HEAP_POISONING_RUN_TESTS := \
693  055-enum-performance
694
695ifeq ($(ART_HEAP_POISONING),true)
696  ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
697    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
698        $(PREBUILD_TYPES),$(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
699        $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
700        $(TEST_ART_BROKEN_OPTIMIZING_HEAP_POISONING_RUN_TESTS),$(ALL_ADDRESS_SIZES))
701  endif
702endif
703
704TEST_ART_BROKEN_OPTIMIZING_HEAP_POISONING_RUN_TESTS :=
705
706# 909: Tests that check semantics for a non-debuggable app.
707# 137: relies on AOT code and debuggable makes us JIT always.
708TEST_ART_BROKEN_DEBUGGABLE_RUN_TESTS := \
709  137-cfi \
710  909-attach-agent \
711
712ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
713    $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
714    $(IMAGE_TYPES),$(PICTEST_TYPES),debuggable,$(TEST_ART_BROKEN_DEBUGGABLE_RUN_TESTS),$(ALL_ADDRESS_SIZES))
715
716TEST_ART_BROKEN_DEBUGGABLE_RUN_TESTS :=
717
718# Tests incompatible with bisection bug search. Sorted by incompatibility reason.
719# 000 through 595 do not compile anything. 089 tests a build failure. 018 through 137
720# run dalvikvm more than once. 115 and 088 assume they are always compiled.
721# 055 tests performance which is degraded during bisecting.
722TEST_ART_INCOMPATIBLE_BISECTION_SEARCH_RUN_TESTS := \
723  000-nop \
724  134-nodex2oat-nofallback \
725  147-stripped-dex-fallback \
726  595-profile-saving \
727  \
728  089-many-methods \
729  \
730  018-stack-overflow \
731  116-nodex2oat \
732  117-nopatchoat \
733  118-noimage-dex2oat \
734  119-noimage-patchoat \
735  126-miranda-multidex \
736  137-cfi \
737  \
738  115-native-bridge \
739  088-monitor-verification \
740  \
741  055-enum-performance
742
743ifeq ($(ART_TEST_BISECTION),true)
744  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
745      $(PREBUILD_TYPES),$(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
746      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
747      $(TEST_ART_INCOMPATIBLE_BISECTION_SEARCH_RUN_TESTS),$(ALL_ADDRESS_SIZES))
748endif
749
750# Clear variables ahead of appending to them when defining tests.
751$(foreach target, $(TARGET_TYPES), $(eval ART_RUN_TEST_$(call name-to-var,$(target))_RULES :=))
752$(foreach target, $(TARGET_TYPES), \
753  $(foreach prebuild, $(PREBUILD_TYPES), \
754    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(prebuild))_RULES :=)))
755$(foreach target, $(TARGET_TYPES), \
756  $(foreach compiler, $(COMPILER_TYPES), \
757    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(compiler))_RULES :=)))
758$(foreach target, $(TARGET_TYPES), \
759  $(foreach relocate, $(RELOCATE_TYPES), \
760    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(relocate))_RULES :=)))
761$(foreach target, $(TARGET_TYPES), \
762  $(foreach trace, $(TRACE_TYPES), \
763    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(trace))_RULES :=)))
764$(foreach target, $(TARGET_TYPES), \
765  $(foreach gc, $(GC_TYPES), \
766    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(gc))_RULES :=)))
767$(foreach target, $(TARGET_TYPES), \
768  $(foreach jni, $(JNI_TYPES), \
769    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(jni))_RULES :=)))
770$(foreach target, $(TARGET_TYPES), \
771  $(foreach image, $(IMAGE_TYPES), \
772    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(image))_RULES :=)))
773$(foreach target, $(TARGET_TYPES), \
774  $(foreach test, $(TEST_ART_RUN_TESTS), \
775    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(test))_RULES :=)))
776$(foreach target, $(TARGET_TYPES), \
777  $(foreach address_size, $(ALL_ADDRESS_SIZES), \
778    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(address_size))_RULES :=)))
779$(foreach target, $(TARGET_TYPES), \
780  $(foreach run_type, $(RUN_TYPES), \
781    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(run_type))_RULES :=)))
782$(foreach target, $(TARGET_TYPES), \
783  $(foreach debuggable_type, $(DEBUGGABLE_TYPES), \
784    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(debuggable_type))_RULES :=)))
785
786# We need dex2oat and dalvikvm on the target as well as the core images (all images as we sync
787# only once).
788TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_EXECUTABLES) $(TARGET_CORE_IMG_OUTS)
789
790# Also need libartagent.
791TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libartagent)
792TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libartagentd)
793ifdef TARGET_2ND_ARCH
794TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libartagent)
795TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libartagentd)
796endif
797
798# Also need libtiagent.
799TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libtiagent)
800TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libtiagentd)
801ifdef TARGET_2ND_ARCH
802TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libtiagent)
803TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libtiagentd)
804endif
805
806# Also need libarttest.
807TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libarttest)
808TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libarttestd)
809ifdef TARGET_2ND_ARCH
810TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libarttest)
811TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libarttestd)
812endif
813
814# Also need libnativebridgetest.
815TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libnativebridgetest)
816ifdef TARGET_2ND_ARCH
817TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libnativebridgetest)
818endif
819
820# Also need libopenjdkjvmti.
821TEST_ART_TARGET_SYNC_DEPS += libopenjdkjvmti
822TEST_ART_TARGET_SYNC_DEPS += libopenjdkjvmtid
823
824TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/core-libart-testdex.jar
825TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/core-oj-testdex.jar
826TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/okhttp-testdex.jar
827TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/bouncycastle-testdex.jar
828TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/conscrypt-testdex.jar
829
830# All tests require the host executables. The tests also depend on the core images, but on
831# specific version depending on the compiler.
832ART_TEST_HOST_RUN_TEST_DEPENDENCIES := \
833  $(ART_HOST_EXECUTABLES) \
834  $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libtiagent) \
835  $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libtiagentd) \
836  $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libartagent) \
837  $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libartagentd) \
838  $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libarttest) \
839  $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libarttestd) \
840  $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libnativebridgetest) \
841  $(ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION) \
842  $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdk$(ART_HOST_SHLIB_EXTENSION) \
843  $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkd$(ART_HOST_SHLIB_EXTENSION) \
844  $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmti$(ART_HOST_SHLIB_EXTENSION) \
845  $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmtid$(ART_HOST_SHLIB_EXTENSION) \
846
847ifneq ($(HOST_PREFER_32_BIT),true)
848ART_TEST_HOST_RUN_TEST_DEPENDENCIES += \
849  $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libtiagent) \
850  $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libtiagentd) \
851  $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libartagent) \
852  $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libartagentd) \
853  $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libarttest) \
854  $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libarttestd) \
855  $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libnativebridgetest) \
856  $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION) \
857  $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdk$(ART_HOST_SHLIB_EXTENSION) \
858  $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkd$(ART_HOST_SHLIB_EXTENSION) \
859  $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmti$(ART_HOST_SHLIB_EXTENSION) \
860  $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmtid$(ART_HOST_SHLIB_EXTENSION) \
861
862endif
863
864# Host executables.
865host_prereq_rules := $(ART_TEST_HOST_RUN_TEST_DEPENDENCIES)
866
867# Classpath for Jack compilation for host.
868host_prereq_rules += $(HOST_JACK_CLASSPATH_DEPENDENCIES)
869
870# Required for dx, jasmin, smali, dexmerger, jack.
871host_prereq_rules += $(TEST_ART_RUN_TEST_DEPENDENCIES)
872
873host_prereq_rules += $(HOST_OUT_EXECUTABLES)/hprof-conv
874
875# Classpath for Jack compilation for target.
876target_prereq_rules := $(TARGET_JACK_CLASSPATH_DEPENDENCIES)
877
878# Sync test files to the target, depends upon all things that must be pushed
879#to the target.
880target_prereq_rules += test-art-target-sync
881
882define core-image-dependencies
883  image_suffix := $(3)
884  ifeq ($(3),regalloc_gc)
885    image_suffix:=optimizing
886  else
887    ifeq ($(3),jit)
888      image_suffix:=interpreter
889    endif
890  endif
891  ifeq ($(2),no-image)
892    $(1)_prereq_rules += $$($(call name-to-var,$(1))_CORE_IMAGE_$$(image_suffix)_$(4))
893  else
894    ifeq ($(2),picimage)
895      $(1)_prereq_rules += $$($(call name-to-var,$(1))_CORE_IMAGE_$$(image_suffix)_$(4))
896    else
897      ifeq ($(2),multipicimage)
898        $(1)_prereq_rules += $$($(call name-to-var,$(1))_CORE_IMAGE_$$(image_suffix)_multi_$(4))
899      endif
900    endif
901  endif
902endef
903
904COMPILER_TYPES_2 := optimizing
905COMPILER_TYPES_2 += interpreter
906COMPILER_TYPES_2 += jit
907COMPILER_TYPES_2 += regalloc_gc
908COMPILER_TYPES_2 += interp-ac
909ALL_ADDRESS_SIZES_2 := 32 64
910IMAGE_TYPES_2 := picimage
911IMAGE_TYPES_2 += no-image
912IMAGE_TYPES_2 += npicimage
913IMAGE_TYPES_2 += multinpicimage
914IMAGE_TYPES_2 += multipicimage
915
916# Add core image dependencies required for given target - HOST or TARGET,
917# IMAGE_TYPE, COMPILER_TYPE and ADDRESS_SIZE to the prereq_rules.
918$(foreach target, $(TARGET_TYPES), \
919  $(foreach image, $(IMAGE_TYPES_2), \
920    $(foreach compiler, $(COMPILER_TYPES_2), \
921      $(foreach address_size, $(ALL_ADDRESS_SIZES_2), $(eval \
922        $(call core-image-dependencies,$(target),$(image),$(compiler),$(address_size)))))))
923
924test-art-host-run-test-dependencies : $(host_prereq_rules)
925test-art-target-run-test-dependencies : $(target_prereq_rules)
926test-art-run-test-dependencies : test-art-host-run-test-dependencies test-art-target-run-test-dependencies
927
928host_prereq_rules :=
929target_prereq_rules :=
930
931# Create a rule to build and run a tests following the form:
932# test-art-{1: host or target}-run-test-{2: debug ndebug}-{3: prebuild no-prebuild no-dex2oat}-
933#    {4: interpreter optimizing jit interp-ac}-
934#    {5: relocate nrelocate relocate-npatchoat}-
935#    {6: trace or ntrace}-{7: gcstress gcverify cms}-{8: forcecopy checkjni jni}-
936#    {9: no-image image picimage}-{10: pictest npictest}-
937#    {11: ndebuggable debuggable}-{12: test name}{13: 32 or 64}
938define define-test-art-run-test
939  run_test_options :=
940  prereq_rule :=
941  test_groups :=
942  uc_host_or_target :=
943  jack_classpath :=
944  ifeq ($(ART_TEST_WITH_STRACE),true)
945    run_test_options += --strace
946  endif
947  ifeq ($(ART_TEST_RUN_TEST_ALWAYS_CLEAN),true)
948    run_test_options += --always-clean
949  endif
950  ifeq ($(ART_TEST_BISECTION),true)
951    run_test_options += --bisection-search
952  endif
953  ifeq ($(1),host)
954    uc_host_or_target := HOST
955    test_groups := ART_RUN_TEST_HOST_RULES
956    run_test_options += --host
957    prereq_rule := $(ART_TEST_HOST_RUN_TEST_DEPENDENCIES) $(HOST_JACK_CLASSPATH_DEPENDENCIES)
958    jack_classpath := $(HOST_JACK_CLASSPATH)
959  else
960    ifeq ($(1),target)
961      uc_host_or_target := TARGET
962      test_groups := ART_RUN_TEST_TARGET_RULES
963      prereq_rule := test-art-target-sync $(TARGET_JACK_CLASSPATH_DEPENDENCIES)
964      jack_classpath := $(TARGET_JACK_CLASSPATH)
965    else
966      $$(error found $(1) expected $(TARGET_TYPES))
967    endif
968  endif
969  ifeq ($(2),debug)
970    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_DEBUG_RULES
971  else
972    ifeq ($(2),ndebug)
973      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELEASE_RULES
974      run_test_options += -O
975    else
976      $$(error found $(2) expected $(RUN_TYPES))
977    endif
978  endif
979  ifeq ($(3),prebuild)
980    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_PREBUILD_RULES
981    run_test_options += --prebuild
982  else
983    ifeq ($(3),no-prebuild)
984      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_PREBUILD_RULES
985      run_test_options += --no-prebuild
986    else
987      ifeq ($(3),no-dex2oat)
988        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_DEX2OAT_RULES
989        run_test_options += --no-prebuild --no-dex2oat
990      else
991        $$(error found $(3) expected $(PREBUILD_TYPES))
992      endif
993    endif
994  endif
995  ifeq ($(4),optimizing)
996    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_OPTIMIZING_RULES
997    run_test_options += --optimizing
998  else ifeq ($(4),regalloc_gc)
999    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_OPTIMIZING_GRAPH_COLOR_RULES
1000    run_test_options += --optimizing -Xcompiler-option --register-allocation-strategy=graph-color
1001  else
1002    ifeq ($(4),interpreter)
1003      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_INTERPRETER_RULES
1004      run_test_options += --interpreter
1005    else ifeq ($(4),interp-ac)
1006      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_INTERPRETER_ACCESS_CHECKS_RULES
1007      run_test_options += --interpreter --verify-soft-fail
1008    else
1009      ifeq ($(4),jit)
1010        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_JIT_RULES
1011        run_test_options += --jit
1012      else
1013        $$(error found $(4) expected $(COMPILER_TYPES))
1014      endif
1015    endif
1016  endif
1017
1018  ifeq ($(5),relocate)
1019    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELOCATE_RULES
1020    run_test_options += --relocate
1021  else
1022    ifeq ($(5),no-relocate)
1023      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_RELOCATE_RULES
1024      run_test_options += --no-relocate
1025    else
1026      ifeq ($(5),relocate-npatchoat)
1027        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELOCATE_NO_PATCHOAT_RULES
1028        run_test_options += --relocate --no-patchoat
1029      else
1030        $$(error found $(5) expected $(RELOCATE_TYPES))
1031      endif
1032    endif
1033  endif
1034  ifeq ($(6),trace)
1035    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_TRACE_RULES
1036    run_test_options += --trace
1037  else
1038    ifeq ($(6),ntrace)
1039      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_TRACE_RULES
1040    else
1041      ifeq ($(6),stream)
1042        # Group streaming under normal tracing rules.
1043        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_TRACE_RULES
1044        run_test_options += --trace --stream
1045      else
1046        $$(error found $(6) expected $(TRACE_TYPES))
1047      endif
1048    endif
1049  endif
1050  ifeq ($(7),gcverify)
1051    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_GCVERIFY_RULES
1052    run_test_options += --gcverify
1053  else
1054    ifeq ($(7),gcstress)
1055      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_GCSTRESS_RULES
1056      run_test_options += --gcstress
1057    else
1058      ifeq ($(7),cms)
1059        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_CMS_RULES
1060      else
1061        $$(error found $(7) expected $(GC_TYPES))
1062      endif
1063    endif
1064  endif
1065  ifeq ($(8),forcecopy)
1066    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_FORCECOPY_RULES
1067    run_test_options += --runtime-option -Xjniopts:forcecopy
1068    ifneq ($$(ART_TEST_JNI_FORCECOPY),true)
1069      skip_test := true
1070    endif
1071  else
1072    ifeq ($(8),checkjni)
1073      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_CHECKJNI_RULES
1074      run_test_options += --runtime-option -Xcheck:jni
1075    else
1076      ifeq ($(8),jni)
1077        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_JNI_RULES
1078      else
1079        $$(error found $(8) expected $(JNI_TYPES))
1080      endif
1081    endif
1082  endif
1083  image_suffix := $(4)
1084  ifeq ($(4),regalloc_gc)
1085    # Graph coloring tests share the image_suffix with optimizing tests.
1086    image_suffix := optimizing
1087  else
1088    ifeq ($(4),jit)
1089      # JIT tests share the image_suffix with interpreter tests.
1090      image_suffix := interpreter
1091    endif
1092  endif
1093  ifeq ($(9),no-image)
1094    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_IMAGE_RULES
1095    run_test_options += --no-image
1096    # Add the core dependency. This is required for pre-building.
1097    # Use the PIC image, as it is the default in run-test, to match dependencies.
1098    ifeq ($(1),host)
1099      prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_$(13))
1100    else
1101      prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_$(13))
1102    endif
1103  else
1104    ifeq ($(9),picimage)
1105      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_PICIMAGE_RULES
1106      ifeq ($(1),host)
1107        prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_$(13))
1108      else
1109        prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_$(13))
1110      endif
1111    else
1112      ifeq ($(9),multipicimage)
1113        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_PICIMAGE_RULES
1114        run_test_options += --multi-image
1115        ifeq ($(1),host)
1116          prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_multi_$(13))
1117        else
1118          prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_multi_$(13))
1119        endif
1120      else
1121        $$(error found $(9) expected $(IMAGE_TYPES))
1122      endif
1123    endif
1124  endif
1125  ifeq ($(10),pictest)
1126    run_test_options += --pic-test
1127  else
1128    ifeq ($(10),npictest)
1129      # Nothing to be done.
1130    else
1131      $$(error found $(10) expected $(PICTEST_TYPES))
1132    endif
1133  endif
1134  ifeq ($(11),debuggable)
1135    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_DEBUGGABLE_RULES
1136    run_test_options += --debuggable
1137  else
1138    ifeq ($(11),ndebuggable)
1139    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NONDEBUGGABLE_RULES
1140      # Nothing to be done.
1141    else
1142      $$(error found $(11) expected $(DEBUGGABLE_TYPES))
1143    endif
1144  endif
1145  # $(12) is the test name.
1146  test_groups += ART_RUN_TEST_$$(uc_host_or_target)_$(call name-to-var,$(12))_RULES
1147  ifeq ($(13),64)
1148    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_64_RULES
1149    run_test_options += --64
1150  else
1151    ifeq ($(13),32)
1152      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_32_RULES
1153    else
1154      $$(error found $(13) expected $(ALL_ADDRESS_SIZES))
1155    endif
1156  endif
1157  # Override of host instruction-set-features. Required to test advanced x86 intrinsics. The
1158  # conditionals aren't really correct, they will fail to do the right thing on a 32-bit only
1159  # host. However, this isn't common enough to worry here and make the conditions complicated.
1160  ifneq ($(DEX2OAT_HOST_INSTRUCTION_SET_FEATURES),)
1161    ifeq ($(13),64)
1162      run_test_options += --instruction-set-features $(DEX2OAT_HOST_INSTRUCTION_SET_FEATURES)
1163    endif
1164  endif
1165  ifneq ($($(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES),)
1166    ifeq ($(13),32)
1167      run_test_options += --instruction-set-features $($(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES)
1168    endif
1169  endif
1170  run_test_rule_name := test-art-$(1)-run-test-$(2)-$(3)-$(4)-$(5)-$(6)-$(7)-$(8)-$(9)-$(10)-$(11)-$(12)$(13)
1171  run_test_options := --output-path $(ART_HOST_TEST_DIR)/run-test-output/$$(run_test_rule_name) \
1172      $$(run_test_options)
1173  ifneq ($(ART_TEST_ANDROID_ROOT),)
1174    run_test_options := --android-root $(ART_TEST_ANDROID_ROOT) $$(run_test_options)
1175  endif
1176  ifeq ($(ART_TEST_QUIET),true)
1177    run_test_options += --quiet
1178  endif
1179$$(run_test_rule_name): PRIVATE_RUN_TEST_OPTIONS := $$(run_test_options)
1180$$(run_test_rule_name): PRIVATE_JACK_CLASSPATH := $$(jack_classpath)
1181.PHONY: $$(run_test_rule_name)
1182$$(run_test_rule_name): $(TEST_ART_RUN_TEST_DEPENDENCIES) $(HOST_OUT_EXECUTABLES)/hprof-conv $$(prereq_rule) | $(TEST_ART_RUN_TEST_ORDERONLY_DEPENDENCIES)
1183	$(hide) $$(call ART_TEST_SKIP,$$@) && \
1184	  DX=$(abspath $(DX)) \
1185	    JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) \
1186	    SMALI=$(abspath $(HOST_OUT_EXECUTABLES)/smali) \
1187	    DXMERGER=$(abspath $(HOST_OUT_EXECUTABLES)/dexmerger) \
1188	    JACK_VERSION=$(JACK_DEFAULT_VERSION) \
1189	    JACK=$(abspath $(JACK)) \
1190	    JACK_VERSION=$(JACK_DEFAULT_VERSION) \
1191	    JACK_CLASSPATH=$$(PRIVATE_JACK_CLASSPATH) \
1192	    art/test/run-test $$(PRIVATE_RUN_TEST_OPTIONS) $(12) \
1193	      && $$(call ART_TEST_PASSED,$$@) || $$(call ART_TEST_FAILED,$$@)
1194	$$(hide) (echo $(MAKECMDGOALS) | grep -q $$@ && \
1195	  echo "run-test run as top-level target, removing test directory $(ART_HOST_TEST_DIR)" && \
1196	  rm -r $(ART_HOST_TEST_DIR)) || true
1197
1198  $$(foreach test_group,$$(test_groups), $$(eval $$(value test_group) += $$(run_test_rule_name)))
1199
1200  # Clear locally defined variables.
1201  uc_host_or_target :=
1202  test_groups :=
1203  run_test_options :=
1204  run_test_rule_name :=
1205  prereq_rule :=
1206  jack_classpath :=
1207endef  # define-test-art-run-test
1208
1209$(foreach target, $(TARGET_TYPES), \
1210  $(foreach test, $(TEST_ART_RUN_TESTS), \
1211    $(foreach run_type, $(RUN_TYPES), \
1212      $(foreach address_size, $(ADDRESS_SIZES_$(call name-to-var,$(target))), \
1213        $(foreach prebuild, $(PREBUILD_TYPES), \
1214          $(foreach compiler, $(COMPILER_TYPES), \
1215            $(foreach relocate, $(RELOCATE_TYPES), \
1216              $(foreach trace, $(TRACE_TYPES), \
1217                $(foreach gc, $(GC_TYPES), \
1218                  $(foreach jni, $(JNI_TYPES), \
1219                    $(foreach image, $(IMAGE_TYPES), \
1220                      $(foreach pictest, $(PICTEST_TYPES), \
1221                        $(foreach debuggable, $(DEBUGGABLE_TYPES), \
1222                          $(eval $(call define-test-art-run-test,$(target),$(run_type),$(prebuild),$(compiler),$(relocate),$(trace),$(gc),$(jni),$(image),$(pictest),$(debuggable),$(test),$(address_size))) \
1223                  )))))))))))))
1224define-test-art-run-test :=
1225
1226# Define a phony rule whose purpose is to test its prerequisites.
1227# $(1): host or target
1228# $(2): list of prerequisites
1229define define-test-art-run-test-group
1230.PHONY: $(1)
1231$(1): $(2)
1232	$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
1233
1234endef  # define-test-art-run-test-group
1235
1236
1237$(foreach target, $(TARGET_TYPES), $(eval \
1238  $(call define-test-art-run-test-group,test-art-$(target)-run-test,$(ART_RUN_TEST_$(call name-to-var,$(target))_RULES))))
1239$(foreach target, $(TARGET_TYPES), \
1240  $(foreach prebuild, $(PREBUILD_TYPES), $(eval \
1241    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(prebuild),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(prebuild))_RULES)))))
1242$(foreach target, $(TARGET_TYPES), \
1243  $(foreach run-type, $(RUN_TYPES), $(eval \
1244    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(run-type),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(run-type))_RULES)))))
1245$(foreach target, $(TARGET_TYPES), \
1246  $(foreach compiler, $(COMPILER_TYPES), $(eval \
1247    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(compiler),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(compiler))_RULES)))))
1248$(foreach target, $(TARGET_TYPES), \
1249  $(foreach relocate, $(RELOCATE_TYPES), $(eval \
1250    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(relocate),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(relocate))_RULES)))))
1251$(foreach target, $(TARGET_TYPES), \
1252  $(foreach trace, $(TRACE_TYPES), $(eval \
1253    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(trace),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(trace))_RULES)))))
1254$(foreach target, $(TARGET_TYPES), \
1255  $(foreach gc, $(GC_TYPES), $(eval \
1256    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(gc),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(gc))_RULES)))))
1257$(foreach target, $(TARGET_TYPES), \
1258  $(foreach jni, $(JNI_TYPES), $(eval \
1259    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(jni),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(jni))_RULES)))))
1260$(foreach target, $(TARGET_TYPES), \
1261  $(foreach debuggable, $(DEBUGGABLE_TYPES), $(eval \
1262    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(debuggable),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(debuggable))_RULES)))))
1263$(foreach target, $(TARGET_TYPES), \
1264  $(foreach image, $(IMAGE_TYPES), $(eval \
1265    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(image),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(image))_RULES)))))
1266$(foreach target, $(TARGET_TYPES), \
1267  $(foreach test, $(TEST_ART_RUN_TESTS), $(eval \
1268    $(call define-test-art-run-test-group,test-art-$(target)-run-test-$(test),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(test))_RULES)))))
1269$(foreach target, $(TARGET_TYPES), \
1270  $(foreach address_size, $(ADDRESS_SIZES_$(call name-to-var,$(target))), $(eval \
1271    $(call define-test-art-run-test-group,test-art-$(target)-run-test$(address_size),$(ART_RUN_TEST_$(call name-to-var,$(target))_$(address_size)_RULES)))))
1272
1273# Clear variables now we're finished with them.
1274$(foreach target, $(TARGET_TYPES), $(eval ART_RUN_TEST_$(call name-to-var,$(target))_RULES :=))
1275$(foreach target, $(TARGET_TYPES), \
1276  $(foreach prebuild, $(PREBUILD_TYPES), \
1277    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(prebuild))_RULES :=)))
1278$(foreach target, $(TARGET_TYPES), \
1279  $(foreach compiler, $(COMPILER_TYPES), \
1280    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(compiler))_RULES :=)))
1281$(foreach target, $(TARGET_TYPES), \
1282  $(foreach relocate, $(RELOCATE_TYPES), \
1283    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(relocate))_RULES :=)))
1284$(foreach target, $(TARGET_TYPES), \
1285  $(foreach trace, $(TRACE_TYPES), \
1286    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(trace))_RULES :=)))
1287$(foreach target, $(TARGET_TYPES), \
1288  $(foreach gc, $(GC_TYPES), \
1289    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(gc))_RULES :=)))
1290$(foreach target, $(TARGET_TYPES), \
1291  $(foreach jni, $(JNI_TYPES), \
1292    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(jni))_RULES :=)))
1293$(foreach target, $(TARGET_TYPES), \
1294  $(foreach debuggable, $(DEBUGGABLE_TYPES), \
1295    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(debuggable))_RULES :=)))
1296$(foreach target, $(TARGET_TYPES), \
1297  $(foreach image, $(IMAGE_TYPES), \
1298    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(image))_RULES :=)))
1299$(foreach target, $(TARGET_TYPES), \
1300  $(foreach test, $(TEST_ART_RUN_TESTS), \
1301    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(test))_RULES :=)))
1302$(foreach target, $(TARGET_TYPES), \
1303  $(foreach address_size, $(ALL_ADDRESS_SIZES), \
1304    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(address_size))_RULES :=)))
1305$(foreach target, $(TARGET_TYPES), \
1306  $(foreach run_type, $(RUN_TYPES), \
1307    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(run_type))_RULES :=)))
1308define-test-art-run-test-group :=
1309TARGET_TYPES :=
1310PREBUILD_TYPES :=
1311COMPILER_TYPES :=
1312RELOCATE_TYPES :=
1313TRACE_TYPES :=
1314GC_TYPES :=
1315JNI_TYPES :=
1316IMAGE_TYPES :=
1317ADDRESS_SIZES_TARGET :=
1318ADDRESS_SIZES_HOST :=
1319ALL_ADDRESS_SIZES :=
1320RUN_TYPES :=
1321DEBUGGABLE_TYPES :=
1322
1323LOCAL_PATH :=
1324