Android.run-test.mk revision f38b7dca5217588a57384c864798409b7d685042
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# Helper to create individual build targets for tests. Must be called with $(eval). 36# $(1): the test number 37define define-build-art-run-test 38 dmart_target := $(art_run_tests_dir)/art-run-tests/$(1)/touch 39$$(dmart_target): $(DX) $(HOST_OUT_EXECUTABLES)/jasmin $(HOST_OUT_EXECUTABLES)/smali $(HOST_OUT_EXECUTABLES)/dexmerger 40 $(hide) rm -rf $$(dir $$@) && mkdir -p $$(dir $$@) 41 $(hide) DX=$(abspath $(DX)) JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) \ 42 SMALI=$(abspath $(HOST_OUT_EXECUTABLES)/smali) \ 43 DXMERGER=$(abspath $(HOST_OUT_EXECUTABLES)/dexmerger) \ 44 $(LOCAL_PATH)/run-test --build-only --output-path $$(abspath $$(dir $$@)) $(1) 45 $(hide) touch $$@ 46 47 TEST_ART_RUN_TEST_BUILD_RULES += $$(dmart_target) 48 dmart_target := 49endef 50$(foreach test, $(TEST_ART_RUN_TESTS), $(eval $(call define-build-art-run-test,$(test)))) 51 52include $(CLEAR_VARS) 53LOCAL_MODULE_TAGS := tests 54LOCAL_MODULE := art-run-tests 55LOCAL_ADDITIONAL_DEPENDENCIES := $(TEST_ART_RUN_TEST_BUILD_RULES) 56# The build system use this flag to pick up files generated by declare-make-art-run-test. 57LOCAL_PICKUP_FILES := $(art_run_tests_dir) 58 59include $(BUILD_PHONY_PACKAGE) 60 61# Clear temp vars. 62art_run_tests_dir := 63define-build-art-run-test := 64TEST_ART_RUN_TEST_BUILD_RULES := 65 66######################################################################## 67# General rules to build and run a run-test. 68 69# Test rule names or of the form: 70# test-art-{1: host or target}-run-test-{2: prebuild no-prebuild no-dex2oat}- 71# {3: interpreter default optimizing}-{4: relocate no-relocate relocate-no-patchoat}- 72# {5: trace or no-trace}-{6: gcstress gcverify cms}-{7: forcecopy checkjni jni}- 73# {8: no-image or image}-{9: test name}{10: 32 or 64} 74TARGET_TYPES := host target 75PREBUILD_TYPES := prebuild 76ifeq ($(ART_TEST_RUN_TEST_NO_PREBUILD),true) 77 PREBUILD_TYPES += no-prebuild 78endif 79ifeq ($(ART_TEST_RUN_TEST_NO_DEX2OAT),true) 80 PREBUILD_TYPES += no-dex2oat 81endif 82COMPILER_TYPES := 83ifeq ($(ART_TEST_DEFAULT_COMPILER),true) 84 COMPILER_TYPES += default 85endif 86ifeq ($(ART_TEST_INTERPRETER),true) 87 COMPILER_TYPES += interpreter 88endif 89ifeq ($(ART_TEST_OPTIMIZING),true) 90 COMPILER_TYPES += optimizing 91endif 92RELOCATE_TYPES := relocate 93ifeq ($(ART_TEST_RUN_TEST_NO_RELOCATE),true) 94 RELOCATE_TYPES += no-relocate 95endif 96ifeq ($(ART_TEST_RUN_TEST_RELOCATE_NO_PATCHOAT),true) 97 RELOCATE_TYPES := relocate-no-patchoat 98endif 99TRACE_TYPES := no-trace 100ifeq ($(ART_TEST_TRACE),true) 101 TRACE_TYPES += trace 102endif 103GC_TYPES := cms 104ifeq ($(ART_TEST_GC_STRESS),true) 105 GC_TYPES += gcstress 106endif 107ifeq ($(ART_TEST_GC_VERIFY),true) 108 GC_TYPES += gcverify 109endif 110JNI_TYPES := checkjni 111ifeq ($(ART_TEST_JNI_FORCECOPY),true) 112 JNI_TYPES += forcecopy 113endif 114IMAGE_TYPES := image 115ifeq ($(ART_TEST_RUN_TEST_NO_IMAGE),true) 116 IMAGE_TYPES += no-image 117endif 118RUN_TYPES := 119ifeq ($(ART_TEST_RUN_TEST_DEBUG),true) 120 RUN_TYPES += debug 121endif 122ifeq ($(ART_TEST_RUN_TEST_NDEBUG),true) 123 RUN_TYPES += ndebug 124endif 125ADDRESS_SIZES_TARGET := $(ART_PHONY_TEST_TARGET_SUFFIX) $(2ND_ART_PHONY_TEST_TARGET_SUFFIX) 126ADDRESS_SIZES_HOST := $(ART_PHONY_TEST_HOST_SUFFIX) $(2ND_ART_PHONY_TEST_HOST_SUFFIX) 127ALL_ADDRESS_SIZES := 64 32 128 129# List all run test names with number arguments agreeing with the comment above. 130define all-run-test-names 131 $(foreach target, $(1), \ 132 $(foreach run-type, $(2), \ 133 $(foreach prebuild, $(3), \ 134 $(foreach compiler, $(4), \ 135 $(foreach relocate, $(5), \ 136 $(foreach trace, $(6), \ 137 $(foreach gc, $(7), \ 138 $(foreach jni, $(8), \ 139 $(foreach image, $(9), \ 140 $(foreach test, $(10), \ 141 $(foreach address_size, $(11), \ 142 test-art-$(target)-run-test-$(run-type)-$(prebuild)-$(compiler)-$(relocate)-$(trace)-$(gc)-$(jni)-$(image)-$(test)$(address_size) \ 143 ))))))))))) 144endef # all-run-test-names 145 146# To generate a full list or tests: 147# $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES),$(COMPILER_TYPES), \ 148# $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \ 149# $(TEST_ART_RUN_TESTS), $(ALL_ADDRESS_SIZES)) 150 151# Convert's a rule name to the form used in variables, e.g. no-relocate to NO_RELOCATE 152define name-to-var 153$(shell echo $(1) | tr '[:lower:]' '[:upper:]' | tr '-' '_') 154endef # name-to-var 155 156# Tests that are timing sensitive and flaky on heavily loaded systems. 157TEST_ART_TIMING_SENSITIVE_RUN_TESTS := \ 158 053-wait-some \ 159 055-enum-performance 160 161 # disable timing sensitive tests on "dist" builds. 162ifdef dist_goal 163 ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \ 164 $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \ 165 $(IMAGE_TYPES), $(TEST_ART_TIMING_SENSITIVE_RUN_TESTS), $(ALL_ADDRESS_SIZES)) 166endif 167 168TEST_ART_TIMING_SENSITIVE_RUN_TESTS := 169 170TEST_ART_BROKEN_RUN_TESTS := \ 171 004-ThreadStress 172 173ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \ 174 $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \ 175 $(IMAGE_TYPES), $(TEST_ART_BROKEN_RUN_TESTS), $(ALL_ADDRESS_SIZES)) 176 177TEST_ART_BROKEN_RUN_TESTS := 178 179# Note 116-nodex2oat is not broken per-se it just doesn't (and isn't meant to) work with --prebuild. 180TEST_ART_BROKEN_PREBUILD_RUN_TESTS := \ 181 116-nodex2oat 182 183ifneq (,$(filter prebuild,$(PREBUILD_TYPES))) 184 ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),prebuild, \ 185 $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \ 186 $(IMAGE_TYPES), $(TEST_ART_BROKEN_PREBUILD_RUN_TESTS), $(ALL_ADDRESS_SIZES)) 187endif 188 189TEST_ART_BROKEN_PREBUILD_RUN_TESTS := 190 191TEST_ART_BROKEN_NO_PREBUILD_TESTS := \ 192 117-nopatchoat 193 194ifneq (,$(filter no-prebuild,$(PREBUILD_TYPES))) 195 ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),no-prebuild, \ 196 $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \ 197 $(IMAGE_TYPES), $(TEST_ART_BROKEN_NO_PREBUILD_TESTS), $(ALL_ADDRESS_SIZES)) 198endif 199 200TEST_ART_BROKEN_NO_PREBUILD_TESTS := 201 202# Note 117-nopatchoat is not broken per-se it just doesn't work (and isn't meant to) without 203# --prebuild --relocate 204TEST_ART_BROKEN_NO_RELOCATE_TESTS := \ 205 117-nopatchoat 206 207ifneq (,$(filter no-relocate,$(RELOCATE_TYPES))) 208 ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \ 209 $(COMPILER_TYPES), no-relocate,$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \ 210 $(IMAGE_TYPES), $(TEST_ART_BROKEN_NO_RELOCATE_TESTS), $(ALL_ADDRESS_SIZES)) 211endif 212 213TEST_ART_BROKEN_NO_RELOCATE_TESTS := 214 215# Tests that are broken with GC stress. 216TEST_ART_BROKEN_GCSTRESS_RUN_TESTS := \ 217 004-SignalTest \ 218 114-ParallelGC 219 220ifneq (,$(filter gcstress,$(GC_TYPES))) 221 ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \ 222 $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),gcstress,$(JNI_TYPES), \ 223 $(IMAGE_TYPES), $(TEST_ART_BROKEN_GCSTRESS_RUN_TESTS), $(ALL_ADDRESS_SIZES)) 224endif 225 226TEST_ART_BROKEN_GCSTRESS_RUN_TESTS := 227 228# 115-native-bridge setup is complicated. Need to implement it correctly for the target. 229ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,target,$(RUN_TYPES),$(PREBUILD_TYPES),$(COMPILER_TYPES), \ 230 $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES),115-native-bridge, \ 231 $(ALL_ADDRESS_SIZES)) 232 233# All these tests check that we have sane behavior if we don't have a patchoat or dex2oat. 234# Therefore we shouldn't run them in situations where we actually don't have these since they 235# explicitly test for them. These all also assume we have an image. 236TEST_ART_BROKEN_FALLBACK_RUN_TESTS := \ 237 116-nodex2oat \ 238 117-nopatchoat \ 239 118-noimage-dex2oat \ 240 119-noimage-patchoat 241 242ifneq (,$(filter no-dex2oat,$(PREBUILD_TYPES))) 243 ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),no-dex2oat, \ 244 $(COMPILER_TYPES),$(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \ 245 $(TEST_ART_BROKEN_FALLBACK_RUN_TESTS),$(ALL_ADDRESS_SIZES)) 246endif 247 248 249ifneq (,$(filter no-image,$(IMAGE_TYPES))) 250 ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \ 251 $(COMPILER_TYPES), $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),no-image, \ 252 $(TEST_ART_BROKEN_FALLBACK_RUN_TESTS),$(ALL_ADDRESS_SIZES)) 253endif 254 255ifneq (,$(filter relocate-no-patchoat,$(RELOCATE_TYPES))) 256 ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),$(RUN_TYPES),$(PREBUILD_TYPES), \ 257 $(COMPILER_TYPES), relocate-no-patchoat,$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES), \ 258 $(IMAGE_TYPES),$(TEST_ART_BROKEN_FALLBACK_RUN_TESTS),$(ALL_ADDRESS_SIZES)) 259endif 260 261TEST_ART_BROKEN_FALLBACK_RUN_TESTS := 262 263# The following tests use libarttest.so, which is linked against libartd.so, so will 264# not work when libart.so is the one loaded. 265# TODO: Find a way to run these tests in ndebug mode. 266TEST_ART_BROKEN_NDEBUG_TESTS := \ 267 004-JniTest \ 268 004-ReferenceMap \ 269 004-SignalTest \ 270 004-StackWalk \ 271 004-UnsafeTest \ 272 115-native-bridge \ 273 116-nodex2oat \ 274 117-nopatchoat \ 275 118-noimage-dex2oat \ 276 119-noimage-patchoat \ 277 278ifneq (,$(filter ndebug,$(RUN_TYPES))) 279 ART_TEST_KNOWN_BROKEN += $(call all-run-test-names,$(TARGET_TYPES),ndebug,$(PREBUILD_TYPES), \ 280 $(COMPILER_TYPES), $(RELOCATE_TYPES),$(TRACE_TYPES),$(GC_TYPES),$(JNI_TYPES),$(IMAGE_TYPES), \ 281 $(TEST_ART_BROKEN_NDEBUG_TESTS),$(ALL_ADDRESS_SIZES)) 282endif 283 284TEST_ART_BROKEN_NDEBUG_TESTS := 285 286# Clear variables ahead of appending to them when defining tests. 287$(foreach target, $(TARGET_TYPES), $(eval ART_RUN_TEST_$(call name-to-var,$(target))_RULES :=)) 288$(foreach target, $(TARGET_TYPES), \ 289 $(foreach prebuild, $(PREBUILD_TYPES), \ 290 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(prebuild))_RULES :=))) 291$(foreach target, $(TARGET_TYPES), \ 292 $(foreach compiler, $(COMPILER_TYPES), \ 293 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(compiler))_RULES :=))) 294$(foreach target, $(TARGET_TYPES), \ 295 $(foreach relocate, $(RELOCATE_TYPES), \ 296 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(relocate))_RULES :=))) 297$(foreach target, $(TARGET_TYPES), \ 298 $(foreach trace, $(TRACE_TYPES), \ 299 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(trace))_RULES :=))) 300$(foreach target, $(TARGET_TYPES), \ 301 $(foreach gc, $(GC_TYPES), \ 302 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(gc))_RULES :=))) 303$(foreach target, $(TARGET_TYPES), \ 304 $(foreach jni, $(JNI_TYPES), \ 305 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(jni))_RULES :=))) 306$(foreach target, $(TARGET_TYPES), \ 307 $(foreach image, $(IMAGE_TYPES), \ 308 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(image))_RULES :=))) 309$(foreach target, $(TARGET_TYPES), \ 310 $(foreach test, $(TEST_ART_RUN_TESTS), \ 311 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(test))_RULES :=))) 312$(foreach target, $(TARGET_TYPES), \ 313 $(foreach address_size, $(ALL_ADDRESS_SIZES), \ 314 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(address_size))_RULES :=))) 315$(foreach target, $(TARGET_TYPES), \ 316 $(foreach run_type, $(RUN_TYPES), \ 317 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(run_type))_RULES :=))) 318 319# We need dex2oat and dalvikvm on the target as well as the core image. 320TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_EXECUTABLES) $(TARGET_CORE_IMG_OUT) $(2ND_TARGET_CORE_IMG_OUT) 321 322# Also need libarttest. 323TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libarttest.so 324ifdef TARGET_2ND_ARCH 325TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_TEST_OUT)/$(TARGET_2ND_ARCH)/libarttest.so 326endif 327 328# Also need libnativebridgetest. 329TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_TEST_OUT)/$(TARGET_ARCH)/libnativebridgetest.so 330ifdef TARGET_2ND_ARCH 331TEST_ART_TARGET_SYNC_DEPS += $(ART_TARGET_TEST_OUT)/$(TARGET_2ND_ARCH)/libnativebridgetest.so 332endif 333 334# All tests require the host executables and the core images. 335ART_TEST_HOST_RUN_TEST_DEPENDENCIES := \ 336 $(ART_HOST_EXECUTABLES) \ 337 $(ART_HOST_OUT_SHARED_LIBRARIES)/libarttest$(ART_HOST_SHLIB_EXTENSION) \ 338 $(ART_HOST_OUT_SHARED_LIBRARIES)/libnativebridgetest$(ART_HOST_SHLIB_EXTENSION) \ 339 $(ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION) \ 340 $(HOST_CORE_IMG_OUT) 341 342ifneq ($(HOST_PREFER_32_BIT),true) 343ART_TEST_HOST_RUN_TEST_DEPENDENCIES += \ 344 $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libarttest$(ART_HOST_SHLIB_EXTENSION) \ 345 $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libnativebridgetest$(ART_HOST_SHLIB_EXTENSION) \ 346 $(2ND_ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$(ART_HOST_SHLIB_EXTENSION) \ 347 $(2ND_HOST_CORE_IMG_OUT) 348endif 349 350# Create a rule to build and run a tests following the form: 351# test-art-{1: host or target}-run-test-{2:debug ndebug}-{3: prebuild no-prebuild no-dex2oat}- 352# {4: interpreter default optimizing}-{5: relocate no-relocate relocate-no-patchoat}- 353# {6: trace or no-trace}-{7: gcstress gcverify cms}-{8: forcecopy checkjni jni}- 354# {9: no-image image}-{10: test name}{11: 32 or 64} 355define define-test-art-run-test 356 run_test_options := 357 prereq_rule := 358 test_groups := 359 uc_host_or_target := 360 ifeq ($(ART_TEST_RUN_TEST_ALWAYS_CLEAN),true) 361 run_test_options += --always-clean 362 endif 363 ifeq ($(1),host) 364 uc_host_or_target := HOST 365 test_groups := ART_RUN_TEST_HOST_RULES 366 run_test_options += --host 367 prereq_rule := $(ART_TEST_HOST_RUN_TEST_DEPENDENCIES) 368 else 369 ifeq ($(1),target) 370 uc_host_or_target := TARGET 371 test_groups := ART_RUN_TEST_TARGET_RULES 372 prereq_rule := test-art-target-sync 373 else 374 $$(error found $(1) expected $(TARGET_TYPES)) 375 endif 376 endif 377 ifeq ($(2),debug) 378 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_DEBUG_RULES 379 else 380 ifeq ($(2),ndebug) 381 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELEASE_RULES 382 run_test_options += -O 383 else 384 $$(error found $(2) expected $(RUN_TYPES)) 385 endif 386 endif 387 ifeq ($(3),prebuild) 388 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_PREBUILD_RULES 389 run_test_options += --prebuild 390 else 391 ifeq ($(3),no-prebuild) 392 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_PREBUILD_RULES 393 run_test_options += --no-prebuild 394 else 395 ifeq ($(3),no-dex2oat) 396 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_DEX2OAT_RULES 397 run_test_options += --no-prebuild --no-dex2oat 398 else 399 $$(error found $(3) expected $(PREBUILD_TYPES)) 400 endif 401 endif 402 endif 403 ifeq ($(4),optimizing) 404 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_OPTIMIZING_RULES 405 run_test_options += -Xcompiler-option --compiler-backend=Optimizing 406 else 407 ifeq ($(4),interpreter) 408 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_INTERPRETER_RULES 409 run_test_options += --interpreter 410 else 411 ifeq ($(4),default) 412 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_DEFAULT_RULES 413 else 414 $$(error found $(4) expected $(COMPILER_TYPES)) 415 endif 416 endif 417 endif 418 ifeq ($(5),relocate) 419 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELOCATE_RULES 420 run_test_options += --relocate 421 else 422 ifeq ($(5),no-relocate) 423 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_RELOCATE_RULES 424 run_test_options += --no-relocate 425 else 426 ifeq ($(5),relocate-no-patchoat) 427 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_RELOCATE_NO_PATCHOAT_RULES 428 run_test_options += --relocate --no-patchoat 429 else 430 $$(error found $(5) expected $(RELOCATE_TYPES)) 431 endif 432 endif 433 endif 434 ifeq ($(6),trace) 435 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_TRACE_RULES 436 run_test_options += --trace 437 else 438 ifeq ($(6),no-trace) 439 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_TRACE_RULES 440 else 441 $$(error found $(6) expected $(TRACE_TYPES)) 442 endif 443 endif 444 ifeq ($(7),gcverify) 445 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_GCVERIFY_RULES 446 run_test_options += --gcverify 447 else 448 ifeq ($(7),gcstress) 449 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_GCSTRESS_RULES 450 run_test_options += --gcstress 451 else 452 ifeq ($(7),cms) 453 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_CMS_RULES 454 else 455 $$(error found $(7) expected $(GC_TYPES)) 456 endif 457 endif 458 endif 459 ifeq ($(8),forcecopy) 460 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_FORCECOPY_RULES 461 run_test_options += --runtime-option -Xjniopts:forcecopy 462 ifneq ($$(ART_TEST_JNI_FORCECOPY),true) 463 skip_test := true 464 endif 465 else 466 ifeq ($(8),checkjni) 467 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_CHECKJNI_RULES 468 run_test_options += --runtime-option -Xcheck:jni 469 else 470 ifeq ($(8),jni) 471 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_JNI_RULES 472 else 473 $$(error found $(8) expected $(JNI_TYPES)) 474 endif 475 endif 476 endif 477 ifeq ($(9),no-image) 478 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_NO_IMAGE_RULES 479 run_test_options += --no-image 480 else 481 ifeq ($(9),image) 482 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_IMAGE_RULES 483 else 484 $$(error found $(9) expected $(IMAGE_TYPES)) 485 endif 486 endif 487 # $(10) is the test name 488 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_$(call name-to-var,$(10))_RULES 489 ifeq ($(11),64) 490 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_64_RULES 491 run_test_options += --64 492 else 493 ifeq ($(11),32) 494 test_groups += ART_RUN_TEST_$$(uc_host_or_target)_32_RULES 495 else 496 $$(error found $(11) expected $(ALL_ADDRESS_SIZES)) 497 endif 498 endif 499 run_test_rule_name := test-art-$(1)-run-test-$(2)-$(3)-$(4)-$(5)-$(6)-$(7)-$(8)-$(9)-$(10)$(11) 500 run_test_options := --output-path $(ART_HOST_TEST_DIR)/run-test-output/$$(run_test_rule_name) \ 501 $$(run_test_options) 502$$(run_test_rule_name): PRIVATE_RUN_TEST_OPTIONS := $$(run_test_options) 503.PHONY: $$(run_test_rule_name) 504$$(run_test_rule_name): $(DX) $(HOST_OUT_EXECUTABLES)/jasmin $(HOST_OUT_EXECUTABLES)/smali $(HOST_OUT_EXECUTABLES)/dexmerger $$(prereq_rule) 505 $(hide) $$(call ART_TEST_SKIP,$$@) && \ 506 DX=$(abspath $(DX)) JASMIN=$(abspath $(HOST_OUT_EXECUTABLES)/jasmin) \ 507 SMALI=$(abspath $(HOST_OUT_EXECUTABLES)/smali) \ 508 DXMERGER=$(abspath $(HOST_OUT_EXECUTABLES)/dexmerger) \ 509 art/test/run-test $$(PRIVATE_RUN_TEST_OPTIONS) $(10) \ 510 && $$(call ART_TEST_PASSED,$$@) || $$(call ART_TEST_FAILED,$$@) 511 $$(hide) (echo $(MAKECMDGOALS) | grep -q $$@ && \ 512 echo "run-test run as top-level target, removing test directory $(ART_HOST_TEST_DIR)" && \ 513 rm -r $(ART_HOST_TEST_DIR)) || true 514 515 $$(foreach test_group,$$(test_groups), $$(eval $$(value test_group) += $$(run_test_rule_name))) 516 517 # Clear locally defined variables. 518 uc_host_or_target := 519 test_groups := 520 run_test_options := 521 run_test_rule_name := 522 prereq_rule := 523endef # define-test-art-run-test 524 525$(foreach target, $(TARGET_TYPES), \ 526 $(foreach test, $(TEST_ART_RUN_TESTS), \ 527 $(foreach run_type, $(RUN_TYPES), \ 528 $(foreach address_size, $(ADDRESS_SIZES_$(call name-to-var,$(target))), \ 529 $(foreach prebuild, $(PREBUILD_TYPES), \ 530 $(foreach compiler, $(COMPILER_TYPES), \ 531 $(foreach relocate, $(RELOCATE_TYPES), \ 532 $(foreach trace, $(TRACE_TYPES), \ 533 $(foreach gc, $(GC_TYPES), \ 534 $(foreach jni, $(JNI_TYPES), \ 535 $(foreach image, $(IMAGE_TYPES), \ 536 $(eval $(call define-test-art-run-test,$(target),$(run_type),$(prebuild),$(compiler),$(relocate),$(trace),$(gc),$(jni),$(image),$(test),$(address_size))) \ 537 ))))))))))) 538define-test-art-run-test := 539 540# Define a phony rule whose purpose is to test its prerequisites. 541# $(1): host or target 542# $(2): list of prerequisites 543define define-test-art-run-test-group 544.PHONY: $(1) 545$(1): $(2) 546 $(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@) 547 548endef # define-test-art-run-test-group 549 550 551$(foreach target, $(TARGET_TYPES), $(eval \ 552 $(call define-test-art-run-test-group,test-art-$(target)-run-test,$(ART_RUN_TEST_$(call name-to-var,$(target))_RULES)))) 553$(foreach target, $(TARGET_TYPES), \ 554 $(foreach prebuild, $(PREBUILD_TYPES), $(eval \ 555 $(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))))) 556$(foreach target, $(TARGET_TYPES), \ 557 $(foreach run-type, $(RUN_TYPES), $(eval \ 558 $(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))))) 559$(foreach target, $(TARGET_TYPES), \ 560 $(foreach compiler, $(COMPILER_TYPES), $(eval \ 561 $(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))))) 562$(foreach target, $(TARGET_TYPES), \ 563 $(foreach relocate, $(RELOCATE_TYPES), $(eval \ 564 $(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))))) 565$(foreach target, $(TARGET_TYPES), \ 566 $(foreach trace, $(TRACE_TYPES), $(eval \ 567 $(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))))) 568$(foreach target, $(TARGET_TYPES), \ 569 $(foreach gc, $(GC_TYPES), $(eval \ 570 $(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))))) 571$(foreach target, $(TARGET_TYPES), \ 572 $(foreach jni, $(JNI_TYPES), $(eval \ 573 $(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))))) 574$(foreach target, $(TARGET_TYPES), \ 575 $(foreach image, $(IMAGE_TYPES), $(eval \ 576 $(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))))) 577$(foreach target, $(TARGET_TYPES), \ 578 $(foreach test, $(TEST_ART_RUN_TESTS), $(eval \ 579 $(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))))) 580$(foreach target, $(TARGET_TYPES), \ 581 $(foreach address_size, $(ADDRESS_SIZES_$(call name-to-var,$(target))), $(eval \ 582 $(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))))) 583 584# Clear variables now we're finished with them. 585$(foreach target, $(TARGET_TYPES), $(eval ART_RUN_TEST_$(call name-to-var,$(target))_RULES :=)) 586$(foreach target, $(TARGET_TYPES), \ 587 $(foreach prebuild, $(PREBUILD_TYPES), \ 588 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(prebuild))_RULES :=))) 589$(foreach target, $(TARGET_TYPES), \ 590 $(foreach compiler, $(COMPILER_TYPES), \ 591 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(compiler))_RULES :=))) 592$(foreach target, $(TARGET_TYPES), \ 593 $(foreach relocate, $(RELOCATE_TYPES), \ 594 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(relocate))_RULES :=))) 595$(foreach target, $(TARGET_TYPES), \ 596 $(foreach trace, $(TRACE_TYPES), \ 597 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(trace))_RULES :=))) 598$(foreach target, $(TARGET_TYPES), \ 599 $(foreach gc, $(GC_TYPES), \ 600 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(gc))_RULES :=))) 601$(foreach target, $(TARGET_TYPES), \ 602 $(foreach jni, $(JNI_TYPES), \ 603 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(jni))_RULES :=))) 604$(foreach target, $(TARGET_TYPES), \ 605 $(foreach image, $(IMAGE_TYPES), \ 606 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(image))_RULES :=))) 607$(foreach target, $(TARGET_TYPES), \ 608 $(foreach test, $(TEST_ART_RUN_TESTS), \ 609 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(test))_RULES :=))) 610$(foreach target, $(TARGET_TYPES), \ 611 $(foreach address_size, $(ALL_ADDRESS_SIZES), \ 612 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(address_size))_RULES :=))) 613$(foreach target, $(TARGET_TYPES), \ 614 $(foreach run_type, $(RUN_TYPES), \ 615 $(eval ART_RUN_TEST_$(call name-to-var,$(target))_$(call name-to-var,$(run_type))_RULES :=))) 616define-test-art-run-test-group := 617TARGET_TYPES := 618PREBUILD_TYPES := 619COMPILER_TYPES := 620RELOCATE_TYPES := 621TRACE_TYPES := 622GC_TYPES := 623JNI_TYPES := 624IMAGE_TYPES := 625ADDRESS_SIZES_TARGET := 626ADDRESS_SIZES_HOST := 627ALL_ADDRESS_SIZES := 628RUN_TYPES := 629 630include $(LOCAL_PATH)/Android.libarttest.mk 631include art/test/Android.libnativebridgetest.mk 632