1 # 2 # Copyright (C) 2011 The Android Open Source Project 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 # 16 17 # The path for which all the dex files are relative, not actually the current directory. 18 LOCAL_PATH := art/test 19 20 include art/build/Android.common_test.mk 21 include art/build/Android.common_path.mk 22 23 # Subdirectories in art/test which contain dex files used as inputs for gtests. 24 GTEST_DEX_DIRECTORIES := \ 25 AbstractMethod \ 26 AllFields \ 27 ExceptionHandle \ 28 GetMethodSignature \ 29 Interfaces \ 30 Main \ 31 MyClass \ 32 MyClassNatives \ 33 Nested \ 34 NonStaticLeafMethods \ 35 ProtoCompare \ 36 ProtoCompare2 \ 37 StaticLeafMethods \ 38 Statics \ 39 StaticsFromCode \ 40 Transaction \ 41 XandY 42 43 # Create build rules for each dex file recording the dependency. 44 $(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval $(call build-art-test-dex,art-gtest,$(dir), \ 45 $(ART_TARGET_NATIVETEST_OUT),art/build/Android.gtest.mk,ART_TEST_TARGET_GTEST_$(dir)_DEX, \ 46 ART_TEST_HOST_GTEST_$(dir)_DEX))) 47 48 # Dex file dependencies for each gtest. 49 ART_GTEST_class_linker_test_DEX_DEPS := Interfaces MyClass Nested Statics StaticsFromCode 50 ART_GTEST_compiler_driver_test_DEX_DEPS := AbstractMethod 51 ART_GTEST_dex_file_test_DEX_DEPS := GetMethodSignature 52 ART_GTEST_exception_test_DEX_DEPS := ExceptionHandle 53 ART_GTEST_jni_compiler_test_DEX_DEPS := MyClassNatives 54 ART_GTEST_jni_internal_test_DEX_DEPS := AllFields StaticLeafMethods 55 ART_GTEST_object_test_DEX_DEPS := ProtoCompare ProtoCompare2 StaticsFromCode XandY 56 ART_GTEST_proxy_test_DEX_DEPS := Interfaces 57 ART_GTEST_reflection_test_DEX_DEPS := Main NonStaticLeafMethods StaticLeafMethods 58 ART_GTEST_stub_test_DEX_DEPS := AllFields 59 ART_GTEST_transaction_test_DEX_DEPS := Transaction 60 61 # The elf writer test has dependencies on core.oat. 62 ART_GTEST_elf_writer_test_HOST_DEPS := $(HOST_CORE_OAT_OUT) $(2ND_HOST_CORE_OAT_OUT) 63 ART_GTEST_elf_writer_test_TARGET_DEPS := $(TARGET_CORE_OAT_OUT) $(2ND_TARGET_CORE_OAT_OUT) 64 65 # The path for which all the source files are relative, not actually the current directory. 66 LOCAL_PATH := art 67 68 RUNTIME_GTEST_COMMON_SRC_FILES := \ 69 runtime/arch/arch_test.cc \ 70 runtime/arch/memcmp16_test.cc \ 71 runtime/arch/stub_test.cc \ 72 runtime/barrier_test.cc \ 73 runtime/base/bit_field_test.cc \ 74 runtime/base/bit_vector_test.cc \ 75 runtime/base/hash_set_test.cc \ 76 runtime/base/hex_dump_test.cc \ 77 runtime/base/histogram_test.cc \ 78 runtime/base/mutex_test.cc \ 79 runtime/base/scoped_flock_test.cc \ 80 runtime/base/stringprintf_test.cc \ 81 runtime/base/timing_logger_test.cc \ 82 runtime/base/unix_file/fd_file_test.cc \ 83 runtime/base/unix_file/mapped_file_test.cc \ 84 runtime/base/unix_file/null_file_test.cc \ 85 runtime/base/unix_file/random_access_file_utils_test.cc \ 86 runtime/base/unix_file/string_file_test.cc \ 87 runtime/class_linker_test.cc \ 88 runtime/dex_file_test.cc \ 89 runtime/dex_file_verifier_test.cc \ 90 runtime/dex_instruction_visitor_test.cc \ 91 runtime/dex_method_iterator_test.cc \ 92 runtime/entrypoints/math_entrypoints_test.cc \ 93 runtime/entrypoints/quick/quick_trampoline_entrypoints_test.cc \ 94 runtime/entrypoints_order_test.cc \ 95 runtime/exception_test.cc \ 96 runtime/gc/accounting/card_table_test.cc \ 97 runtime/gc/accounting/space_bitmap_test.cc \ 98 runtime/gc/heap_test.cc \ 99 runtime/gc/space/dlmalloc_space_base_test.cc \ 100 runtime/gc/space/dlmalloc_space_static_test.cc \ 101 runtime/gc/space/dlmalloc_space_random_test.cc \ 102 runtime/gc/space/rosalloc_space_base_test.cc \ 103 runtime/gc/space/rosalloc_space_static_test.cc \ 104 runtime/gc/space/rosalloc_space_random_test.cc \ 105 runtime/gc/space/large_object_space_test.cc \ 106 runtime/gtest_test.cc \ 107 runtime/handle_scope_test.cc \ 108 runtime/indenter_test.cc \ 109 runtime/indirect_reference_table_test.cc \ 110 runtime/instruction_set_test.cc \ 111 runtime/intern_table_test.cc \ 112 runtime/leb128_test.cc \ 113 runtime/mem_map_test.cc \ 114 runtime/mirror/dex_cache_test.cc \ 115 runtime/mirror/object_test.cc \ 116 runtime/monitor_pool_test.cc \ 117 runtime/monitor_test.cc \ 118 runtime/parsed_options_test.cc \ 119 runtime/reference_table_test.cc \ 120 runtime/thread_pool_test.cc \ 121 runtime/transaction_test.cc \ 122 runtime/utils_test.cc \ 123 runtime/verifier/method_verifier_test.cc \ 124 runtime/verifier/reg_type_test.cc \ 125 runtime/zip_archive_test.cc 126 127 COMPILER_GTEST_COMMON_SRC_FILES := \ 128 runtime/jni_internal_test.cc \ 129 runtime/proxy_test.cc \ 130 runtime/reflection_test.cc \ 131 compiler/dex/global_value_numbering_test.cc \ 132 compiler/dex/local_value_numbering_test.cc \ 133 compiler/dex/mir_graph_test.cc \ 134 compiler/dex/mir_optimization_test.cc \ 135 compiler/driver/compiler_driver_test.cc \ 136 compiler/elf_writer_test.cc \ 137 compiler/image_test.cc \ 138 compiler/jni/jni_compiler_test.cc \ 139 compiler/oat_test.cc \ 140 compiler/optimizing/codegen_test.cc \ 141 compiler/optimizing/dominator_test.cc \ 142 compiler/optimizing/find_loops_test.cc \ 143 compiler/optimizing/graph_test.cc \ 144 compiler/optimizing/linearize_test.cc \ 145 compiler/optimizing/liveness_test.cc \ 146 compiler/optimizing/live_interval_test.cc \ 147 compiler/optimizing/live_ranges_test.cc \ 148 compiler/optimizing/parallel_move_test.cc \ 149 compiler/optimizing/pretty_printer_test.cc \ 150 compiler/optimizing/register_allocator_test.cc \ 151 compiler/optimizing/ssa_test.cc \ 152 compiler/optimizing/stack_map_test.cc \ 153 compiler/output_stream_test.cc \ 154 compiler/utils/arena_allocator_test.cc \ 155 compiler/utils/dedupe_set_test.cc \ 156 compiler/utils/swap_space_test.cc \ 157 compiler/utils/arm/managed_register_arm_test.cc \ 158 compiler/utils/arm64/managed_register_arm64_test.cc \ 159 compiler/utils/x86/managed_register_x86_test.cc \ 160 161 ifeq ($(ART_SEA_IR_MODE),true) 162 COMPILER_GTEST_COMMON_SRC_FILES += \ 163 compiler/utils/scoped_hashtable_test.cc \ 164 compiler/sea_ir/types/type_data_test.cc \ 165 compiler/sea_ir/types/type_inference_visitor_test.cc \ 166 compiler/sea_ir/ir/regions_test.cc 167 endif 168 169 RUNTIME_GTEST_TARGET_SRC_FILES := \ 170 $(RUNTIME_GTEST_COMMON_SRC_FILES) 171 172 RUNTIME_GTEST_HOST_SRC_FILES := \ 173 $(RUNTIME_GTEST_COMMON_SRC_FILES) 174 175 COMPILER_GTEST_TARGET_SRC_FILES := \ 176 $(COMPILER_GTEST_COMMON_SRC_FILES) 177 178 COMPILER_GTEST_HOST_SRC_FILES := \ 179 $(COMPILER_GTEST_COMMON_SRC_FILES) \ 180 compiler/utils//assembler_thumb_test.cc \ 181 compiler/utils/x86/assembler_x86_test.cc \ 182 compiler/utils/x86_64/assembler_x86_64_test.cc 183 184 ART_TEST_CFLAGS := 185 ifeq ($(ART_USE_PORTABLE_COMPILER),true) 186 ART_TEST_CFLAGS += -DART_USE_PORTABLE_COMPILER=1 187 endif 188 189 include $(CLEAR_VARS) 190 LOCAL_MODULE := libart-gtest 191 LOCAL_MODULE_TAGS := optional 192 LOCAL_CPP_EXTENSION := cc 193 LOCAL_CFLAGS := $(ART_TARGET_CFLAGS) 194 LOCAL_SRC_FILES := runtime/common_runtime_test.cc compiler/common_compiler_test.cc 195 LOCAL_C_INCLUDES := $(ART_C_INCLUDES) art/runtime art/compiler 196 LOCAL_SHARED_LIBRARIES := libcutils libartd libartd-compiler libdl 197 LOCAL_STATIC_LIBRARIES += libgtest_libc++ 198 LOCAL_CLANG := $(ART_TARGET_CLANG) 199 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk 200 LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk 201 include external/libcxx/libcxx.mk 202 include $(BUILD_SHARED_LIBRARY) 203 204 include $(CLEAR_VARS) 205 LOCAL_MODULE := libart-gtest 206 LOCAL_MODULE_TAGS := optional 207 LOCAL_CPP_EXTENSION := cc 208 LOCAL_CFLAGS := $(ART_HOST_CFLAGS) 209 LOCAL_SRC_FILES := runtime/common_runtime_test.cc compiler/common_compiler_test.cc 210 LOCAL_C_INCLUDES := $(ART_C_INCLUDES) art/runtime art/compiler 211 LOCAL_SHARED_LIBRARIES := libartd libartd-compiler 212 LOCAL_STATIC_LIBRARIES := libcutils 213 ifneq ($(WITHOUT_HOST_CLANG),true) 214 # GCC host compiled tests fail with this linked, presumably due to destructors that run. 215 LOCAL_STATIC_LIBRARIES += libgtest_libc++_host 216 endif 217 LOCAL_LDLIBS += -ldl -lpthread 218 LOCAL_MULTILIB := both 219 LOCAL_CLANG := $(ART_HOST_CLANG) 220 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk 221 LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk 222 include external/libcxx/libcxx.mk 223 include $(BUILD_HOST_SHARED_LIBRARY) 224 225 # Variables holding collections of gtest pre-requisits used to run a number of gtests. 226 ART_TEST_HOST_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES := 227 ART_TEST_HOST_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES := 228 ART_TEST_HOST_GTEST_RULES := 229 ART_TEST_HOST_VALGRIND_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES := 230 ART_TEST_HOST_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES := 231 ART_TEST_HOST_VALGRIND_GTEST_RULES := 232 ART_TEST_TARGET_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES := 233 ART_TEST_TARGET_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES := 234 ART_TEST_TARGET_GTEST_RULES := 235 236 # Define a make rule for a target device gtest. 237 # $(1): gtest name - the name of the test we're building such as leb128_test. 238 # $(2): 2ND_ or undefined - used to differentiate between the primary and secondary architecture. 239 define define-art-gtest-rule-target 240 gtest_rule := test-art-target-gtest-$(1)$$($(2)ART_PHONY_TEST_TARGET_SUFFIX) 241 242 # Add the test dependencies to test-art-target-sync, which will be a prerequisite for the test 243 # to ensure files are pushed to the device. 244 TEST_ART_TARGET_SYNC_DEPS += \ 245 $$(ART_GTEST_$(1)_TARGET_DEPS) \ 246 $(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_TARGET_GTEST_$(file)_DEX)) \ 247 $$(ART_TARGET_NATIVETEST_OUT)/$$(TARGET_$(2)ARCH)/$(1) \ 248 $$($(2)TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so 249 250 .PHONY: $$(gtest_rule) 251 $$(gtest_rule): test-art-target-sync 252 $(hide) adb shell touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID 253 $(hide) adb shell rm $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID 254 $(hide) adb shell chmod 755 $(ART_TARGET_NATIVETEST_DIR)/$(TARGET_$(2)ARCH)/$(1) 255 $(hide) $$(call ART_TEST_SKIP,$$@) && \ 256 (adb shell "$(ART_TARGET_NATIVETEST_DIR)/$(TARGET_$(2)ARCH)/$(1) && touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID" \ 257 && (adb pull $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID /tmp/ \ 258 && $$(call ART_TEST_PASSED,$$@)) \ 259 || $$(call ART_TEST_FAILED,$$@)) 260 $(hide) rm /tmp/$$@-$$$$PPID 261 262 ART_TEST_TARGET_GTEST$($(2)ART_PHONY_TEST_TARGET_SUFFIX)_RULES += $$(gtest_rule) 263 ART_TEST_TARGET_GTEST_RULES += $$(gtest_rule) 264 ART_TEST_TARGET_GTEST_$(1)_RULES += $$(gtest_rule) 265 266 # Clear locally defined variables. 267 gtest_rule := 268 endef # define-art-gtest-rule-target 269 270 # Define make rules for a host gtests. 271 # $(1): gtest name - the name of the test we're building such as leb128_test. 272 # $(2): 2ND_ or undefined - used to differentiate between the primary and secondary architecture. 273 define define-art-gtest-rule-host 274 gtest_rule := test-art-host-gtest-$(1)$$($(2)ART_PHONY_TEST_HOST_SUFFIX) 275 gtest_exe := $$(HOST_OUT_EXECUTABLES)/$(1)$$($(2)ART_PHONY_TEST_HOST_SUFFIX) 276 # Dependencies for all host gtests. 277 gtest_deps := $$(HOST_CORE_DEX_LOCATIONS) \ 278 $$($(2)ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$$(ART_HOST_SHLIB_EXTENSION) 279 280 281 .PHONY: $$(gtest_rule) 282 $$(gtest_rule): $$(gtest_exe) $$(ART_GTEST_$(1)_HOST_DEPS) $(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_HOST_GTEST_$(file)_DEX)) $$(gtest_deps) 283 $(hide) ($$(call ART_TEST_SKIP,$$@) && $$< && $$(call ART_TEST_PASSED,$$@)) \ 284 || $$(call ART_TEST_FAILED,$$@) 285 286 ART_TEST_HOST_GTEST$$($(2)ART_PHONY_TEST_HOST_SUFFIX)_RULES += $$(gtest_rule) 287 ART_TEST_HOST_GTEST_RULES += $$(gtest_rule) 288 ART_TEST_HOST_GTEST_$(1)_RULES += $$(gtest_rule) 289 290 .PHONY: valgrind-$$(gtest_rule) 291 valgrind-$$(gtest_rule): $$(gtest_exe) $$(ART_GTEST_$(1)_HOST_DEPS) $(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_HOST_GTEST_$(file)_DEX)) $$(gtest_deps) 292 $(hide) $$(call ART_TEST_SKIP,$$@) && \ 293 valgrind --leak-check=full --error-exitcode=1 $$< && $$(call ART_TEST_PASSED,$$@) \ 294 || $$(call ART_TEST_FAILED,$$@) 295 296 ART_TEST_HOST_VALGRIND_GTEST$$($(2)ART_PHONY_TEST_HOST_SUFFIX)_RULES += valgrind-$$(gtest_rule) 297 ART_TEST_HOST_VALGRIND_GTEST_RULES += valgrind-$$(gtest_rule) 298 ART_TEST_HOST_VALGRIND_GTEST_$(1)_RULES += valgrind-$$(gtest_rule) 299 300 # Clear locally defined variables. 301 valgrind_gtest_rule := 302 gtest_rule := 303 gtest_exe := 304 gtest_deps := 305 endef # define-art-gtest-rule-host 306 307 # Define the rules to build and run host and target gtests. 308 # $(1): target or host 309 # $(2): file name 310 # $(3): extra C includes 311 # $(4): extra shared libraries 312 define define-art-gtest 313 ifneq ($(1),target) 314 ifneq ($(1),host) 315 $$(error expected target or host for argument 1, received $(1)) 316 endif 317 endif 318 319 art_target_or_host := $(1) 320 art_gtest_filename := $(2) 321 art_gtest_extra_c_includes := $(3) 322 art_gtest_extra_shared_libraries := $(4) 323 324 include $$(CLEAR_VARS) 325 art_gtest_name := $$(notdir $$(basename $$(art_gtest_filename))) 326 LOCAL_MODULE := $$(art_gtest_name) 327 ifeq ($$(art_target_or_host),target) 328 LOCAL_MODULE_TAGS := tests 329 endif 330 LOCAL_CPP_EXTENSION := $$(ART_CPP_EXTENSION) 331 LOCAL_SRC_FILES := $$(art_gtest_filename) 332 LOCAL_C_INCLUDES += $$(ART_C_INCLUDES) art/runtime $$(art_gtest_extra_c_includes) 333 LOCAL_SHARED_LIBRARIES += libartd $$(art_gtest_extra_shared_libraries) libart-gtest 334 LOCAL_WHOLE_STATIC_LIBRARIES += libsigchain 335 336 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk 337 LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk 338 339 # Mac OS linker doesn't understand --export-dynamic. 340 ifneq ($$(HOST_OS)-$$(art_target_or_host),darwin-host) 341 # Allow jni_compiler_test to find Java_MyClassNatives_bar within itself using dlopen(NULL, ...). 342 LOCAL_LDFLAGS := -Wl,--export-dynamic -Wl,-u,Java_MyClassNatives_bar -Wl,-u,Java_MyClassNatives_sbar 343 endif 344 345 LOCAL_CFLAGS := $$(ART_TEST_CFLAGS) 346 include external/libcxx/libcxx.mk 347 ifeq ($$(art_target_or_host),target) 348 $$(eval $$(call set-target-local-clang-vars)) 349 $$(eval $$(call set-target-local-cflags-vars,debug)) 350 LOCAL_SHARED_LIBRARIES += libdl libicuuc libicui18n libnativehelper libz libcutils libvixl 351 LOCAL_MODULE_PATH_32 := $$(ART_TARGET_NATIVETEST_OUT)/$$(ART_TARGET_ARCH_32) 352 LOCAL_MODULE_PATH_64 := $$(ART_TARGET_NATIVETEST_OUT)/$$(ART_TARGET_ARCH_64) 353 LOCAL_MULTILIB := both 354 include $$(BUILD_EXECUTABLE) 355 356 ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES := 357 ifdef TARGET_2ND_ARCH 358 $$(eval $$(call define-art-gtest-rule-target,$$(art_gtest_name),2ND_)) 359 endif 360 $$(eval $$(call define-art-gtest-rule-target,$$(art_gtest_name),)) 361 362 # A rule to run the different architecture versions of the gtest. 363 .PHONY: test-art-target-gtest-$$(art_gtest_name) 364 test-art-target-gtest-$$(art_gtest_name): $$(ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES) 365 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@) 366 367 # Clear locally defined variables. 368 ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES := 369 else # host 370 LOCAL_CLANG := $$(ART_HOST_CLANG) 371 LOCAL_CFLAGS += $$(ART_HOST_CFLAGS) $$(ART_HOST_DEBUG_CFLAGS) 372 LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host libnativehelper libz-host 373 LOCAL_STATIC_LIBRARIES += libcutils libvixl 374 LOCAL_LDLIBS += -lpthread -ldl 375 LOCAL_IS_HOST_MODULE := true 376 LOCAL_MULTILIB := both 377 LOCAL_MODULE_STEM_32 := $$(art_gtest_name)32 378 LOCAL_MODULE_STEM_64 := $$(art_gtest_name)64 379 include $$(BUILD_HOST_EXECUTABLE) 380 381 ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES := 382 ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES := 383 ifneq ($$(HOST_PREFER_32_BIT),true) 384 $$(eval $$(call define-art-gtest-rule-host,$$(art_gtest_name),2ND_)) 385 endif 386 $$(eval $$(call define-art-gtest-rule-host,$$(art_gtest_name),)) 387 388 # Rules to run the different architecture versions of the gtest. 389 .PHONY: test-art-host-gtest-$$(art_gtest_name) 390 test-art-host-gtest-$$(art_gtest_name): $$(ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES) 391 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@) 392 393 .PHONY: valgrind-test-art-host-gtest-$$(art_gtest_name) 394 valgrind-test-art-host-gtest-$$(art_gtest_name): $$(ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES) 395 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@) 396 397 # Clear locally defined variables. 398 ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES := 399 ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES := 400 endif # host_or_target 401 402 # Clear locally defined variables. 403 art_target_or_host := 404 art_gtest_filename := 405 art_gtest_extra_c_includes := 406 art_gtest_extra_shared_libraries := 407 art_gtest_name := 408 endef # define-art-gtest 409 410 ifeq ($(ART_BUILD_TARGET),true) 411 $(foreach file,$(RUNTIME_GTEST_TARGET_SRC_FILES), $(eval $(call define-art-gtest,target,$(file),,))) 412 $(foreach file,$(COMPILER_GTEST_TARGET_SRC_FILES), $(eval $(call define-art-gtest,target,$(file),art/compiler,libartd-compiler))) 413 endif 414 ifeq ($(ART_BUILD_HOST),true) 415 $(foreach file,$(RUNTIME_GTEST_HOST_SRC_FILES), $(eval $(call define-art-gtest,host,$(file),,))) 416 $(foreach file,$(COMPILER_GTEST_HOST_SRC_FILES), $(eval $(call define-art-gtest,host,$(file),art/compiler,libartd-compiler))) 417 endif 418 419 # Used outside the art project to get a list of the current tests 420 RUNTIME_TARGET_GTEST_MAKE_TARGETS := 421 $(foreach file, $(RUNTIME_GTEST_TARGET_SRC_FILES), $(eval RUNTIME_TARGET_GTEST_MAKE_TARGETS += $$(notdir $$(basename $$(file))))) 422 COMPILER_TARGET_GTEST_MAKE_TARGETS := 423 $(foreach file, $(COMPILER_GTEST_TARGET_SRC_FILES), $(eval COMPILER_TARGET_GTEST_MAKE_TARGETS += $$(notdir $$(basename $$(file))))) 424 425 # Define all the combinations of host/target, valgrind and suffix such as: 426 # test-art-host-gtest or valgrind-test-art-host-gtest64 427 # $(1): host or target 428 # $(2): HOST or TARGET 429 # $(3): valgrind- or undefined 430 # $(4): undefined, 32 or 64 431 define define-test-art-gtest-combination 432 ifeq ($(1),host) 433 ifneq ($(2),HOST) 434 $$(error argument mismatch $(1) and ($2)) 435 endif 436 else 437 ifneq ($(1),target) 438 $$(error found $(1) expected host or target) 439 endif 440 ifneq ($(2),TARGET) 441 $$(error argument mismatch $(1) and ($2)) 442 endif 443 endif 444 445 rule_name := $(3)test-art-$(1)-gtest$(4) 446 dependencies := $$(ART_TEST_$(2)_GTEST$(4)_RULES) 447 448 .PHONY: $$(rule_name) 449 $$(rule_name): $$(dependencies) 450 $(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@) 451 452 # Clear locally defined variables. 453 rule_name := 454 dependencies := 455 endef # define-test-art-gtest-combination 456 457 $(eval $(call define-test-art-gtest-combination,target,TARGET,,)) 458 $(eval $(call define-test-art-gtest-combination,target,TARGET,,$(ART_PHONY_TEST_TARGET_SUFFIX))) 459 ifdef TARGET_2ND_ARCH 460 $(eval $(call define-test-art-gtest-combination,target,TARGET,,$(2ND_ART_PHONY_TEST_TARGET_SUFFIX))) 461 endif 462 $(eval $(call define-test-art-gtest-combination,host,HOST,,)) 463 $(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,)) 464 $(eval $(call define-test-art-gtest-combination,host,HOST,,$(ART_PHONY_TEST_HOST_SUFFIX))) 465 $(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,$(ART_PHONY_TEST_HOST_SUFFIX))) 466 ifneq ($(HOST_PREFER_32_BIT),true) 467 $(eval $(call define-test-art-gtest-combination,host,HOST,,$(2ND_ART_PHONY_TEST_HOST_SUFFIX))) 468 $(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,$(2ND_ART_PHONY_TEST_HOST_SUFFIX))) 469 endif 470 471 # Clear locally defined variables. 472 define-art-gtest-rule-target := 473 define-art-gtest-rule-host := 474 define-art-gtest := 475 define-test-art-gtest-combination := 476 RUNTIME_GTEST_COMMON_SRC_FILES := 477 COMPILER_GTEST_COMMON_SRC_FILES := 478 RUNTIME_GTEST_TARGET_SRC_FILES := 479 RUNTIME_GTEST_HOST_SRC_FILES := 480 COMPILER_GTEST_TARGET_SRC_FILES := 481 COMPILER_GTEST_HOST_SRC_FILES := 482 ART_TEST_CFLAGS := 483 ART_TEST_HOST_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES := 484 ART_TEST_HOST_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES := 485 ART_TEST_HOST_GTEST_RULES := 486 ART_TEST_HOST_VALGRIND_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES := 487 ART_TEST_HOST_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES := 488 ART_TEST_HOST_VALGRIND_GTEST_RULES := 489 ART_TEST_TARGET_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES := 490 ART_TEST_TARGET_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES := 491 ART_TEST_TARGET_GTEST_RULES := 492 ART_GTEST_class_linker_test_DEX_DEPS := 493 ART_GTEST_compiler_driver_test_DEX_DEPS := 494 ART_GTEST_dex_file_test_DEX_DEPS := 495 ART_GTEST_exception_test_DEX_DEPS := 496 ART_GTEST_elf_writer_test_HOST_DEPS := 497 ART_GTEST_elf_writer_test_TARGET_DEPS := 498 ART_GTEST_jni_compiler_test_DEX_DEPS := 499 ART_GTEST_jni_internal_test_DEX_DEPS := 500 ART_GTEST_object_test_DEX_DEPS := 501 ART_GTEST_proxy_test_DEX_DEPS := 502 ART_GTEST_reflection_test_DEX_DEPS := 503 ART_GTEST_stub_test_DEX_DEPS := 504 ART_GTEST_transaction_test_DEX_DEPS := 505 $(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval ART_TEST_TARGET_GTEST_$(dir)_DEX :=)) 506 $(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval ART_TEST_HOST_GTEST_$(dir)_DEX :=)) 507 GTEST_DEX_DIRECTORIES := 508 LOCAL_PATH := 509