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