Android.run-test.mk revision a6017d8fa6acfa35f6fad8169162f0e5bd034bc4
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_dir := $(call intermediates-dir-for,PACKAGING,art-run-tests)/DATA
30
31# A generated list of prerequisites that call 'run-test --build-only', the actual prerequisite is
32# an empty file touched in the intermediate directory.
33TEST_ART_RUN_TEST_BUILD_RULES :=
34
35# Dependencies for actually running a run-test.
36TEST_ART_RUN_TEST_DEPENDENCIES := \
37  $(DX) \
38  $(HOST_OUT_EXECUTABLES)/jasmin \
39  $(HOST_OUT_EXECUTABLES)/smali \
40  $(HOST_OUT_EXECUTABLES)/dexmerger
41
42ifeq ($(ANDROID_COMPILE_WITH_JACK),true)
43  TEST_ART_RUN_TEST_DEPENDENCIES += \
44    $(JACK) \
45    $(JILL_JAR)
46endif
47
48ifeq ($(ART_TEST_DEBUG_GC),true)
49  ART_TEST_WITH_STRACE := true
50endif
51
52# Helper to create individual build targets for tests. Must be called with $(eval).
53# $(1): the test number
54define define-build-art-run-test
55  dmart_target := $(art_run_tests_dir)/art-run-tests/$(1)/touch
56  run_test_options = --build-only
57  ifeq ($(ANDROID_COMPILE_WITH_JACK),true)
58    run_test_options += --build-with-jack
59  else
60    run_test_options += --build-with-javac-dx
61  endif
62  ifeq ($(ART_TEST_QUIET),true)
63    run_test_options += --quiet
64  endif
65$$(dmart_target): PRIVATE_RUN_TEST_OPTIONS := $$(run_test_options)
66$$(dmart_target): $(TEST_ART_RUN_TEST_DEPENDENCIES) $(TARGET_JACK_CLASSPATH_DEPENDENCIES)
67	$(hide) rm -rf $$(dir $$@) && mkdir -p $$(dir $$@)
68	$(hide) DX=$(abspath $(DX)) JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) \
69	  SMALI=$(abspath $(HOST_OUT_EXECUTABLES)/smali) \
70	  DXMERGER=$(abspath $(HOST_OUT_EXECUTABLES)/dexmerger) \
71	  JACK=$(abspath $(JACK)) \
72	  JACK_CLASSPATH=$(TARGET_JACK_CLASSPATH) \
73	  JILL_JAR=$(abspath $(JILL_JAR)) \
74	  JACK_VERSION=$(JACK_LANG_DEV_VERSION) \
75	  $(LOCAL_PATH)/run-test $$(PRIVATE_RUN_TEST_OPTIONS) --output-path $$(abspath $$(dir $$@)) $(1)
76	$(hide) touch $$@
77
78  TEST_ART_RUN_TEST_BUILD_RULES += $$(dmart_target)
79  dmart_target :=
80  run_test_options :=
81endef
82$(foreach test, $(TEST_ART_RUN_TESTS), $(eval $(call define-build-art-run-test,$(test))))
83
84include $(CLEAR_VARS)
85LOCAL_MODULE_TAGS := tests
86LOCAL_MODULE := art-run-tests
87LOCAL_ADDITIONAL_DEPENDENCIES := $(TEST_ART_RUN_TEST_BUILD_RULES)
88# The build system use this flag to pick up files generated by declare-make-art-run-test.
89LOCAL_PICKUP_FILES := $(art_run_tests_dir)
90
91include $(BUILD_PHONY_PACKAGE)
92
93# Clear temp vars.
94art_run_tests_dir :=
95define-build-art-run-test :=
96TEST_ART_RUN_TEST_BUILD_RULES :=
97
98########################################################################
99# General rules to build and run a run-test.
100
101TARGET_TYPES := host target
102PREBUILD_TYPES :=
103ifeq ($(ART_TEST_RUN_TEST_PREBUILD),true)
104  PREBUILD_TYPES += prebuild
105endif
106ifeq ($(ART_TEST_RUN_TEST_NO_PREBUILD),true)
107  PREBUILD_TYPES += no-prebuild
108endif
109ifeq ($(ART_TEST_RUN_TEST_NO_DEX2OAT),true)
110  PREBUILD_TYPES += no-dex2oat
111endif
112COMPILER_TYPES :=
113ifeq ($(ART_TEST_DEFAULT_COMPILER),true)
114  COMPILER_TYPES += default
115endif
116ifeq ($(ART_TEST_INTERPRETER_ACCESS_CHECKS),true)
117  COMPILER_TYPES += interp-ac
118endif
119ifeq ($(ART_TEST_INTERPRETER),true)
120  COMPILER_TYPES += interpreter
121endif
122ifeq ($(ART_TEST_JIT),true)
123  COMPILER_TYPES += jit
124endif
125ifeq ($(ART_TEST_OPTIMIZING),true)
126  COMPILER_TYPES += optimizing
127endif
128RELOCATE_TYPES := relocate
129ifeq ($(ART_TEST_RUN_TEST_NO_RELOCATE),true)
130  RELOCATE_TYPES += no-relocate
131endif
132ifeq ($(ART_TEST_RUN_TEST_RELOCATE_NO_PATCHOAT),true)
133  RELOCATE_TYPES += relocate-npatchoat
134endif
135TRACE_TYPES := ntrace
136ifeq ($(ART_TEST_TRACE),true)
137  TRACE_TYPES += trace
138endif
139ifeq ($(ART_TEST_TRACE_STREAM),true)
140  TRACE_TYPES += stream
141endif
142GC_TYPES := cms
143ifeq ($(ART_TEST_GC_STRESS),true)
144  GC_TYPES += gcstress
145endif
146ifeq ($(ART_TEST_GC_VERIFY),true)
147  GC_TYPES += gcverify
148endif
149JNI_TYPES := checkjni
150ifeq ($(ART_TEST_JNI_FORCECOPY),true)
151  JNI_TYPES += forcecopy
152endif
153IMAGE_TYPES := image
154ifeq ($(ART_TEST_RUN_TEST_NO_IMAGE),true)
155  IMAGE_TYPES += no-image
156endif
157ifeq ($(ART_TEST_PIC_IMAGE),true)
158  IMAGE_TYPES += picimage
159endif
160PICTEST_TYPES := npictest
161ifeq ($(ART_TEST_PIC_TEST),true)
162  PICTEST_TYPES += pictest
163endif
164RUN_TYPES :=
165ifeq ($(ART_TEST_RUN_TEST_DEBUG),true)
166  RUN_TYPES += debug
167endif
168ifeq ($(ART_TEST_RUN_TEST_NDEBUG),true)
169  RUN_TYPES += ndebug
170endif
171DEBUGGABLE_TYPES := ndebuggable
172ifeq ($(ART_TEST_RUN_TEST_DEBUGGABLE),true)
173DEBUGGABLE_TYPES += debuggable
174endif
175ADDRESS_SIZES_TARGET := $(ART_PHONY_TEST_TARGET_SUFFIX)
176ADDRESS_SIZES_HOST := $(ART_PHONY_TEST_HOST_SUFFIX)
177ifeq ($(ART_TEST_RUN_TEST_2ND_ARCH),true)
178  ADDRESS_SIZES_TARGET += $(2ND_ART_PHONY_TEST_TARGET_SUFFIX)
179  ADDRESS_SIZES_HOST += $(2ND_ART_PHONY_TEST_HOST_SUFFIX)
180endif
181ALL_ADDRESS_SIZES := 64 32
182
183# List all run test names with number arguments agreeing with the comment above.
184define all-run-test-names
185  $(foreach target, $(1), \
186    $(foreach run-type, $(2), \
187      $(foreach prebuild, $(3), \
188        $(foreach compiler, $(4), \
189          $(foreach relocate, $(5), \
190            $(foreach trace, $(6), \
191              $(foreach gc, $(7), \
192                $(foreach jni, $(8), \
193                  $(foreach image, $(9), \
194                    $(foreach pictest, $(10), \
195                      $(foreach debuggable, $(11), \
196                        $(foreach test, $(12), \
197                          $(foreach address_size, $(13), \
198                            test-art-$(target)-run-test-$(run-type)-$(prebuild)-$(compiler)-$(relocate)-$(trace)-$(gc)-$(jni)-$(image)-$(pictest)-$(debuggable)-$(test)$(address_size) \
199                    )))))))))))))
200endef  # all-run-test-names
201
202# To generate a full list or tests:
203# $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES),$(COMPILER_TYPES), \
204#        $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
205#        $(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_RUN_TESTS),$(ALL_ADDRESS_SIZES))
206
207# Convert's a rule name to the form used in variables, e.g. no-relocate to NO_RELOCATE
208define name-to-var
209$(shell echo $(1) | tr '[:lower:]' '[:upper:]' | tr '-' '_')
210endef  # name-to-var
211
212# Tests that are timing sensitive and flaky on heavily loaded systems.
213TEST_ART_TIMING_SENSITIVE_RUN_TESTS := \
214  053-wait-some \
215  055-enum-performance \
216  133-static-invoke-super
217
218# disable timing sensitive tests on "dist" builds.
219ifdef dist_goal
220  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
221        $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
222        $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_TIMING_SENSITIVE_RUN_TESTS), $(ALL_ADDRESS_SIZES))
223endif
224
225# Tests that require python3.
226TEST_ART_PYTHON3_DEPENDENCY_RUN_TESTS := \
227  960-default-smali \
228  961-default-iface-resolution-generated \
229  964-default-iface-init-generated \
230
231# Check if we have python3 to run our tests.
232ifeq ($(wildcard /usr/bin/python3),)
233  $(warning "No python3 found. Disabling tests: $(TEST_ART_PYTHON3_DEPENDENCY_RUN_TESTS)")
234
235  # Currently disable tests requiring python3 when it is not installed.
236  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
237        $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
238        $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_PYTHON3_DEPENDENCY_RUN_TESTS), $(ALL_ADDRESS_SIZES))
239endif
240
241TEST_ART_TIMING_SENSITIVE_RUN_TESTS :=
242
243# Note 116-nodex2oat is not broken per-se it just doesn't (and isn't meant to) work with --prebuild.
244TEST_ART_BROKEN_PREBUILD_RUN_TESTS := \
245  116-nodex2oat \
246  118-noimage-dex2oat \
247  134-nodex2oat-nofallback
248
249ifneq (,$(filter prebuild,$(PREBUILD_TYPES)))
250  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),prebuild, \
251      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
252      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_PREBUILD_RUN_TESTS), $(ALL_ADDRESS_SIZES))
253endif
254
255TEST_ART_BROKEN_PREBUILD_RUN_TESTS :=
256
257TEST_ART_BROKEN_NO_PREBUILD_TESTS := \
258  117-nopatchoat
259
260ifneq (,$(filter no-prebuild,$(PREBUILD_TYPES)))
261  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),no-prebuild, \
262      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
263      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_NO_PREBUILD_TESTS), $(ALL_ADDRESS_SIZES))
264endif
265
266TEST_ART_BROKEN_NO_PREBUILD_TESTS :=
267
268# Note 117-nopatchoat is not broken per-se it just doesn't work (and isn't meant to) without
269# --prebuild --relocate
270TEST_ART_BROKEN_NO_RELOCATE_TESTS := \
271  117-nopatchoat \
272  118-noimage-dex2oat \
273  119-noimage-patchoat
274
275ifneq (,$(filter no-relocate,$(RELOCATE_TYPES)))
276  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
277      $(COMPILER_TYPES), no-relocate,$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
278      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_NO_RELOCATE_TESTS), $(ALL_ADDRESS_SIZES))
279endif
280
281TEST_ART_BROKEN_NO_RELOCATE_TESTS :=
282
283# Temporarily disable some broken tests when forcing access checks in interpreter b/22414682
284TEST_ART_BROKEN_INTERPRETER_ACCESS_CHECK_TESTS := \
285  004-JniTest \
286  005-annotations \
287  044-proxy \
288  073-mismatched-field \
289  088-monitor-verification \
290  135-MirandaDispatch \
291  137-cfi \
292  412-new-array \
293  471-uninitialized-locals \
294  506-verify-aput \
295  800-smali
296
297ifneq (,$(filter interp-ac,$(COMPILER_TYPES)))
298  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
299      interp-ac,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
300      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_INTERPRETER_ACCESS_CHECK_TESTS), $(ALL_ADDRESS_SIZES))
301endif
302
303TEST_ART_BROKEN_INTERPRETER_ACCESS_CHECK_TESTS :=
304
305# Tests that are broken with GC stress.
306# * 137-cfi needs to unwind a second forked process. We're using a primitive sleep to wait till we
307#   hope the second process got into the expected state. The slowness of gcstress makes this bad.
308# * 961-default-iface-resolution-generated is a very long test that often will take more than the
309#   timeout to run when gcstress is enabled. This is because gcstress slows down allocations
310#   significantly which this test does a lot.
311TEST_ART_BROKEN_GCSTRESS_RUN_TESTS := \
312  137-cfi \
313  961-default-iface-resolution-generated
314
315ifneq (,$(filter gcstress,$(GC_TYPES)))
316  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
317      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),gcstress,$(JNI_TYPES), \
318      $(IMAGE_TYPES), $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_GCSTRESS_RUN_TESTS), $(ALL_ADDRESS_SIZES))
319endif
320
321TEST_ART_BROKEN_GCSTRESS_RUN_TESTS :=
322
323# 115-native-bridge setup is complicated. Need to implement it correctly for the target.
324ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES),$(COMPILER_TYPES), \
325    $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), 115-native-bridge, \
326    $(ALL_ADDRESS_SIZES))
327
328# 130-hprof dumps the heap and runs hprof-conv to check whether the file is somewhat readable. This
329# is only possible on the host.
330# TODO: Turn off all the other combinations, this is more about testing actual ART code. A gtest is
331#       very hard to write here, as (for a complete test) JDWP must be set up.
332ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \
333    $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
334    $(PICTEST_TYPES),$(DEBUGGABLE_TYPES),130-hprof,$(ALL_ADDRESS_SIZES))
335
336# 131 is an old test. The functionality has been implemented at an earlier stage and is checked
337# in tests 138. Blacklisted for debug builds since these builds have duplicate classes checks which
338# punt to interpreter.
339ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),debug,$(PREBUILD_TYPES), \
340    $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
341    $(PICTEST_TYPES),$(DEBUGGABLE_TYPES),131-structural-change,$(ALL_ADDRESS_SIZES))
342
343# 138-duplicate-classes-check. Turned on for debug builds since debug builds have duplicate classes
344# checks enabled, b/2133391.
345ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),ndebug,$(PREBUILD_TYPES), \
346    $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
347    $(PICTEST_TYPES),$(DEBUGGABLE_TYPES),138-duplicate-classes-check,$(ALL_ADDRESS_SIZES))
348
349# All these tests check that we have sane behavior if we don't have a patchoat or dex2oat.
350# Therefore we shouldn't run them in situations where we actually don't have these since they
351# explicitly test for them. These all also assume we have an image.
352TEST_ART_BROKEN_FALLBACK_RUN_TESTS := \
353  116-nodex2oat \
354  117-nopatchoat \
355  118-noimage-dex2oat \
356  119-noimage-patchoat \
357  137-cfi \
358  138-duplicate-classes-check2
359
360# This test fails without an image.
361TEST_ART_BROKEN_NO_IMAGE_RUN_TESTS := \
362  137-cfi \
363  138-duplicate-classes-check
364
365ifneq (,$(filter no-dex2oat,$(PREBUILD_TYPES)))
366  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),no-dex2oat, \
367      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
368      $(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_FALLBACK_RUN_TESTS),$(ALL_ADDRESS_SIZES))
369endif
370
371
372ifneq (,$(filter no-image,$(IMAGE_TYPES)))
373  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
374      $(COMPILER_TYPES), $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),no-image, \
375      $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_FALLBACK_RUN_TESTS),$(ALL_ADDRESS_SIZES))
376  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
377      $(COMPILER_TYPES), $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),no-image, \
378      $(PICTEST_TYPES), $(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_NO_IMAGE_RUN_TESTS),$(ALL_ADDRESS_SIZES))
379endif
380
381ifneq (,$(filter relocate-npatchoat,$(RELOCATE_TYPES)))
382  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
383      $(COMPILER_TYPES), relocate-npatchoat,$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
384      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_FALLBACK_RUN_TESTS),$(ALL_ADDRESS_SIZES))
385endif
386
387TEST_ART_BROKEN_FALLBACK_RUN_TESTS :=
388
389# 137:
390# This test unrolls and expects managed frames, but tracing means we run the interpreter.
391# 802:
392# This test dynamically enables tracing to force a deoptimization. This makes the test meaningless
393# when already tracing, and writes an error message that we do not want to check for.
394TEST_ART_BROKEN_TRACING_RUN_TESTS := \
395  087-gc-after-link \
396  137-cfi \
397  141-class-unload \
398  802-deoptimization
399
400ifneq (,$(filter trace stream,$(TRACE_TYPES)))
401  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
402      $(COMPILER_TYPES),$(RELOCATE_TYPES),trace stream,$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \
403      $(PICTEST_TYPES),$(DEBUGGABLE_TYPES), $(TEST_ART_BROKEN_TRACING_RUN_TESTS),$(ALL_ADDRESS_SIZES))
404endif
405
406# Known broken tests for the interpreter.
407# CFI unwinding expects managed frames.
408TEST_ART_BROKEN_INTERPRETER_RUN_TESTS := \
409  137-cfi
410
411ifneq (,$(filter interpreter,$(COMPILER_TYPES)))
412  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
413      interpreter,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
414      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_INTERPRETER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
415endif
416
417TEST_ART_BROKEN_INTERPRETER_RUN_TESTS :=
418
419# Known broken tests for the JIT.
420# CFI unwinding expects managed frames, and the test does not iterate enough to even compile. JIT
421# also uses Generic JNI instead of the JNI compiler.
422TEST_ART_BROKEN_JIT_RUN_TESTS := \
423  137-cfi
424
425ifneq (,$(filter jit,$(COMPILER_TYPES)))
426  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
427      jit,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
428      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_JIT_RUN_TESTS),$(ALL_ADDRESS_SIZES))
429endif
430
431TEST_ART_BROKEN_JIT_RUN_TESTS :=
432
433# Known broken tests for the default compiler (Quick).
434TEST_ART_BROKEN_DEFAULT_RUN_TESTS := \
435  457-regs
436
437ifneq (,$(filter default,$(COMPILER_TYPES)))
438  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
439      default,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
440      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_DEFAULT_RUN_TESTS),$(ALL_ADDRESS_SIZES))
441endif
442
443TEST_ART_BROKEN_DEFAULT_RUN_TESTS :=
444
445# Known broken tests for the mips32 optimizing compiler backend.
446TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS := \
447    441-checker-inliner \
448    510-checker-try-catch \
449    536-checker-intrinsic-optimization \
450
451ifeq (mips,$(TARGET_ARCH))
452  ifneq (,$(filter optimizing,$(COMPILER_TYPES)))
453    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES), \
454        optimizing,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
455        $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
456        $(TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS),$(ALL_ADDRESS_SIZES))
457  endif
458endif
459
460TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS :=
461
462# Known broken tests for the optimizing compiler.
463TEST_ART_BROKEN_OPTIMIZING_RUN_TESTS := \
464  455-set-vreg \
465
466ifneq (,$(filter optimizing,$(COMPILER_TYPES)))
467  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
468      optimizing,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
469      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_OPTIMIZING_RUN_TESTS),$(ALL_ADDRESS_SIZES))
470endif
471
472TEST_ART_BROKEN_OPTIMIZING_RUN_TESTS :=
473
474# Tests that should fail when the optimizing compiler compiles them non-debuggable.
475TEST_ART_BROKEN_OPTIMIZING_NONDEBUGGABLE_RUN_TESTS := \
476  454-get-vreg \
477  457-regs \
478
479ifneq (,$(filter optimizing,$(COMPILER_TYPES)))
480  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
481      optimizing,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
482      $(IMAGE_TYPES),$(PICTEST_TYPES),ndebuggable,$(TEST_ART_BROKEN_OPTIMIZING_NONDEBUGGABLE_RUN_TESTS),$(ALL_ADDRESS_SIZES))
483endif
484
485TEST_ART_BROKEN_OPTIMIZING_NONDEBUGGABLE_RUN_TESTS :=
486
487# Tests that should fail when the optimizing compiler compiles them debuggable.
488TEST_ART_BROKEN_OPTIMIZING_DEBUGGABLE_RUN_TESTS := \
489
490ifneq (,$(filter optimizing,$(COMPILER_TYPES)))
491  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
492      optimizing,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
493      $(IMAGE_TYPES),$(PICTEST_TYPES),debuggable,$(TEST_ART_BROKEN_OPTIMIZING_DEBUGGABLE_RUN_TESTS),$(ALL_ADDRESS_SIZES))
494endif
495
496TEST_ART_BROKEN_OPTIMIZING_DEBUGGABLE_RUN_TESTS :=
497
498# Tests that should fail in the read barrier configuration.
499# 137: Read barrier forces interpreter. Cannot run this with the interpreter.
500# 141: Class unloading test is flaky with CC since CC seems to occasionally keep class loaders live.
501TEST_ART_BROKEN_READ_BARRIER_RUN_TESTS := \
502  137-cfi \
503  141-class-unload
504
505ifeq ($(ART_USE_READ_BARRIER),true)
506  ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \
507      $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
508      $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES),$(TEST_ART_BROKEN_READ_BARRIER_RUN_TESTS),$(ALL_ADDRESS_SIZES))
509endif
510
511TEST_ART_BROKEN_READ_BARRIER_RUN_TESTS :=
512
513# Tests that should fail in the heap poisoning configuration with the default (Quick) compiler.
514# 137: Quick punts to the interpreter, and this test cannot run this with the interpreter.
515TEST_ART_BROKEN_DEFAULT_HEAP_POISONING_RUN_TESTS := \
516  137-cfi
517# Tests that should fail in the heap poisoning configuration with the Optimizing compiler.
518# 055-enum-performance: Exceeds run time limits due to heap poisoning instrumentation.
519TEST_ART_BROKEN_OPTIMIZING_HEAP_POISONING_RUN_TESTS := \
520  055-enum-performance
521# Tests that should fail in the heap poisoning configuration with the interpreter.
522# 137: Cannot run this with the interpreter.
523TEST_ART_BROKEN_INTERPRETER_HEAP_POISONING_RUN_TESTS := \
524  137-cfi
525
526ifeq ($(ART_HEAP_POISONING),true)
527  ifneq (,$(filter default,$(COMPILER_TYPES)))
528    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
529        $(PREBUILD_TYPES),default,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
530        $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
531        $(TEST_ART_BROKEN_DEFAULT_HEAP_POISONING_RUN_TESTS),$(ALL_ADDRESS_SIZES))
532  endif
533
534  ifneq (,$(filter optimizing,$(COMPILER_TYPES)))
535    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
536        $(PREBUILD_TYPES),optimizing,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
537        $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
538        $(TEST_ART_BROKEN_OPTIMIZING_HEAP_POISONING_RUN_TESTS),$(ALL_ADDRESS_SIZES))
539  endif
540
541  ifneq (,$(filter interpreter,$(COMPILER_TYPES)))
542    ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES), \
543        $(PREBUILD_TYPES),interpreter,$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \
544        $(IMAGE_TYPES),$(PICTEST_TYPES),$(DEBUGGABLE_TYPES), \
545        $(TEST_ART_BROKEN_INTERPRETER_HEAP_POISONING_RUN_TESTS),$(ALL_ADDRESS_SIZES))
546  endif
547endif
548
549TEST_ART_BROKEN_INTERPRETER_HEAP_POISONING_RUN_TESTS :=
550TEST_ART_BROKEN_OPTIMIZING_HEAP_POISONING_RUN_TESTS :=
551TEST_ART_BROKEN_DEFAULT_HEAP_POISONING_RUN_TESTS :=
552
553# Clear variables ahead of appending to them when defining tests.
554$(foreach target, $(TARGET_TYPES), $(eval ART_RUN_TEST_$(call name-to-var,$(target))_RULES :=))
555$(foreach target, $(TARGET_TYPES), \
556  $(foreach prebuild, $(PREBUILD_TYPES), \
557    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(prebuild))_RULES :=)))
558$(foreach target, $(TARGET_TYPES), \
559  $(foreach compiler, $(COMPILER_TYPES), \
560    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(compiler))_RULES :=)))
561$(foreach target, $(TARGET_TYPES), \
562  $(foreach relocate, $(RELOCATE_TYPES), \
563    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(relocate))_RULES :=)))
564$(foreach target, $(TARGET_TYPES), \
565  $(foreach trace, $(TRACE_TYPES), \
566    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(trace))_RULES :=)))
567$(foreach target, $(TARGET_TYPES), \
568  $(foreach gc, $(GC_TYPES), \
569    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(gc))_RULES :=)))
570$(foreach target, $(TARGET_TYPES), \
571  $(foreach jni, $(JNI_TYPES), \
572    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(jni))_RULES :=)))
573$(foreach target, $(TARGET_TYPES), \
574  $(foreach image, $(IMAGE_TYPES), \
575    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(image))_RULES :=)))
576$(foreach target, $(TARGET_TYPES), \
577  $(foreach test, $(TEST_ART_RUN_TESTS), \
578    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(test))_RULES :=)))
579$(foreach target, $(TARGET_TYPES), \
580  $(foreach address_size, $(ALL_ADDRESS_SIZES), \
581    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(address_size))_RULES :=)))
582$(foreach target, $(TARGET_TYPES), \
583  $(foreach run_type, $(RUN_TYPES), \
584    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(run_type))_RULES :=)))
585$(foreach target, $(TARGET_TYPES), \
586  $(foreach debuggable_type, $(DEBUGGABLE_TYPES), \
587    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(debuggable_type))_RULES :=)))
588
589# We need dex2oat and dalvikvm on the target as well as the core images (all images as we sync
590# only once).
591TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_EXECUTABLES) $(TARGET_CORE_IMG_OUTS)
592
593# Also need libarttest.
594TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libarttest.so
595TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libarttestd.so
596ifdef TARGET_2ND_ARCH
597TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_TEST_OUT)/$(TARGET_2ND_ARCH)/libarttest.so
598TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_TEST_OUT)/$(TARGET_2ND_ARCH)/libarttestd.so
599endif
600
601# Also need libnativebridgetest.
602TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libnativebridgetest.so
603ifdef TARGET_2ND_ARCH
604TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_TEST_OUT)/$(TARGET_2ND_ARCH)/libnativebridgetest.so
605endif
606
607# All tests require the host executables. The tests also depend on the core images, but on
608# specific version depending on the compiler.
609ART_TEST_HOST_RUN_TEST_DEPENDENCIES := \
610  $(ART_HOST_EXECUTABLES) \
611  $(ART_HOST_OUT_SHARED_LIBRARIES)/libarttest$(ART_HOST_SHLIB_EXTENSION) \
612  $(ART_HOST_OUT_SHARED_LIBRARIES)/libarttestd$(ART_HOST_SHLIB_EXTENSION) \
613  $(ART_HOST_OUT_SHARED_LIBRARIES)/libnativebridgetest$(ART_HOST_SHLIB_EXTENSION) \
614  $(ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION)
615
616ifneq ($(HOST_PREFER_32_BIT),true)
617ART_TEST_HOST_RUN_TEST_DEPENDENCIES += \
618  $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libarttest$(ART_HOST_SHLIB_EXTENSION) \
619  $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libarttestd$(ART_HOST_SHLIB_EXTENSION) \
620  $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libnativebridgetest$(ART_HOST_SHLIB_EXTENSION) \
621  $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION)
622endif
623
624# Create a rule to build and run a tests following the form:
625# test-art-{1: host or target}-run-test-{2: debug ndebug}-{3: prebuild no-prebuild no-dex2oat}-
626#    {4: interpreter default optimizing jit interp-ac}-
627#    {5: relocate nrelocate relocate-npatchoat}-
628#    {6: trace or ntrace}-{7: gcstress gcverify cms}-{8: forcecopy checkjni jni}-
629#    {9: no-image image picimage}-{10: pictest npictest}-
630#    {11: ndebuggable debuggable}-{12: test name}{13: 32 or 64}
631define define-test-art-run-test
632  run_test_options :=
633  prereq_rule :=
634  test_groups :=
635  uc_host_or_target :=
636  jack_classpath :=
637  ifeq ($(ANDROID_COMPILE_WITH_JACK),true)
638    run_test_options += --build-with-jack
639  else
640    run_test_options += --build-with-javac-dx
641  endif
642  ifeq ($(ART_TEST_WITH_STRACE),true)
643    run_test_options += --strace
644  endif
645  ifeq ($(ART_TEST_RUN_TEST_ALWAYS_CLEAN),true)
646    run_test_options += --always-clean
647  endif
648  ifeq ($(1),host)
649    uc_host_or_target := HOST
650    test_groups := ART_RUN_TEST_HOST_RULES
651    run_test_options += --host
652    prereq_rule := $(ART_TEST_HOST_RUN_TEST_DEPENDENCIES) $(HOST_JACK_CLASSPATH_DEPENDENCIES)
653    jack_classpath := $(HOST_JACK_CLASSPATH)
654  else
655    ifeq ($(1),target)
656      uc_host_or_target := TARGET
657      test_groups := ART_RUN_TEST_TARGET_RULES
658      prereq_rule := test-art-target-sync $(TARGET_JACK_CLASSPATH_DEPENDENCIES)
659      jack_classpath := $(TARGET_JACK_CLASSPATH)
660    else
661      $$(error found $(1) expected $(TARGET_TYPES))
662    endif
663  endif
664  ifeq ($(2),debug)
665    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_DEBUG_RULES
666  else
667    ifeq ($(2),ndebug)
668      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELEASE_RULES
669      run_test_options += -O
670    else
671      $$(error found $(2) expected $(RUN_TYPES))
672    endif
673  endif
674  ifeq ($(3),prebuild)
675    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_PREBUILD_RULES
676    run_test_options += --prebuild
677  else
678    ifeq ($(3),no-prebuild)
679      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_PREBUILD_RULES
680      run_test_options += --no-prebuild
681    else
682      ifeq ($(3),no-dex2oat)
683        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_DEX2OAT_RULES
684        run_test_options += --no-prebuild --no-dex2oat
685      else
686        $$(error found $(3) expected $(PREBUILD_TYPES))
687      endif
688    endif
689  endif
690  ifeq ($(4),optimizing)
691    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_OPTIMIZING_RULES
692    run_test_options += --optimizing
693  else
694    ifeq ($(4),interpreter)
695      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_INTERPRETER_RULES
696      run_test_options += --interpreter
697    else ifeq ($(4),interp-ac)
698      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_INTERPRETER_ACCESS_CHECKS_RULES
699      run_test_options += --interpreter --verify-soft-fail
700    else
701      ifeq ($(4),default)
702        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_DEFAULT_RULES
703        run_test_options += --quick
704      else
705        ifeq ($(4),jit)
706          test_groups += ART_RUN_TEST_$$(uc_host_or_target)_JIT_RULES
707          run_test_options += --jit
708        else
709          $$(error found $(4) expected $(COMPILER_TYPES))
710        endif
711      endif
712    endif
713  endif
714
715  ifeq ($(5),relocate)
716    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELOCATE_RULES
717    run_test_options += --relocate
718  else
719    ifeq ($(5),no-relocate)
720      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_RELOCATE_RULES
721      run_test_options += --no-relocate
722    else
723      ifeq ($(5),relocate-npatchoat)
724        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELOCATE_NO_PATCHOAT_RULES
725        run_test_options += --relocate --no-patchoat
726      else
727        $$(error found $(5) expected $(RELOCATE_TYPES))
728      endif
729    endif
730  endif
731  ifeq ($(6),trace)
732    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_TRACE_RULES
733    run_test_options += --trace
734  else
735    ifeq ($(6),ntrace)
736      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_TRACE_RULES
737    else
738      ifeq ($(6),stream)
739        # Group streaming under normal tracing rules.
740        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_TRACE_RULES
741        run_test_options += --trace --stream
742      else
743        $$(error found $(6) expected $(TRACE_TYPES))
744      endif
745    endif
746  endif
747  ifeq ($(7),gcverify)
748    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_GCVERIFY_RULES
749    run_test_options += --gcverify
750  else
751    ifeq ($(7),gcstress)
752      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_GCSTRESS_RULES
753      run_test_options += --gcstress
754    else
755      ifeq ($(7),cms)
756        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_CMS_RULES
757      else
758        $$(error found $(7) expected $(GC_TYPES))
759      endif
760    endif
761  endif
762  ifeq ($(8),forcecopy)
763    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_FORCECOPY_RULES
764    run_test_options += --runtime-option -Xjniopts:forcecopy
765    ifneq ($$(ART_TEST_JNI_FORCECOPY),true)
766      skip_test := true
767    endif
768  else
769    ifeq ($(8),checkjni)
770      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_CHECKJNI_RULES
771      run_test_options += --runtime-option -Xcheck:jni
772    else
773      ifeq ($(8),jni)
774        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_JNI_RULES
775      else
776        $$(error found $(8) expected $(JNI_TYPES))
777      endif
778    endif
779  endif
780  image_suffix := $(4)
781  ifeq ($(9),no-image)
782    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_IMAGE_RULES
783    run_test_options += --no-image
784    # Add the core dependency. This is required for pre-building.
785    ifeq ($(1),host)
786      prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_no-pic_$(13))
787    else
788      prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_no-pic_$(13))
789    endif
790  else
791    ifeq ($(9),image)
792      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_IMAGE_RULES
793      # Add the core dependency.
794      ifeq ($(1),host)
795        prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_no-pic_$(13))
796      else
797        prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_no-pic_$(13))
798      endif
799    else
800      ifeq ($(9),picimage)
801        test_groups += ART_RUN_TEST_$$(uc_host_or_target)_PICIMAGE_RULES
802        run_test_options += --pic-image
803        ifeq ($(1),host)
804          prereq_rule += $$(HOST_CORE_IMAGE_$$(image_suffix)_pic_$(13))
805        else
806          prereq_rule += $$(TARGET_CORE_IMAGE_$$(image_suffix)_pic_$(13))
807        endif
808      else
809        $$(error found $(9) expected $(IMAGE_TYPES))
810      endif
811    endif
812  endif
813  ifeq ($(10),pictest)
814    run_test_options += --pic-test
815  else
816    ifeq ($(10),npictest)
817      # Nothing to be done.
818    else
819      $$(error found $(10) expected $(PICTEST_TYPES))
820    endif
821  endif
822  ifeq ($(11),debuggable)
823    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_DEBUGGABLE_RULES
824    run_test_options += --debuggable
825  else
826    ifeq ($(11),ndebuggable)
827    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NONDEBUGGABLE_RULES
828      # Nothing to be done.
829    else
830      $$(error found $(11) expected $(DEBUGGABLE_TYPES))
831    endif
832  endif
833  # $(12) is the test name.
834  test_groups += ART_RUN_TEST_$$(uc_host_or_target)_$(call name-to-var,$(12))_RULES
835  ifeq ($(13),64)
836    test_groups += ART_RUN_TEST_$$(uc_host_or_target)_64_RULES
837    run_test_options += --64
838  else
839    ifeq ($(13),32)
840      test_groups += ART_RUN_TEST_$$(uc_host_or_target)_32_RULES
841    else
842      $$(error found $(13) expected $(ALL_ADDRESS_SIZES))
843    endif
844  endif
845  # Override of host instruction-set-features. Required to test advanced x86 intrinsics. The
846  # conditionals aren't really correct, they will fail to do the right thing on a 32-bit only
847  # host. However, this isn't common enough to worry here and make the conditions complicated.
848  ifneq ($(DEX2OAT_HOST_INSTRUCTION_SET_FEATURES),)
849    ifeq ($(13),64)
850      run_test_options += --instruction-set-features $(DEX2OAT_HOST_INSTRUCTION_SET_FEATURES)
851    endif
852  endif
853  ifneq ($($(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES),)
854    ifeq ($(13),32)
855      run_test_options += --instruction-set-features $($(HOST_2ND_ARCH_VAR_PREFIX)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES)
856    endif
857  endif
858  run_test_rule_name := test-art-$(1)-run-test-$(2)-$(3)-$(4)-$(5)-$(6)-$(7)-$(8)-$(9)-$(10)-$(11)-$(12)$(13)
859  run_test_options := --output-path $(ART_HOST_TEST_DIR)/run-test-output/$$(run_test_rule_name) \
860      $$(run_test_options)
861  ifneq ($(ART_TEST_ANDROID_ROOT),)
862    run_test_options := --android-root $(ART_TEST_ANDROID_ROOT) $$(run_test_options)
863  endif
864  ifeq ($(ART_TEST_QUIET),true)
865    run_test_options += --quiet
866  endif
867$$(run_test_rule_name): PRIVATE_RUN_TEST_OPTIONS := $$(run_test_options)
868$$(run_test_rule_name): PRIVATE_JACK_CLASSPATH := $$(jack_classpath)
869.PHONY: $$(run_test_rule_name)
870$$(run_test_rule_name): $(TEST_ART_RUN_TEST_DEPENDENCIES) $(HOST_OUT_EXECUTABLES)/hprof-conv $$(prereq_rule)
871	$(hide) $$(call ART_TEST_SKIP,$$@) && \
872	  DX=$(abspath $(DX)) \
873	    JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) \
874	    SMALI=$(abspath $(HOST_OUT_EXECUTABLES)/smali) \
875	    DXMERGER=$(abspath $(HOST_OUT_EXECUTABLES)/dexmerger) \
876	    JACK=$(abspath $(JACK)) \
877	    JACK_CLASSPATH=$$(PRIVATE_JACK_CLASSPATH) \
878	    JILL_JAR=$(abspath $(JILL_JAR)) \
879	    JACK_VERSION=$(JACK_LANG_DEV_VERSION) \
880	    art/test/run-test $$(PRIVATE_RUN_TEST_OPTIONS) $(12) \
881	      && $$(call ART_TEST_PASSED,$$@) || $$(call ART_TEST_FAILED,$$@)
882	$$(hide) (echo $(MAKECMDGOALS) | grep -q $$@ && \
883	  echo "run-test run as top-level target, removing test directory $(ART_HOST_TEST_DIR)" && \
884	  rm -r $(ART_HOST_TEST_DIR)) || true
885
886  $$(foreach test_group,$$(test_groups), $$(eval $$(value test_group) += $$(run_test_rule_name)))
887
888  # Clear locally defined variables.
889  uc_host_or_target :=
890  test_groups :=
891  run_test_options :=
892  run_test_rule_name :=
893  prereq_rule :=
894  jack_classpath :=
895endef  # define-test-art-run-test
896
897$(foreach target, $(TARGET_TYPES), \
898  $(foreach test, $(TEST_ART_RUN_TESTS), \
899    $(foreach run_type, $(RUN_TYPES), \
900      $(foreach address_size, $(ADDRESS_SIZES_$(call name-to-var,$(target))), \
901        $(foreach prebuild, $(PREBUILD_TYPES), \
902          $(foreach compiler, $(COMPILER_TYPES), \
903            $(foreach relocate, $(RELOCATE_TYPES), \
904              $(foreach trace, $(TRACE_TYPES), \
905                $(foreach gc, $(GC_TYPES), \
906                  $(foreach jni, $(JNI_TYPES), \
907                    $(foreach image, $(IMAGE_TYPES), \
908                      $(foreach pictest, $(PICTEST_TYPES), \
909                        $(foreach debuggable, $(DEBUGGABLE_TYPES), \
910                          $(eval $(call define-test-art-run-test,$(target),$(run_type),$(prebuild),$(compiler),$(relocate),$(trace),$(gc),$(jni),$(image),$(pictest),$(debuggable),$(test),$(address_size))) \
911                  )))))))))))))
912define-test-art-run-test :=
913
914# Define a phony rule whose purpose is to test its prerequisites.
915# $(1): host or target
916# $(2): list of prerequisites
917define define-test-art-run-test-group
918.PHONY: $(1)
919$(1): $(2)
920	$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
921
922endef  # define-test-art-run-test-group
923
924
925$(foreach target, $(TARGET_TYPES), $(eval \
926  $(call define-test-art-run-test-group,test-art-$(target)-run-test,$(ART_RUN_TEST_$(call name-to-var,$(target))_RULES))))
927$(foreach target, $(TARGET_TYPES), \
928  $(foreach prebuild, $(PREBUILD_TYPES), $(eval \
929    $(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)))))
930$(foreach target, $(TARGET_TYPES), \
931  $(foreach run-type, $(RUN_TYPES), $(eval \
932    $(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)))))
933$(foreach target, $(TARGET_TYPES), \
934  $(foreach compiler, $(COMPILER_TYPES), $(eval \
935    $(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)))))
936$(foreach target, $(TARGET_TYPES), \
937  $(foreach relocate, $(RELOCATE_TYPES), $(eval \
938    $(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)))))
939$(foreach target, $(TARGET_TYPES), \
940  $(foreach trace, $(TRACE_TYPES), $(eval \
941    $(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)))))
942$(foreach target, $(TARGET_TYPES), \
943  $(foreach gc, $(GC_TYPES), $(eval \
944    $(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)))))
945$(foreach target, $(TARGET_TYPES), \
946  $(foreach jni, $(JNI_TYPES), $(eval \
947    $(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)))))
948$(foreach target, $(TARGET_TYPES), \
949  $(foreach debuggable, $(DEBUGGABLE_TYPES), $(eval \
950    $(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)))))
951$(foreach target, $(TARGET_TYPES), \
952  $(foreach image, $(IMAGE_TYPES), $(eval \
953    $(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)))))
954$(foreach target, $(TARGET_TYPES), \
955  $(foreach test, $(TEST_ART_RUN_TESTS), $(eval \
956    $(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)))))
957$(foreach target, $(TARGET_TYPES), \
958  $(foreach address_size, $(ADDRESS_SIZES_$(call name-to-var,$(target))), $(eval \
959    $(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)))))
960
961# Clear variables now we're finished with them.
962$(foreach target, $(TARGET_TYPES), $(eval ART_RUN_TEST_$(call name-to-var,$(target))_RULES :=))
963$(foreach target, $(TARGET_TYPES), \
964  $(foreach prebuild, $(PREBUILD_TYPES), \
965    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(prebuild))_RULES :=)))
966$(foreach target, $(TARGET_TYPES), \
967  $(foreach compiler, $(COMPILER_TYPES), \
968    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(compiler))_RULES :=)))
969$(foreach target, $(TARGET_TYPES), \
970  $(foreach relocate, $(RELOCATE_TYPES), \
971    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(relocate))_RULES :=)))
972$(foreach target, $(TARGET_TYPES), \
973  $(foreach trace, $(TRACE_TYPES), \
974    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(trace))_RULES :=)))
975$(foreach target, $(TARGET_TYPES), \
976  $(foreach gc, $(GC_TYPES), \
977    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(gc))_RULES :=)))
978$(foreach target, $(TARGET_TYPES), \
979  $(foreach jni, $(JNI_TYPES), \
980    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(jni))_RULES :=)))
981$(foreach target, $(TARGET_TYPES), \
982  $(foreach debuggable, $(DEBUGGABLE_TYPES), \
983    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(debuggable))_RULES :=)))
984$(foreach target, $(TARGET_TYPES), \
985  $(foreach image, $(IMAGE_TYPES), \
986    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(image))_RULES :=)))
987$(foreach target, $(TARGET_TYPES), \
988  $(foreach test, $(TEST_ART_RUN_TESTS), \
989    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(test))_RULES :=)))
990$(foreach target, $(TARGET_TYPES), \
991  $(foreach address_size, $(ALL_ADDRESS_SIZES), \
992    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(address_size))_RULES :=)))
993$(foreach target, $(TARGET_TYPES), \
994  $(foreach run_type, $(RUN_TYPES), \
995    $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(run_type))_RULES :=)))
996define-test-art-run-test-group :=
997TARGET_TYPES :=
998PREBUILD_TYPES :=
999COMPILER_TYPES :=
1000RELOCATE_TYPES :=
1001TRACE_TYPES :=
1002GC_TYPES :=
1003JNI_TYPES :=
1004IMAGE_TYPES :=
1005ADDRESS_SIZES_TARGET :=
1006ADDRESS_SIZES_HOST :=
1007ALL_ADDRESS_SIZES :=
1008RUN_TYPES :=
1009DEBUGGABLE_TYPES :=
1010
1011include $(LOCAL_PATH)/Android.libarttest.mk
1012include art/test/Android.libnativebridgetest.mk
1013