Android.run-test.mk revision 77e36944d0627ffa5596d2f7d1cba780d43c5b47
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.
377TEST_ART_BROKEN_GCSTRESS_RUN_TESTS := \
378  137-cfi \
379  152-dead-large-object \
380  154-gc-loop \
381  908-gc-start-finish \
382  913-heaps \
383  961-default-iface-resolution-gen \
384  964-default-iface-init-gen
385
386ifneq (,$(filter gcstress,$(GC_TYPES)))
387  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
388      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),gcstress,$(JNI_TYPES), \
389      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_GCSTRESS_RUN_TESTS), $(ALL_ADDRESS_SIZES))
390endif
391
392TEST_ART_BROKEN_GCSTRESS_RUN_TESTS :=
393
394# 115-native-bridge setup is complicated. Need to implement it correctly for the target.
395ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES),$(COMPILER_TYPES), \
396    $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), 115-native-bridge, \
397    $(ALL_ADDRESS_SIZES))
398
399# 130-hprof dumps the heap and runs hprof-conv to check whether the file is somewhat readable. This
400# is only possible on the host.
401# TODO: Turn off all the other combinations, this is more about testing actual ART code. A gtest is
402#       very hard to write here, as (for a complete test) JDWP must be set up.
403ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \
404    $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
405    $(PICTEST_TYPES),$(DEBUGGABLE_TYPES),130-hprof,$(ALL_ADDRESS_SIZES))
406
407# 131 is an old test. The functionality has been implemented at an earlier stage and is checked
408# in tests 138. Blacklisted for debug builds since these builds have duplicate classes checks which
409# punt to interpreter.
410ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),debug,$(PREBUILD_TYPES), \
411    $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
412    $(PICTEST_TYPES),$(DEBUGGABLE_TYPES),131-structural-change,$(ALL_ADDRESS_SIZES))
413
414# 138-duplicate-classes-check. Turned on for debug builds since debug builds have duplicate classes
415# checks enabled, b/2133391.
416ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),ndebug,$(PREBUILD_TYPES), \
417    $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
418    $(PICTEST_TYPES),$(DEBUGGABLE_TYPES),138-duplicate-classes-check,$(ALL_ADDRESS_SIZES))
419
420# All these tests check that we have sane behavior if we don't have a patchoat or dex2oat.
421# Therefore we shouldn't run them in situations where we actually don't have these since they
422# explicitly test for them. These all also assume we have an image.
423# 147-stripped-dex-fallback is disabled because it requires --prebuild.
424# 554-jit-profile-file is disabled because it needs a primary oat file to know what it should save.
425# 629-vdex-speed requires compiled code.
426TEST_ART_BROKEN_FALLBACK_RUN_TESTS := \
427  116-nodex2oat \
428  117-nopatchoat \
429  118-noimage-dex2oat \
430  119-noimage-patchoat \
431  137-cfi \
432  138-duplicate-classes-check2 \
433  147-stripped-dex-fallback \
434  554-jit-profile-file \
435  629-vdex-speed
436
437# This test fails without an image.
438# 018, 961, 964, 968 often time out. b/34369284
439TEST_ART_BROKEN_NO_IMAGE_RUN_TESTS := \
440  137-cfi \
441  138-duplicate-classes-check \
442  018-stack-overflow \
443  961-default-iface-resolution-gen \
444  964-default-iface-init \
445  968-default-partial-compile-gen \
446
447ifneq (,$(filter no-dex2oat,$(PREBUILD_TYPES)))
448  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),no-dex2oat, \
449      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
450      $(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_FALLBACK_RUN_TESTS),$(ALL_ADDRESS_SIZES))
451endif
452
453
454ifneq (,$(filter no-image,$(IMAGE_TYPES)))
455  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
456      $(COMPILER_TYPES), $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),no-image, \
457      $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_FALLBACK_RUN_TESTS),$(ALL_ADDRESS_SIZES))
458  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
459      $(COMPILER_TYPES), $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),no-image, \
460      $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_NO_IMAGE_RUN_TESTS),$(ALL_ADDRESS_SIZES))
461endif
462
463ifneq (,$(filter relocate-npatchoat,$(RELOCATE_TYPES)))
464  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
465      $(COMPILER_TYPES), relocate-npatchoat,$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
466      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_FALLBACK_RUN_TESTS),$(ALL_ADDRESS_SIZES))
467endif
468
469TEST_ART_BROKEN_FALLBACK_RUN_TESTS :=
470
471# 137:
472# This test unrolls and expects managed frames, but tracing means we run the interpreter.
473# 802 and 570-checker-osr:
474# This test dynamically enables tracing to force a deoptimization. This makes the test meaningless
475# when already tracing, and writes an error message that we do not want to check for.
476# 130 occasional timeout b/32383962.
477# 629 requires compilation.
478TEST_ART_BROKEN_TRACING_RUN_TESTS := \
479  087-gc-after-link \
480  130-hprof \
481  137-cfi \
482  141-class-unload \
483  570-checker-osr \
484  629-vdex-speed \
485  802-deoptimization
486
487ifneq (,$(filter trace stream,$(TRACE_TYPES)))
488  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
489      $(COMPILER_TYPES),$(RELOCATE_TYPES),trace stream,$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
490      $(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_TRACING_RUN_TESTS),$(ALL_ADDRESS_SIZES))
491endif
492
493TEST_ART_BROKEN_TRACING_RUN_TESTS :=
494
495# These tests expect JIT compilation, which is suppressed when tracing.
496TEST_ART_BROKEN_JIT_TRACING_RUN_TESTS := \
497  604-hot-static-interface \
498  612-jit-dex-cache \
499  613-inlining-dex-cache \
500  616-cha \
501  626-set-resolved-string \
502
503ifneq (,$(filter trace stream,$(TRACE_TYPES)))
504  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
505      jit,$(RELOCATE_TYPES),trace stream,$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
506      $(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_JIT_TRACING_RUN_TESTS),$(ALL_ADDRESS_SIZES))
507endif
508
509TEST_ART_BROKEN_JIT_TRACING_RUN_TESTS :=
510
511# Known broken tests for the interpreter.
512# CFI unwinding expects managed frames.
513# 629 requires compilation.
514TEST_ART_BROKEN_INTERPRETER_RUN_TESTS := \
515  137-cfi \
516  554-jit-profile-file \
517  629-vdex-speed
518
519ifneq (,$(filter interpreter,$(COMPILER_TYPES)))
520  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
521      interpreter,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
522      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_INTERPRETER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
523endif
524
525TEST_ART_BROKEN_INTERPRETER_RUN_TESTS :=
526
527# Known broken tests for the JIT.
528# CFI unwinding expects managed frames, and the test does not iterate enough to even compile. JIT
529# also uses Generic JNI instead of the JNI compiler.
530# 154-gc-loop requires more deterministic GC behavior than what JIT does.
531# Test 906 iterates the heap filtering with different options. No instances should be created
532# between those runs to be able to have precise checks.
533# Test 629 requires compilation.
534# 912: b/34655682
535TEST_ART_BROKEN_JIT_RUN_TESTS := \
536  137-cfi \
537  154-gc-loop \
538  629-vdex-speed \
539  904-object-allocation \
540  906-iterate-heap \
541
542ifneq (,$(filter jit,$(COMPILER_TYPES)))
543  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
544      jit,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
545      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_JIT_RUN_TESTS),$(ALL_ADDRESS_SIZES))
546endif
547
548TEST_ART_BROKEN_JIT_RUN_TESTS :=
549
550# Known broken tests for the graph coloring register allocator.
551# These tests were based on the linear scan allocator, which makes different decisions than
552# the graph coloring allocator. (These attempt to test for code quality, not correctness.)
553TEST_ART_BROKEN_OPTIMIZING_GRAPH_COLOR := \
554  570-checker-select \
555  484-checker-register-hints
556
557ifneq (,$(filter regalloc_gc,$(COMPILER_TYPES)))
558  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
559      regalloc_gc,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
560      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
561      $(TEST_ART_BROKEN_OPTIMIZING_GRAPH_COLOR),$(ALL_ADDRESS_SIZES))
562endif
563
564# Known broken tests for the mips32 optimizing compiler backend.
565TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS := \
566
567ifeq (mips,$(TARGET_ARCH))
568  ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
569    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \
570        $(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
571        $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
572        $(TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS),$(ALL_ADDRESS_SIZES))
573  endif
574endif
575
576TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS :=
577
578# Known broken tests for the mips64 optimizing compiler backend.
579TEST_ART_BROKEN_OPTIMIZING_MIPS64_RUN_TESTS := \
580
581ifeq (mips64,$(TARGET_ARCH))
582  ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
583    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \
584        $(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
585        $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
586        $(TEST_ART_BROKEN_OPTIMIZING_MIPS64_RUN_TESTS),$(ALL_ADDRESS_SIZES))
587  endif
588endif
589
590TEST_ART_BROKEN_OPTIMIZING_MIPS64_RUN_TESTS :=
591
592# Tests that should fail when the optimizing compiler compiles them non-debuggable.
593TEST_ART_BROKEN_OPTIMIZING_NONDEBUGGABLE_RUN_TESTS := \
594  454-get-vreg \
595  457-regs \
596  602-deoptimizeable
597
598ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
599  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
600      $(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
601      $(IMAGE_TYPES),$(PICTEST_TYPES),ndebuggable,$(TEST_ART_BROKEN_OPTIMIZING_NONDEBUGGABLE_RUN_TESTS),$(ALL_ADDRESS_SIZES))
602endif
603
604TEST_ART_BROKEN_OPTIMIZING_NONDEBUGGABLE_RUN_TESTS :=
605
606# Tests that should fail when the optimizing compiler compiles them debuggable.
607TEST_ART_BROKEN_OPTIMIZING_DEBUGGABLE_RUN_TESTS := \
608
609ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
610  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
611      $(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
612      $(IMAGE_TYPES),$(PICTEST_TYPES),debuggable,$(TEST_ART_BROKEN_OPTIMIZING_DEBUGGABLE_RUN_TESTS),$(ALL_ADDRESS_SIZES))
613endif
614
615TEST_ART_BROKEN_OPTIMIZING_DEBUGGABLE_RUN_TESTS :=
616
617# Tests that should fail in the read barrier configuration with the interpreter.
618TEST_ART_BROKEN_INTERPRETER_READ_BARRIER_RUN_TESTS :=
619
620# Tests that should fail in the read barrier configuration with the Optimizing compiler (AOT).
621TEST_ART_BROKEN_OPTIMIZING_READ_BARRIER_RUN_TESTS :=
622
623# Tests that should fail in the read barrier configuration with JIT (Optimizing compiler).
624TEST_ART_BROKEN_JIT_READ_BARRIER_RUN_TESTS :=
625
626# Tests failing in non-Baker read barrier configurations with the Optimizing compiler (AOT).
627# 537: Expects an array copy to be intrinsified, but calling-on-slowpath intrinsics are not yet
628#      handled in non-Baker read barrier configurations.
629TEST_ART_BROKEN_OPTIMIZING_NON_BAKER_READ_BARRIER_RUN_TESTS := \
630  537-checker-arraycopy
631
632# Tests failing in non-Baker read barrier configurations with JIT (Optimizing compiler).
633# 537 and 641: Expect an array copy to be intrinsified, but calling-on-slowpath intrinsics are not yet
634#      handled in non-Baker read barrier configurations.
635TEST_ART_BROKEN_JIT_NON_BAKER_READ_BARRIER_RUN_TESTS := \
636  537-checker-arraycopy \
637  641-checker-arraycopy
638
639ifeq ($(ART_USE_READ_BARRIER),true)
640  ifneq (,$(filter interpreter,$(COMPILER_TYPES)))
641    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
642        $(PREBUILD_TYPES),interpreter,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES), \
643        $(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
644        $(TEST_ART_BROKEN_INTERPRETER_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
645  endif
646
647  ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
648    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
649        $(PREBUILD_TYPES),$(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES), \
650        $(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
651        $(TEST_ART_BROKEN_OPTIMIZING_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
652    ifneq ($(ART_READ_BARRIER_TYPE),BAKER)
653      ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
654          $(PREBUILD_TYPES),$(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES), \
655          $(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
656          $(TEST_ART_BROKEN_OPTIMIZING_NON_BAKER_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
657    endif
658  endif
659
660  ifneq (,$(filter jit,$(COMPILER_TYPES)))
661    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
662        $(PREBUILD_TYPES),jit,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES), \
663        $(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
664        $(TEST_ART_BROKEN_JIT_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
665    ifneq ($(ART_READ_BARRIER_TYPE),BAKER)
666      ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
667          $(PREBUILD_TYPES),jit,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES), \
668          $(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
669          $(TEST_ART_BROKEN_JIT_NON_BAKER_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
670    endif
671  endif
672endif
673
674TEST_ART_BROKEN_OPTIMIZING_READ_BARRIER_RUN_TESTS :=
675TEST_ART_BROKEN_JIT_READ_BARRIER_RUN_TESTS :=
676
677TEST_ART_BROKEN_NPIC_RUN_TESTS := 596-app-images
678ifneq (,$(filter npictest,$(PICTEST_TYPES)))
679  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
680      ${COMPILER_TYPES},$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
681      $(IMAGE_TYPES),npictest,$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_NPIC_RUN_TESTS),$(ALL_ADDRESS_SIZES))
682endif
683
684# Tests that should fail in the heap poisoning configuration with the Optimizing compiler.
685# 055: Exceeds run time limits due to heap poisoning instrumentation (on ARM and ARM64 devices).
686TEST_ART_BROKEN_OPTIMIZING_HEAP_POISONING_RUN_TESTS := \
687  055-enum-performance
688
689ifeq ($(ART_HEAP_POISONING),true)
690  ifneq (,$(filter $(OPTIMIZING_COMPILER_TYPES),$(COMPILER_TYPES)))
691    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
692        $(PREBUILD_TYPES),$(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
693        $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
694        $(TEST_ART_BROKEN_OPTIMIZING_HEAP_POISONING_RUN_TESTS),$(ALL_ADDRESS_SIZES))
695  endif
696endif
697
698TEST_ART_BROKEN_OPTIMIZING_HEAP_POISONING_RUN_TESTS :=
699
700# 909: Tests that check semantics for a non-debuggable app.
701# 137: relies on AOT code and debuggable makes us JIT always.
702TEST_ART_BROKEN_DEBUGGABLE_RUN_TESTS := \
703  137-cfi \
704  909-attach-agent \
705
706ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
707    $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
708    $(IMAGE_TYPES),$(PICTEST_TYPES),debuggable,$(TEST_ART_BROKEN_DEBUGGABLE_RUN_TESTS),$(ALL_ADDRESS_SIZES))
709
710TEST_ART_BROKEN_DEBUGGABLE_RUN_TESTS :=
711
712# Tests incompatible with bisection bug search. Sorted by incompatibility reason.
713# 000 through 595 do not compile anything. 089 tests a build failure. 018 through 137
714# run dalvikvm more than once. 115 and 088 assume they are always compiled.
715# 055 tests performance which is degraded during bisecting.
716TEST_ART_INCOMPATIBLE_BISECTION_SEARCH_RUN_TESTS := \
717  000-nop \
718  134-nodex2oat-nofallback \
719  147-stripped-dex-fallback \
720  595-profile-saving \
721  \
722  089-many-methods \
723  \
724  018-stack-overflow \
725  116-nodex2oat \
726  117-nopatchoat \
727  118-noimage-dex2oat \
728  119-noimage-patchoat \
729  126-miranda-multidex \
730  137-cfi \
731  \
732  115-native-bridge \
733  088-monitor-verification \
734  \
735  055-enum-performance
736
737ifeq ($(ART_TEST_BISECTION),true)
738  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
739      $(PREBUILD_TYPES),$(OPTIMIZING_COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
740      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
741      $(TEST_ART_INCOMPATIBLE_BISECTION_SEARCH_RUN_TESTS),$(ALL_ADDRESS_SIZES))
742endif
743
744# Clear variables ahead of appending to them when defining tests.
745$(foreach target, $(TARGET_TYPES), $(eval ART_RUN_TEST_$(call name-to-var,$(target))_RULES :=))
746$(foreach target, $(TARGET_TYPES), \
747  $(foreach prebuild, $(PREBUILD_TYPES), \
748    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(prebuild))_RULES :=)))
749$(foreach target, $(TARGET_TYPES), \
750  $(foreach compiler, $(COMPILER_TYPES), \
751    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(compiler))_RULES :=)))
752$(foreach target, $(TARGET_TYPES), \
753  $(foreach relocate, $(RELOCATE_TYPES), \
754    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(relocate))_RULES :=)))
755$(foreach target, $(TARGET_TYPES), \
756  $(foreach trace, $(TRACE_TYPES), \
757    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(trace))_RULES :=)))
758$(foreach target, $(TARGET_TYPES), \
759  $(foreach gc, $(GC_TYPES), \
760    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(gc))_RULES :=)))
761$(foreach target, $(TARGET_TYPES), \
762  $(foreach jni, $(JNI_TYPES), \
763    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(jni))_RULES :=)))
764$(foreach target, $(TARGET_TYPES), \
765  $(foreach image, $(IMAGE_TYPES), \
766    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(image))_RULES :=)))
767$(foreach target, $(TARGET_TYPES), \
768  $(foreach test, $(TEST_ART_RUN_TESTS), \
769    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(test))_RULES :=)))
770$(foreach target, $(TARGET_TYPES), \
771  $(foreach address_size, $(ALL_ADDRESS_SIZES), \
772    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(address_size))_RULES :=)))
773$(foreach target, $(TARGET_TYPES), \
774  $(foreach run_type, $(RUN_TYPES), \
775    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(run_type))_RULES :=)))
776$(foreach target, $(TARGET_TYPES), \
777  $(foreach debuggable_type, $(DEBUGGABLE_TYPES), \
778    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(debuggable_type))_RULES :=)))
779
780# We need dex2oat and dalvikvm on the target as well as the core images (all images as we sync
781# only once).
782TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_EXECUTABLES) $(TARGET_CORE_IMG_OUTS)
783
784# Also need libartagent.
785TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libartagent)
786TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libartagentd)
787ifdef TARGET_2ND_ARCH
788TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libartagent)
789TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libartagentd)
790endif
791
792# Also need libtiagent.
793TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libtiagent)
794TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libtiagentd)
795ifdef TARGET_2ND_ARCH
796TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libtiagent)
797TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libtiagentd)
798endif
799
800# Also need libarttest.
801TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libarttest)
802TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libarttestd)
803ifdef TARGET_2ND_ARCH
804TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libarttest)
805TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libarttestd)
806endif
807
808# Also need libnativebridgetest.
809TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_ARCH)_libnativebridgetest)
810ifdef TARGET_2ND_ARCH
811TEST_ART_TARGET_SYNC_DEPS += $(OUT_DIR)/$(ART_TEST_LIST_device_$(TARGET_2ND_ARCH)_libnativebridgetest)
812endif
813
814# Also need libopenjdkjvmti.
815TEST_ART_TARGET_SYNC_DEPS += libopenjdkjvmti
816TEST_ART_TARGET_SYNC_DEPS += libopenjdkjvmtid
817
818TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/core-libart-testdex.jar
819TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/core-oj-testdex.jar
820TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/okhttp-testdex.jar
821TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/bouncycastle-testdex.jar
822TEST_ART_TARGET_SYNC_DEPS += $(TARGET_OUT_JAVA_LIBRARIES)/conscrypt-testdex.jar
823
824# All tests require the host executables. The tests also depend on the core images, but on
825# specific version depending on the compiler.
826ART_TEST_HOST_RUN_TEST_DEPENDENCIES := \
827  $(ART_HOST_EXECUTABLES) \
828  $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libtiagent) \
829  $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libtiagentd) \
830  $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libartagent) \
831  $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libartagentd) \
832  $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libarttest) \
833  $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libarttestd) \
834  $(OUT_DIR)/$(ART_TEST_LIST_host_$(ART_HOST_ARCH)_libnativebridgetest) \
835  $(ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION) \
836  $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdk$(ART_HOST_SHLIB_EXTENSION) \
837  $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkd$(ART_HOST_SHLIB_EXTENSION) \
838  $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmti$(ART_HOST_SHLIB_EXTENSION) \
839  $(ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmtid$(ART_HOST_SHLIB_EXTENSION) \
840
841ifneq ($(HOST_PREFER_32_BIT),true)
842ART_TEST_HOST_RUN_TEST_DEPENDENCIES += \
843  $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libtiagent) \
844  $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libtiagentd) \
845  $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libartagent) \
846  $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libartagentd) \
847  $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libarttest) \
848  $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libarttestd) \
849  $(OUT_DIR)/$(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_libnativebridgetest) \
850  $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION) \
851  $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdk$(ART_HOST_SHLIB_EXTENSION) \
852  $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkd$(ART_HOST_SHLIB_EXTENSION) \
853  $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmti$(ART_HOST_SHLIB_EXTENSION) \
854  $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkjvmtid$(ART_HOST_SHLIB_EXTENSION) \
855
856endif
857
858# Host executables.
859host_prereq_rules := $(ART_TEST_HOST_RUN_TEST_DEPENDENCIES)
860
861# Classpath for Jack compilation for host.
862host_prereq_rules += $(HOST_JACK_CLASSPATH_DEPENDENCIES)
863
864# Required for dx, jasmin, smali, dexmerger, jack.
865host_prereq_rules += $(TEST_ART_RUN_TEST_DEPENDENCIES)
866
867host_prereq_rules += $(HOST_OUT_EXECUTABLES)/hprof-conv
868
869# Classpath for Jack compilation for target.
870target_prereq_rules := $(TARGET_JACK_CLASSPATH_DEPENDENCIES)
871
872# Sync test files to the target, depends upon all things that must be pushed
873#to the target.
874target_prereq_rules += test-art-target-sync
875
876define core-image-dependencies
877  image_suffix := $(3)
878  ifeq ($(3),regalloc_gc)
879    image_suffix:=optimizing
880  else
881    ifeq ($(3),jit)
882      image_suffix:=interpreter
883    endif
884  endif
885  ifeq ($(2),no-image)
886    $(1)_prereq_rules += $$($(call name-to-var,$(1))_CORE_IMAGE_$$(image_suffix)_$(4))
887  else
888    ifeq ($(2),picimage)
889      $(1)_prereq_rules += $$($(call name-to-var,$(1))_CORE_IMAGE_$$(image_suffix)_$(4))
890    else
891      ifeq ($(2),multipicimage)
892        $(1)_prereq_rules += $$($(call name-to-var,$(1))_CORE_IMAGE_$$(image_suffix)_multi_$(4))
893      endif
894    endif
895  endif
896endef
897
898COMPILER_TYPES_2 := optimizing
899COMPILER_TYPES_2 += interpreter
900COMPILER_TYPES_2 += jit
901COMPILER_TYPES_2 += regalloc_gc
902COMPILER_TYPES_2 += interp-ac
903ALL_ADDRESS_SIZES_2 := 32 64
904IMAGE_TYPES_2 := picimage
905IMAGE_TYPES_2 += no-image
906IMAGE_TYPES_2 += npicimage
907IMAGE_TYPES_2 += multinpicimage
908IMAGE_TYPES_2 += multipicimage
909
910# Add core image dependencies required for given target - HOST or TARGET,
911# IMAGE_TYPE, COMPILER_TYPE and ADDRESS_SIZE to the prereq_rules.
912$(foreach target, $(TARGET_TYPES), \
913  $(foreach image, $(IMAGE_TYPES_2), \
914    $(foreach compiler, $(COMPILER_TYPES_2), \
915      $(foreach address_size, $(ALL_ADDRESS_SIZES_2), $(eval \
916        $(call core-image-dependencies,$(target),$(image),$(compiler),$(address_size)))))))
917
918test-art-host-run-test-dependencies : $(host_prereq_rules)
919test-art-target-run-test-dependencies : $(target_prereq_rules)
920test-art-run-test-dependencies : test-art-host-run-test-dependencies test-art-target-run-test-dependencies
921
922host_prereq_rules :=
923target_prereq_rules :=
924
925# Create a rule to build and run a tests following the form:
926# test-art-{1: host or target}-run-test-{2: debug ndebug}-{3: prebuild no-prebuild no-dex2oat}-
927#    {4: interpreter optimizing jit interp-ac}-
928#    {5: relocate nrelocate relocate-npatchoat}-
929#    {6: trace or ntrace}-{7: gcstress gcverify cms}-{8: forcecopy checkjni jni}-
930#    {9: no-image image picimage}-{10: pictest npictest}-
931#    {11: ndebuggable debuggable}-{12: test name}{13: 32 or 64}
932define define-test-art-run-test
933  run_test_options :=
934  prereq_rule :=
935  test_groups :=
936  uc_host_or_target :=
937  jack_classpath :=
938  ifeq ($(ART_TEST_WITH_STRACE),true)
939    run_test_options += --strace
940  endif
941  ifeq ($(ART_TEST_RUN_TEST_ALWAYS_CLEAN),true)
942    run_test_options += --always-clean
943  endif
944  ifeq ($(ART_TEST_BISECTION),true)
945    run_test_options += --bisection-search
946  endif
947  ifeq ($(1),host)
948    uc_host_or_target := HOST
949    test_groups := ART_RUN_TEST_HOST_RULES
950    run_test_options += --host
951    prereq_rule := $(ART_TEST_HOST_RUN_TEST_DEPENDENCIES) $(HOST_JACK_CLASSPATH_DEPENDENCIES)
952    jack_classpath := $(HOST_JACK_CLASSPATH)
953  else
954    ifeq ($(1),target)
955      uc_host_or_target := TARGET
956      test_groups := ART_RUN_TEST_TARGET_RULES
957      prereq_rule := test-art-target-sync $(TARGET_JACK_CLASSPATH_DEPENDENCIES)
958      jack_classpath := $(TARGET_JACK_CLASSPATH)
959    else
960      $$(error found $(1) expected $(TARGET_TYPES))
961    endif
962  endif
963  ifeq ($(2),debug)
964    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_DEBUG_RULES
965  else
966    ifeq ($(2),ndebug)
967      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELEASE_RULES
968      run_test_options += -O
969    else
970      $$(error found $(2) expected $(RUN_TYPES))
971    endif
972  endif
973  ifeq ($(3),prebuild)
974    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_PREBUILD_RULES
975    run_test_options += --prebuild
976  else
977    ifeq ($(3),no-prebuild)
978      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_PREBUILD_RULES
979      run_test_options += --no-prebuild
980    else
981      ifeq ($(3),no-dex2oat)
982        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_DEX2OAT_RULES
983        run_test_options += --no-prebuild --no-dex2oat
984      else
985        $$(error found $(3) expected $(PREBUILD_TYPES))
986      endif
987    endif
988  endif
989  ifeq ($(4),optimizing)
990    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_OPTIMIZING_RULES
991    run_test_options += --optimizing
992  else ifeq ($(4),regalloc_gc)
993    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_OPTIMIZING_GRAPH_COLOR_RULES
994    run_test_options += --optimizing -Xcompiler-option --register-allocation-strategy=graph-color
995  else
996    ifeq ($(4),interpreter)
997      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_INTERPRETER_RULES
998      run_test_options += --interpreter
999    else ifeq ($(4),interp-ac)
1000      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_INTERPRETER_ACCESS_CHECKS_RULES
1001      run_test_options += --interpreter --verify-soft-fail
1002    else
1003      ifeq ($(4),jit)
1004        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_JIT_RULES
1005        run_test_options += --jit
1006      else
1007        $$(error found $(4) expected $(COMPILER_TYPES))
1008      endif
1009    endif
1010  endif
1011
1012  ifeq ($(5),relocate)
1013    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELOCATE_RULES
1014    run_test_options += --relocate
1015  else
1016    ifeq ($(5),no-relocate)
1017      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_RELOCATE_RULES
1018      run_test_options += --no-relocate
1019    else
1020      ifeq ($(5),relocate-npatchoat)
1021        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELOCATE_NO_PATCHOAT_RULES
1022        run_test_options += --relocate --no-patchoat
1023      else
1024        $$(error found $(5) expected $(RELOCATE_TYPES))
1025      endif
1026    endif
1027  endif
1028  ifeq ($(6),trace)
1029    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_TRACE_RULES
1030    run_test_options += --trace
1031  else
1032    ifeq ($(6),ntrace)
1033      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_TRACE_RULES
1034    else
1035      ifeq ($(6),stream)
1036        # Group streaming under normal tracing rules.
1037        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_TRACE_RULES
1038        run_test_options += --trace --stream
1039      else
1040        $$(error found $(6) expected $(TRACE_TYPES))
1041      endif
1042    endif
1043  endif
1044  ifeq ($(7),gcverify)
1045    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_GCVERIFY_RULES
1046    run_test_options += --gcverify
1047  else
1048    ifeq ($(7),gcstress)
1049      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_GCSTRESS_RULES
1050      run_test_options += --gcstress
1051    else
1052      ifeq ($(7),cms)
1053        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_CMS_RULES
1054      else
1055        $$(error found $(7) expected $(GC_TYPES))
1056      endif
1057    endif
1058  endif
1059  ifeq ($(8),forcecopy)
1060    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_FORCECOPY_RULES
1061    run_test_options += --runtime-option -Xjniopts:forcecopy
1062    ifneq ($$(ART_TEST_JNI_FORCECOPY),true)
1063      skip_test := true
1064    endif
1065  else
1066    ifeq ($(8),checkjni)
1067      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_CHECKJNI_RULES
1068      run_test_options += --runtime-option -Xcheck:jni
1069    else
1070      ifeq ($(8),jni)
1071        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_JNI_RULES
1072      else
1073        $$(error found $(8) expected $(JNI_TYPES))
1074      endif
1075    endif
1076  endif
1077  image_suffix := $(4)
1078  ifeq ($(4),regalloc_gc)
1079    # Graph coloring tests share the image_suffix with optimizing tests.
1080    image_suffix := optimizing
1081  else
1082    ifeq ($(4),jit)
1083      # JIT tests share the image_suffix with interpreter tests.
1084      image_suffix := interpreter
1085    endif
1086  endif
1087  ifeq ($(9),no-image)
1088    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_IMAGE_RULES
1089    run_test_options += --no-image
1090    # Add the core dependency. This is required for pre-building.
1091    # Use the PIC image, as it is the default in run-test, to match dependencies.
1092    ifeq ($(1),host)
1093      prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_$(13))
1094    else
1095      prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_$(13))
1096    endif
1097  else
1098    ifeq ($(9),picimage)
1099      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_PICIMAGE_RULES
1100      ifeq ($(1),host)
1101        prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_$(13))
1102      else
1103        prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_$(13))
1104      endif
1105    else
1106      ifeq ($(9),multipicimage)
1107        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_PICIMAGE_RULES
1108        run_test_options += --multi-image
1109        ifeq ($(1),host)
1110          prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_multi_$(13))
1111        else
1112          prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_multi_$(13))
1113        endif
1114      else
1115        $$(error found $(9) expected $(IMAGE_TYPES))
1116      endif
1117    endif
1118  endif
1119  ifeq ($(10),pictest)
1120    run_test_options += --pic-test
1121  else
1122    ifeq ($(10),npictest)
1123      # Nothing to be done.
1124    else
1125      $$(error found $(10) expected $(PICTEST_TYPES))
1126    endif
1127  endif
1128  ifeq ($(11),debuggable)
1129    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_DEBUGGABLE_RULES
1130    run_test_options += --debuggable
1131  else
1132    ifeq ($(11),ndebuggable)
1133    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NONDEBUGGABLE_RULES
1134      # Nothing to be done.
1135    else
1136      $$(error found $(11) expected $(DEBUGGABLE_TYPES))
1137    endif
1138  endif
1139  # $(12) is the test name.
1140  test_groups += ART_RUN_TEST_$$(uc_host_or_target)_$(call name-to-var,$(12))_RULES
1141  ifeq ($(13),64)
1142    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_64_RULES
1143    run_test_options += --64
1144  else
1145    ifeq ($(13),32)
1146      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_32_RULES
1147    else
1148      $$(error found $(13) expected $(ALL_ADDRESS_SIZES))
1149    endif
1150  endif
1151  # Override of host instruction-set-features. Required to test advanced x86 intrinsics. The
1152  # conditionals aren't really correct, they will fail to do the right thing on a 32-bit only
1153  # host. However, this isn't common enough to worry here and make the conditions complicated.
1154  ifneq ($(DEX2OAT_HOST_INSTRUCTION_SET_FEATURES),)
1155    ifeq ($(13),64)
1156      run_test_options += --instruction-set-features $(DEX2OAT_HOST_INSTRUCTION_SET_FEATURES)
1157    endif
1158  endif
1159  ifneq ($($(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES),)
1160    ifeq ($(13),32)
1161      run_test_options += --instruction-set-features $($(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES)
1162    endif
1163  endif
1164  run_test_rule_name := test-art-$(1)-run-test-$(2)-$(3)-$(4)-$(5)-$(6)-$(7)-$(8)-$(9)-$(10)-$(11)-$(12)$(13)
1165  run_test_options := --output-path $(ART_HOST_TEST_DIR)/run-test-output/$$(run_test_rule_name) \
1166      $$(run_test_options)
1167  ifneq ($(ART_TEST_ANDROID_ROOT),)
1168    run_test_options := --android-root $(ART_TEST_ANDROID_ROOT) $$(run_test_options)
1169  endif
1170  ifeq ($(ART_TEST_QUIET),true)
1171    run_test_options += --quiet
1172  endif
1173$$(run_test_rule_name): PRIVATE_RUN_TEST_OPTIONS := $$(run_test_options)
1174$$(run_test_rule_name): PRIVATE_JACK_CLASSPATH := $$(jack_classpath)
1175.PHONY: $$(run_test_rule_name)
1176$$(run_test_rule_name): $(TEST_ART_RUN_TEST_DEPENDENCIES) $(HOST_OUT_EXECUTABLES)/hprof-conv $$(prereq_rule) | $(TEST_ART_RUN_TEST_ORDERONLY_DEPENDENCIES)
1177	$(hide) $$(call ART_TEST_SKIP,$$@) && \
1178	  DX=$(abspath $(DX)) \
1179	    JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) \
1180	    SMALI=$(abspath $(HOST_OUT_EXECUTABLES)/smali) \
1181	    DXMERGER=$(abspath $(HOST_OUT_EXECUTABLES)/dexmerger) \
1182	    JACK_VERSION=$(JACK_DEFAULT_VERSION) \
1183	    JACK=$(abspath $(JACK)) \
1184	    JACK_VERSION=$(JACK_DEFAULT_VERSION) \
1185	    JACK_CLASSPATH=$$(PRIVATE_JACK_CLASSPATH) \
1186	    art/test/run-test $$(PRIVATE_RUN_TEST_OPTIONS) $(12) \
1187	      && $$(call ART_TEST_PASSED,$$@) || $$(call ART_TEST_FAILED,$$@)
1188	$$(hide) (echo $(MAKECMDGOALS) | grep -q $$@ && \
1189	  echo "run-test run as top-level target, removing test directory $(ART_HOST_TEST_DIR)" && \
1190	  rm -r $(ART_HOST_TEST_DIR)) || true
1191
1192  $$(foreach test_group,$$(test_groups), $$(eval $$(value test_group) += $$(run_test_rule_name)))
1193
1194  # Clear locally defined variables.
1195  uc_host_or_target :=
1196  test_groups :=
1197  run_test_options :=
1198  run_test_rule_name :=
1199  prereq_rule :=
1200  jack_classpath :=
1201endef  # define-test-art-run-test
1202
1203$(foreach target, $(TARGET_TYPES), \
1204  $(foreach test, $(TEST_ART_RUN_TESTS), \
1205    $(foreach run_type, $(RUN_TYPES), \
1206      $(foreach address_size, $(ADDRESS_SIZES_$(call name-to-var,$(target))), \
1207        $(foreach prebuild, $(PREBUILD_TYPES), \
1208          $(foreach compiler, $(COMPILER_TYPES), \
1209            $(foreach relocate, $(RELOCATE_TYPES), \
1210              $(foreach trace, $(TRACE_TYPES), \
1211                $(foreach gc, $(GC_TYPES), \
1212                  $(foreach jni, $(JNI_TYPES), \
1213                    $(foreach image, $(IMAGE_TYPES), \
1214                      $(foreach pictest, $(PICTEST_TYPES), \
1215                        $(foreach debuggable, $(DEBUGGABLE_TYPES), \
1216                          $(eval $(call define-test-art-run-test,$(target),$(run_type),$(prebuild),$(compiler),$(relocate),$(trace),$(gc),$(jni),$(image),$(pictest),$(debuggable),$(test),$(address_size))) \
1217                  )))))))))))))
1218define-test-art-run-test :=
1219
1220# Define a phony rule whose purpose is to test its prerequisites.
1221# $(1): host or target
1222# $(2): list of prerequisites
1223define define-test-art-run-test-group
1224.PHONY: $(1)
1225$(1): $(2)
1226	$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
1227
1228endef  # define-test-art-run-test-group
1229
1230
1231$(foreach target, $(TARGET_TYPES), $(eval \
1232  $(call define-test-art-run-test-group,test-art-$(target)-run-test,$(ART_RUN_TEST_$(call name-to-var,$(target))_RULES))))
1233$(foreach target, $(TARGET_TYPES), \
1234  $(foreach prebuild, $(PREBUILD_TYPES), $(eval \
1235    $(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)))))
1236$(foreach target, $(TARGET_TYPES), \
1237  $(foreach run-type, $(RUN_TYPES), $(eval \
1238    $(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)))))
1239$(foreach target, $(TARGET_TYPES), \
1240  $(foreach compiler, $(COMPILER_TYPES), $(eval \
1241    $(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)))))
1242$(foreach target, $(TARGET_TYPES), \
1243  $(foreach relocate, $(RELOCATE_TYPES), $(eval \
1244    $(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)))))
1245$(foreach target, $(TARGET_TYPES), \
1246  $(foreach trace, $(TRACE_TYPES), $(eval \
1247    $(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)))))
1248$(foreach target, $(TARGET_TYPES), \
1249  $(foreach gc, $(GC_TYPES), $(eval \
1250    $(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)))))
1251$(foreach target, $(TARGET_TYPES), \
1252  $(foreach jni, $(JNI_TYPES), $(eval \
1253    $(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)))))
1254$(foreach target, $(TARGET_TYPES), \
1255  $(foreach debuggable, $(DEBUGGABLE_TYPES), $(eval \
1256    $(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)))))
1257$(foreach target, $(TARGET_TYPES), \
1258  $(foreach image, $(IMAGE_TYPES), $(eval \
1259    $(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)))))
1260$(foreach target, $(TARGET_TYPES), \
1261  $(foreach test, $(TEST_ART_RUN_TESTS), $(eval \
1262    $(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)))))
1263$(foreach target, $(TARGET_TYPES), \
1264  $(foreach address_size, $(ADDRESS_SIZES_$(call name-to-var,$(target))), $(eval \
1265    $(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)))))
1266
1267# Clear variables now we're finished with them.
1268$(foreach target, $(TARGET_TYPES), $(eval ART_RUN_TEST_$(call name-to-var,$(target))_RULES :=))
1269$(foreach target, $(TARGET_TYPES), \
1270  $(foreach prebuild, $(PREBUILD_TYPES), \
1271    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(prebuild))_RULES :=)))
1272$(foreach target, $(TARGET_TYPES), \
1273  $(foreach compiler, $(COMPILER_TYPES), \
1274    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(compiler))_RULES :=)))
1275$(foreach target, $(TARGET_TYPES), \
1276  $(foreach relocate, $(RELOCATE_TYPES), \
1277    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(relocate))_RULES :=)))
1278$(foreach target, $(TARGET_TYPES), \
1279  $(foreach trace, $(TRACE_TYPES), \
1280    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(trace))_RULES :=)))
1281$(foreach target, $(TARGET_TYPES), \
1282  $(foreach gc, $(GC_TYPES), \
1283    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(gc))_RULES :=)))
1284$(foreach target, $(TARGET_TYPES), \
1285  $(foreach jni, $(JNI_TYPES), \
1286    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(jni))_RULES :=)))
1287$(foreach target, $(TARGET_TYPES), \
1288  $(foreach debuggable, $(DEBUGGABLE_TYPES), \
1289    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(debuggable))_RULES :=)))
1290$(foreach target, $(TARGET_TYPES), \
1291  $(foreach image, $(IMAGE_TYPES), \
1292    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(image))_RULES :=)))
1293$(foreach target, $(TARGET_TYPES), \
1294  $(foreach test, $(TEST_ART_RUN_TESTS), \
1295    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(test))_RULES :=)))
1296$(foreach target, $(TARGET_TYPES), \
1297  $(foreach address_size, $(ALL_ADDRESS_SIZES), \
1298    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(address_size))_RULES :=)))
1299$(foreach target, $(TARGET_TYPES), \
1300  $(foreach run_type, $(RUN_TYPES), \
1301    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(run_type))_RULES :=)))
1302define-test-art-run-test-group :=
1303TARGET_TYPES :=
1304PREBUILD_TYPES :=
1305COMPILER_TYPES :=
1306RELOCATE_TYPES :=
1307TRACE_TYPES :=
1308GC_TYPES :=
1309JNI_TYPES :=
1310IMAGE_TYPES :=
1311ADDRESS_SIZES_TARGET :=
1312ADDRESS_SIZES_HOST :=
1313ALL_ADDRESS_SIZES :=
1314RUN_TYPES :=
1315DEBUGGABLE_TYPES :=
1316
1317LOCAL_PATH :=
1318