blob: 7d7679571495b5426ffd1c2758cca52ec9e4e63a [file] [log] [blame]
Carl Shapiro008e4122011-06-23 17:27:46 -07001#
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
Ian Rogersafd9acc2014-06-17 08:21:54 -070017# The path for which all the dex files are relative, not actually the current directory.
18LOCAL_PATH := art/test
19
20include art/build/Android.common_test.mk
21include art/build/Android.common_path.mk
22
23# Subdirectories in art/test which contain dex files used as inputs for gtests.
24GTEST_DEX_DIRECTORIES := \
25 AbstractMethod \
26 AllFields \
27 ExceptionHandle \
28 GetMethodSignature \
29 Interfaces \
30 Main \
Richard Uhler66d874d2015-01-15 09:37:19 -080031 MultiDex \
Ian Rogersafd9acc2014-06-17 08:21:54 -070032 MyClass \
33 MyClassNatives \
34 Nested \
35 NonStaticLeafMethods \
36 ProtoCompare \
37 ProtoCompare2 \
38 StaticLeafMethods \
39 Statics \
40 StaticsFromCode \
41 Transaction \
42 XandY
43
44# Create build rules for each dex file recording the dependency.
45$(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval $(call build-art-test-dex,art-gtest,$(dir), \
Ian Rogers1a2f84e2014-07-07 16:05:18 -070046 $(ART_TARGET_NATIVETEST_OUT),art/build/Android.gtest.mk,ART_TEST_TARGET_GTEST_$(dir)_DEX, \
47 ART_TEST_HOST_GTEST_$(dir)_DEX)))
Ian Rogersafd9acc2014-06-17 08:21:54 -070048
Richard Uhler66d874d2015-01-15 09:37:19 -080049# Create rules for MainStripped, a copy of Main with the classes.dex stripped
50# for the oat file assistant tests.
51ART_TEST_HOST_GTEST_MainStripped_DEX := $(basename $(ART_TEST_HOST_GTEST_Main_DEX))Stripped$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
52ART_TEST_TARGET_GTEST_MainStripped_DEX := $(basename $(ART_TEST_TARGET_GTEST_Main_DEX))Stripped$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))
53
54$(ART_TEST_HOST_GTEST_MainStripped_DEX): $(ART_TEST_HOST_GTEST_Main_DEX)
55 cp $< $@
56 $(call dexpreopt-remove-classes.dex,$@)
57
58$(ART_TEST_TARGET_GTEST_MainStripped_DEX): $(ART_TEST_TARGET_GTEST_Main_DEX)
59 cp $< $@
60 $(call dexpreopt-remove-classes.dex,$@)
61
Ian Rogersafd9acc2014-06-17 08:21:54 -070062# Dex file dependencies for each gtest.
Andreas Gampe81c6f8d2015-03-25 17:19:53 -070063ART_GTEST_class_linker_test_DEX_DEPS := Interfaces MultiDex MyClass Nested Statics StaticsFromCode
Andreas Gampe70bef0d2015-04-15 02:37:28 -070064ART_GTEST_compiler_driver_test_DEX_DEPS := AbstractMethod StaticLeafMethods
Andreas Gampeda823442014-11-03 15:36:53 -080065ART_GTEST_dex_file_test_DEX_DEPS := GetMethodSignature Main Nested
Brian Carlstromeb85f2b2014-06-25 13:23:00 -070066ART_GTEST_exception_test_DEX_DEPS := ExceptionHandle
67ART_GTEST_jni_compiler_test_DEX_DEPS := MyClassNatives
68ART_GTEST_jni_internal_test_DEX_DEPS := AllFields StaticLeafMethods
Richard Uhler66d874d2015-01-15 09:37:19 -080069ART_GTEST_oat_file_assistant_test_DEX_DEPS := Main MainStripped MultiDex Nested
Andreas Gampe7848da42015-04-09 11:15:04 -070070ART_GTEST_oat_file_test_DEX_DEPS := Main MultiDex
Brian Carlstromeb85f2b2014-06-25 13:23:00 -070071ART_GTEST_object_test_DEX_DEPS := ProtoCompare ProtoCompare2 StaticsFromCode XandY
72ART_GTEST_proxy_test_DEX_DEPS := Interfaces
73ART_GTEST_reflection_test_DEX_DEPS := Main NonStaticLeafMethods StaticLeafMethods
74ART_GTEST_stub_test_DEX_DEPS := AllFields
75ART_GTEST_transaction_test_DEX_DEPS := Transaction
Ian Rogersafd9acc2014-06-17 08:21:54 -070076
77# The elf writer test has dependencies on core.oat.
Andreas Gampec23c9c92014-10-28 14:47:25 -070078ART_GTEST_elf_writer_test_HOST_DEPS := $(HOST_CORE_IMAGE_default_no-pic_64) $(HOST_CORE_IMAGE_default_no-pic_32)
79ART_GTEST_elf_writer_test_TARGET_DEPS := $(TARGET_CORE_IMAGE_default_no-pic_64) $(TARGET_CORE_IMAGE_default_no-pic_32)
Brian Carlstrom53463ea2014-11-09 14:11:51 -080080
Richard Uhler9a44f872015-03-12 12:35:43 -070081ART_GTEST_oat_file_assistant_test_HOST_DEPS := \
82 $(HOST_CORE_IMAGE_default_no-pic_64) \
83 $(HOST_CORE_IMAGE_default_no-pic_32) \
84 $(HOST_OUT_EXECUTABLES)/patchoatd
85ART_GTEST_oat_file_assistant_test_TARGET_DEPS := \
86 $(TARGET_CORE_IMAGE_default_no-pic_64) \
87 $(TARGET_CORE_IMAGE_default_no-pic_32) \
88 $(TARGET_OUT_EXECUTABLES)/patchoatd
Richard Uhler66d874d2015-01-15 09:37:19 -080089
Brian Carlstrom53463ea2014-11-09 14:11:51 -080090# TODO: document why this is needed.
Andreas Gampec23c9c92014-10-28 14:47:25 -070091ART_GTEST_proxy_test_HOST_DEPS := $(HOST_CORE_IMAGE_default_no-pic_64) $(HOST_CORE_IMAGE_default_no-pic_32)
Ian Rogersafd9acc2014-06-17 08:21:54 -070092
Igor Murashkin37743352014-11-13 14:38:00 -080093# The imgdiag test has dependencies on core.oat since it needs to load it during the test.
Andreas Gampec93b8b52014-12-19 23:12:25 -080094# For the host, also add the installed tool (in the base size, that should suffice). For the
95# target, just the module is fine, the sync will happen late enough.
96ART_GTEST_imgdiag_test_HOST_DEPS := \
97 $(HOST_CORE_IMAGE_default_no-pic_64) \
98 $(HOST_CORE_IMAGE_default_no-pic_32) \
99 $(HOST_OUT_EXECUTABLES)/imgdiagd
100ART_GTEST_imgdiag_test_TARGET_DEPS := \
101 $(TARGET_CORE_IMAGE_default_no-pic_64) \
102 $(TARGET_CORE_IMAGE_default_no-pic_32) \
103 imgdiagd
Igor Murashkin37743352014-11-13 14:38:00 -0800104
Ian Rogersafd9acc2014-06-17 08:21:54 -0700105# The path for which all the source files are relative, not actually the current directory.
Brian Carlstrom7940e442013-07-12 13:46:57 -0700106LOCAL_PATH := art
107
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800108RUNTIME_GTEST_COMMON_SRC_FILES := \
Igor Murashkinaaebaa02015-01-26 10:55:53 -0800109 cmdline/cmdline_parser_test.cc \
Igor Murashkin37743352014-11-13 14:38:00 -0800110 imgdiag/imgdiag_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700111 runtime/arch/arch_test.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800112 runtime/arch/instruction_set_test.cc \
113 runtime/arch/instruction_set_features_test.cc \
Serban Constantinescu86797a72014-06-19 16:17:56 +0100114 runtime/arch/memcmp16_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700115 runtime/arch/stub_test.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800116 runtime/arch/arm/instruction_set_features_arm_test.cc \
117 runtime/arch/arm64/instruction_set_features_arm64_test.cc \
118 runtime/arch/mips/instruction_set_features_mips_test.cc \
Andreas Gampe57b34292015-01-14 15:45:59 -0800119 runtime/arch/mips64/instruction_set_features_mips64_test.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800120 runtime/arch/x86/instruction_set_features_x86_test.cc \
121 runtime/arch/x86_64/instruction_set_features_x86_64_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700122 runtime/barrier_test.cc \
123 runtime/base/bit_field_test.cc \
124 runtime/base/bit_vector_test.cc \
Mathieu Chartierc2e20622014-11-03 11:41:47 -0800125 runtime/base/hash_set_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700126 runtime/base/hex_dump_test.cc \
127 runtime/base/histogram_test.cc \
128 runtime/base/mutex_test.cc \
129 runtime/base/scoped_flock_test.cc \
Brian Carlstrom2cbaccb2014-09-14 20:34:17 -0700130 runtime/base/stringprintf_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700131 runtime/base/timing_logger_test.cc \
Igor Murashkinaaebaa02015-01-26 10:55:53 -0800132 runtime/base/variant_map_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700133 runtime/base/unix_file/fd_file_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700134 runtime/class_linker_test.cc \
135 runtime/dex_file_test.cc \
136 runtime/dex_file_verifier_test.cc \
137 runtime/dex_instruction_visitor_test.cc \
138 runtime/dex_method_iterator_test.cc \
139 runtime/entrypoints/math_entrypoints_test.cc \
140 runtime/entrypoints/quick/quick_trampoline_entrypoints_test.cc \
141 runtime/entrypoints_order_test.cc \
142 runtime/exception_test.cc \
Mathieu Chartier2c265012014-08-05 18:15:56 -0700143 runtime/gc/accounting/card_table_test.cc \
Mathieu Chartier4858a932015-01-23 13:18:53 -0800144 runtime/gc/accounting/mod_union_table_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700145 runtime/gc/accounting/space_bitmap_test.cc \
146 runtime/gc/heap_test.cc \
Mathieu Chartier9e2094f2014-12-11 18:43:48 -0800147 runtime/gc/reference_queue_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700148 runtime/gc/space/dlmalloc_space_base_test.cc \
149 runtime/gc/space/dlmalloc_space_static_test.cc \
150 runtime/gc/space/dlmalloc_space_random_test.cc \
151 runtime/gc/space/rosalloc_space_base_test.cc \
152 runtime/gc/space/rosalloc_space_static_test.cc \
153 runtime/gc/space/rosalloc_space_random_test.cc \
154 runtime/gc/space/large_object_space_test.cc \
Mathieu Chartiera5eae692014-12-17 17:56:03 -0800155 runtime/gc/task_processor_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700156 runtime/gtest_test.cc \
157 runtime/handle_scope_test.cc \
158 runtime/indenter_test.cc \
159 runtime/indirect_reference_table_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700160 runtime/intern_table_test.cc \
Ian Rogers5ac814a2014-11-04 16:39:32 -0800161 runtime/interpreter/safe_math_test.cc \
Ian Rogersf4d4da12014-11-11 16:10:33 -0800162 runtime/java_vm_ext_test.cc \
Mathieu Chartierbce416f2015-03-23 12:37:35 -0700163 runtime/jit/jit_code_cache_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700164 runtime/leb128_test.cc \
165 runtime/mem_map_test.cc \
Roland Levillaina2d8ec62015-03-12 15:25:29 +0000166 runtime/memory_region_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700167 runtime/mirror/dex_cache_test.cc \
168 runtime/mirror/object_test.cc \
Andreas Gampe74240812014-04-17 10:35:09 -0700169 runtime/monitor_pool_test.cc \
Elena Sayapina1af6a1f2014-06-20 16:58:37 +0700170 runtime/monitor_test.cc \
Richard Uhlere5fed032015-03-18 08:21:11 -0700171 runtime/oat_file_test.cc \
Richard Uhler66d874d2015-01-15 09:37:19 -0800172 runtime/oat_file_assistant_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700173 runtime/parsed_options_test.cc \
David Srbecky3e52aa42015-04-12 07:45:18 +0100174 runtime/prebuilt_tools_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700175 runtime/reference_table_test.cc \
176 runtime/thread_pool_test.cc \
177 runtime/transaction_test.cc \
Narayan Kamatha5afcfc2015-01-29 20:06:46 +0000178 runtime/utf_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700179 runtime/utils_test.cc \
180 runtime/verifier/method_verifier_test.cc \
181 runtime/verifier/reg_type_test.cc \
182 runtime/zip_archive_test.cc
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800183
184COMPILER_GTEST_COMMON_SRC_FILES := \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700185 runtime/jni_internal_test.cc \
Jeff Haodb8a6642014-08-14 17:18:52 -0700186 runtime/proxy_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700187 runtime/reflection_test.cc \
Vladimir Marko7a01dc22015-01-02 17:00:44 +0000188 compiler/dex/gvn_dead_code_elimination_test.cc \
Vladimir Marko95a05972014-05-30 10:01:32 +0100189 compiler/dex/global_value_numbering_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700190 compiler/dex/local_value_numbering_test.cc \
Vladimir Marko55fff042014-07-10 12:42:52 +0100191 compiler/dex/mir_graph_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700192 compiler/dex/mir_optimization_test.cc \
David Srbecky1109fb32015-04-07 20:21:06 +0100193 compiler/dex/quick/quick_cfi_test.cc \
Vladimir Markoc91df2d2015-04-23 09:29:21 +0000194 compiler/dex/type_inference_test.cc \
David Srbecky15c19752015-03-31 14:53:55 +0000195 compiler/dwarf/dwarf_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700196 compiler/driver/compiler_driver_test.cc \
197 compiler/elf_writer_test.cc \
198 compiler/image_test.cc \
David Srbeckydd973932015-04-07 20:29:48 +0100199 compiler/jni/jni_cfi_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700200 compiler/jni/jni_compiler_test.cc \
Vladimir Marko3f311cf2015-04-02 15:28:45 +0100201 compiler/linker/arm64/relative_patcher_arm64_test.cc \
Vladimir Marko4d23c9d2015-04-01 23:03:09 +0100202 compiler/linker/arm/relative_patcher_thumb2_test.cc \
Vladimir Markob163bb72015-03-31 21:49:49 +0100203 compiler/linker/x86/relative_patcher_x86_test.cc \
204 compiler/linker/x86_64/relative_patcher_x86_64_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700205 compiler/oat_test.cc \
Mingyao Yangf384f882014-10-22 16:08:18 -0700206 compiler/optimizing/bounds_check_elimination_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700207 compiler/optimizing/codegen_test.cc \
Roland Levillain72bceff2014-09-15 18:29:00 +0100208 compiler/optimizing/dead_code_elimination_test.cc \
Roland Levillain75be2832014-10-17 17:02:00 +0100209 compiler/optimizing/constant_folding_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700210 compiler/optimizing/dominator_test.cc \
211 compiler/optimizing/find_loops_test.cc \
Roland Levillainccc07a92014-09-16 14:48:16 +0100212 compiler/optimizing/graph_checker_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700213 compiler/optimizing/graph_test.cc \
Nicolas Geoffrayd31cf3d2014-09-08 17:30:24 +0100214 compiler/optimizing/gvn_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700215 compiler/optimizing/linearize_test.cc \
216 compiler/optimizing/liveness_test.cc \
217 compiler/optimizing/live_interval_test.cc \
218 compiler/optimizing/live_ranges_test.cc \
Nicolas Geoffray724c9632014-09-22 12:27:27 +0100219 compiler/optimizing/nodes_test.cc \
David Srbeckyc6b4dd82015-04-07 20:32:43 +0100220 compiler/optimizing/optimizing_cfi_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700221 compiler/optimizing/parallel_move_test.cc \
222 compiler/optimizing/pretty_printer_test.cc \
223 compiler/optimizing/register_allocator_test.cc \
224 compiler/optimizing/ssa_test.cc \
Nicolas Geoffray99ea58c2014-07-02 15:08:17 +0100225 compiler/optimizing/stack_map_test.cc \
Nicolas Geoffrayfbc695f2014-09-15 15:33:30 +0000226 compiler/optimizing/suspend_check_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700227 compiler/output_stream_test.cc \
228 compiler/utils/arena_allocator_test.cc \
229 compiler/utils/dedupe_set_test.cc \
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800230 compiler/utils/swap_space_test.cc \
Vladimir Markoc91df2d2015-04-23 09:29:21 +0000231 compiler/utils/test_dex_file_builder_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700232 compiler/utils/arm/managed_register_arm_test.cc \
233 compiler/utils/arm64/managed_register_arm64_test.cc \
234 compiler/utils/x86/managed_register_x86_test.cc \
Brian Carlstrom51c24672013-07-11 16:00:56 -0700235
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800236RUNTIME_GTEST_TARGET_SRC_FILES := \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700237 $(RUNTIME_GTEST_COMMON_SRC_FILES)
Brian Carlstrom51c24672013-07-11 16:00:56 -0700238
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800239RUNTIME_GTEST_HOST_SRC_FILES := \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700240 $(RUNTIME_GTEST_COMMON_SRC_FILES)
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800241
242COMPILER_GTEST_TARGET_SRC_FILES := \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700243 $(COMPILER_GTEST_COMMON_SRC_FILES)
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800244
245COMPILER_GTEST_HOST_SRC_FILES := \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700246 $(COMPILER_GTEST_COMMON_SRC_FILES) \
Roland Levillain1a28fc42014-11-13 18:03:06 +0000247 compiler/utils/arm/assembler_arm32_test.cc \
248 compiler/utils/arm/assembler_thumb2_test.cc \
249 compiler/utils/assembler_thumb_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700250 compiler/utils/x86/assembler_x86_test.cc \
251 compiler/utils/x86_64/assembler_x86_64_test.cc
Brian Carlstrom8ecd08c2011-07-27 17:50:51 -0700252
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800253ART_TEST_CFLAGS :=
buzbee2cfc6392012-05-07 14:51:40 -0700254
Ian Rogerse63db272014-07-15 15:36:11 -0700255include $(CLEAR_VARS)
256LOCAL_MODULE := libart-gtest
257LOCAL_MODULE_TAGS := optional
258LOCAL_CPP_EXTENSION := cc
Ian Rogerse63db272014-07-15 15:36:11 -0700259LOCAL_SRC_FILES := runtime/common_runtime_test.cc compiler/common_compiler_test.cc
260LOCAL_C_INCLUDES := $(ART_C_INCLUDES) art/runtime art/compiler
Ian Rogers872dd822014-10-30 11:19:14 -0700261LOCAL_SHARED_LIBRARIES := libartd libartd-compiler libdl
Dan Albertfd84f662014-11-11 18:53:41 -0800262LOCAL_STATIC_LIBRARIES += libgtest
Ian Rogerse63db272014-07-15 15:36:11 -0700263LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
264LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk
Andreas Gampebced67d2015-01-07 14:35:44 -0800265$(eval $(call set-target-local-clang-vars))
266$(eval $(call set-target-local-cflags-vars,debug))
Andreas Gampe9b14dc32015-04-06 15:35:02 -0700267LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
Ian Rogerse63db272014-07-15 15:36:11 -0700268include $(BUILD_SHARED_LIBRARY)
269
270include $(CLEAR_VARS)
271LOCAL_MODULE := libart-gtest
272LOCAL_MODULE_TAGS := optional
273LOCAL_CPP_EXTENSION := cc
274LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
275LOCAL_SRC_FILES := runtime/common_runtime_test.cc compiler/common_compiler_test.cc
276LOCAL_C_INCLUDES := $(ART_C_INCLUDES) art/runtime art/compiler
277LOCAL_SHARED_LIBRARIES := libartd libartd-compiler
Nicolas Geoffray10fc34b2014-11-10 21:38:15 +0000278LOCAL_STATIC_LIBRARIES := libgtest_host
Ian Rogerse63db272014-07-15 15:36:11 -0700279LOCAL_LDLIBS += -ldl -lpthread
280LOCAL_MULTILIB := both
281LOCAL_CLANG := $(ART_HOST_CLANG)
Andreas Gampe9b14dc32015-04-06 15:35:02 -0700282LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
Ian Rogerse63db272014-07-15 15:36:11 -0700283LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
284LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk
Ian Rogerse63db272014-07-15 15:36:11 -0700285include $(BUILD_HOST_SHARED_LIBRARY)
286
Ian Rogersafd9acc2014-06-17 08:21:54 -0700287# Variables holding collections of gtest pre-requisits used to run a number of gtests.
288ART_TEST_HOST_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
289ART_TEST_HOST_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
290ART_TEST_HOST_GTEST_RULES :=
291ART_TEST_HOST_VALGRIND_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
292ART_TEST_HOST_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
293ART_TEST_HOST_VALGRIND_GTEST_RULES :=
294ART_TEST_TARGET_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
295ART_TEST_TARGET_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
296ART_TEST_TARGET_GTEST_RULES :=
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700297
Nicolas Geoffray96a37c82014-10-29 23:50:40 +0000298ART_GTEST_TARGET_ANDROID_ROOT := '/system'
299ifneq ($(ART_TEST_ANDROID_ROOT),)
300 ART_GTEST_TARGET_ANDROID_ROOT := $(ART_TEST_ANDROID_ROOT)
301endif
302
Ian Rogersafd9acc2014-06-17 08:21:54 -0700303# Define a make rule for a target device gtest.
304# $(1): gtest name - the name of the test we're building such as leb128_test.
305# $(2): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000306# $(3): LD_LIBRARY_PATH or undefined - used in case libartd.so is not in /system/lib/
Ian Rogersafd9acc2014-06-17 08:21:54 -0700307define define-art-gtest-rule-target
308 gtest_rule := test-art-target-gtest-$(1)$$($(2)ART_PHONY_TEST_TARGET_SUFFIX)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700309
Brian Carlstrom532714a2014-06-25 02:15:31 -0700310 # Add the test dependencies to test-art-target-sync, which will be a prerequisite for the test
Ian Rogersafd9acc2014-06-17 08:21:54 -0700311 # to ensure files are pushed to the device.
312 TEST_ART_TARGET_SYNC_DEPS += \
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700313 $$(ART_GTEST_$(1)_TARGET_DEPS) \
Ian Rogers1a2f84e2014-07-07 16:05:18 -0700314 $(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_TARGET_GTEST_$(file)_DEX)) \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700315 $$(ART_TARGET_NATIVETEST_OUT)/$$(TARGET_$(2)ARCH)/$(1) \
Nicolas Geoffray96a63452014-10-30 12:13:17 +0000316 $$($(2)TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so \
317 $$(TARGET_OUT_JAVA_LIBRARIES)/core-libart.jar
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700318
Ian Rogersafd9acc2014-06-17 08:21:54 -0700319.PHONY: $$(gtest_rule)
320$$(gtest_rule): test-art-target-sync
321 $(hide) adb shell touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID
322 $(hide) adb shell rm $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID
323 $(hide) adb shell chmod 755 $(ART_TARGET_NATIVETEST_DIR)/$(TARGET_$(2)ARCH)/$(1)
324 $(hide) $$(call ART_TEST_SKIP,$$@) && \
Dan Albert31fb2602014-09-30 22:10:10 -0700325 (adb shell "$(GCOV_ENV) LD_LIBRARY_PATH=$(3) ANDROID_ROOT=$(ART_GTEST_TARGET_ANDROID_ROOT) \
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000326 $(ART_TARGET_NATIVETEST_DIR)/$(TARGET_$(2)ARCH)/$(1) && touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID" \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700327 && (adb pull $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID /tmp/ \
328 && $$(call ART_TEST_PASSED,$$@)) \
329 || $$(call ART_TEST_FAILED,$$@))
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700330 $(hide) rm -f /tmp/$$@-$$$$PPID
Ian Rogersafd9acc2014-06-17 08:21:54 -0700331
332 ART_TEST_TARGET_GTEST$($(2)ART_PHONY_TEST_TARGET_SUFFIX)_RULES += $$(gtest_rule)
333 ART_TEST_TARGET_GTEST_RULES += $$(gtest_rule)
334 ART_TEST_TARGET_GTEST_$(1)_RULES += $$(gtest_rule)
335
336 # Clear locally defined variables.
337 gtest_rule :=
338endef # define-art-gtest-rule-target
339
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800340ART_VALGRIND_DEPENDENCIES := \
341 $(HOST_OUT_EXECUTABLES)/valgrind \
342 $(HOST_OUT)/lib64/valgrind/memcheck-amd64-linux \
343 $(HOST_OUT)/lib64/valgrind/memcheck-x86-linux \
344 $(HOST_OUT)/lib64/valgrind/default.supp \
345 $(HOST_OUT)/lib64/valgrind/vgpreload_core-amd64-linux.so \
346 $(HOST_OUT)/lib64/valgrind/vgpreload_core-x86-linux.so \
347 $(HOST_OUT)/lib64/valgrind/vgpreload_memcheck-amd64-linux.so \
348 $(HOST_OUT)/lib64/valgrind/vgpreload_memcheck-x86-linux.so
349
Ian Rogersafd9acc2014-06-17 08:21:54 -0700350# Define make rules for a host gtests.
351# $(1): gtest name - the name of the test we're building such as leb128_test.
352# $(2): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
353define define-art-gtest-rule-host
354 gtest_rule := test-art-host-gtest-$(1)$$($(2)ART_PHONY_TEST_HOST_SUFFIX)
355 gtest_exe := $$(HOST_OUT_EXECUTABLES)/$(1)$$($(2)ART_PHONY_TEST_HOST_SUFFIX)
Ian Rogers665de8a2014-06-24 21:34:09 -0700356 # Dependencies for all host gtests.
357 gtest_deps := $$(HOST_CORE_DEX_LOCATIONS) \
Nicolas Geoffray4d1231d2014-07-01 10:46:31 +0100358 $$($(2)ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$$(ART_HOST_SHLIB_EXTENSION)
Ian Rogers665de8a2014-06-24 21:34:09 -0700359
Ian Rogersafd9acc2014-06-17 08:21:54 -0700360
361.PHONY: $$(gtest_rule)
Ian Rogers1a2f84e2014-07-07 16:05:18 -0700362$$(gtest_rule): $$(gtest_exe) $$(ART_GTEST_$(1)_HOST_DEPS) $(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_HOST_GTEST_$(file)_DEX)) $$(gtest_deps)
Dmitriy Ivanov8508a432014-10-14 11:38:46 -0700363 $(hide) ($$(call ART_TEST_SKIP,$$@) && $$< && $$(call ART_TEST_PASSED,$$@)) \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700364 || $$(call ART_TEST_FAILED,$$@)
365
366 ART_TEST_HOST_GTEST$$($(2)ART_PHONY_TEST_HOST_SUFFIX)_RULES += $$(gtest_rule)
367 ART_TEST_HOST_GTEST_RULES += $$(gtest_rule)
368 ART_TEST_HOST_GTEST_$(1)_RULES += $$(gtest_rule)
369
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800370
Ian Rogersafd9acc2014-06-17 08:21:54 -0700371.PHONY: valgrind-$$(gtest_rule)
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800372valgrind-$$(gtest_rule): $$(gtest_exe) $$(ART_GTEST_$(1)_HOST_DEPS) $(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_HOST_GTEST_$(file)_DEX)) $$(gtest_deps) $(ART_VALGRIND_DEPENDENCIES)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700373 $(hide) $$(call ART_TEST_SKIP,$$@) && \
Andreas Gampe8df91ac2015-02-20 13:15:15 -0800374 VALGRIND_LIB=$(HOST_OUT)/lib64/valgrind \
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800375 $(HOST_OUT_EXECUTABLES)/valgrind --leak-check=full --error-exitcode=1 $$< && \
376 $$(call ART_TEST_PASSED,$$@) || $$(call ART_TEST_FAILED,$$@)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700377
378 ART_TEST_HOST_VALGRIND_GTEST$$($(2)ART_PHONY_TEST_HOST_SUFFIX)_RULES += valgrind-$$(gtest_rule)
379 ART_TEST_HOST_VALGRIND_GTEST_RULES += valgrind-$$(gtest_rule)
380 ART_TEST_HOST_VALGRIND_GTEST_$(1)_RULES += valgrind-$$(gtest_rule)
381
382 # Clear locally defined variables.
383 valgrind_gtest_rule :=
384 gtest_rule :=
385 gtest_exe :=
Ian Rogers665de8a2014-06-24 21:34:09 -0700386 gtest_deps :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700387endef # define-art-gtest-rule-host
388
389# Define the rules to build and run host and target gtests.
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700390# $(1): target or host
Brian Carlstrom0796af02011-10-12 14:31:45 -0700391# $(2): file name
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800392# $(3): extra C includes
393# $(4): extra shared libraries
Ian Rogersafd9acc2014-06-17 08:21:54 -0700394define define-art-gtest
Brian Carlstrom0796af02011-10-12 14:31:45 -0700395 ifneq ($(1),target)
396 ifneq ($(1),host)
397 $$(error expected target or host for argument 1, received $(1))
398 endif
399 endif
400
401 art_target_or_host := $(1)
402 art_gtest_filename := $(2)
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800403 art_gtest_extra_c_includes := $(3)
404 art_gtest_extra_shared_libraries := $(4)
Brian Carlstrom0796af02011-10-12 14:31:45 -0700405
Ian Rogersafd9acc2014-06-17 08:21:54 -0700406 include $$(CLEAR_VARS)
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700407 art_gtest_name := $$(notdir $$(basename $$(art_gtest_filename)))
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700408 LOCAL_MODULE := $$(art_gtest_name)
Brian Carlstrom871599a2012-09-06 13:27:49 -0700409 ifeq ($$(art_target_or_host),target)
410 LOCAL_MODULE_TAGS := tests
411 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700412 LOCAL_CPP_EXTENSION := $$(ART_CPP_EXTENSION)
Dmitriy Ivanove49a4f62014-10-20 14:11:00 -0700413 LOCAL_SRC_FILES := $$(art_gtest_filename)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700414 LOCAL_C_INCLUDES += $$(ART_C_INCLUDES) art/runtime $$(art_gtest_extra_c_includes)
David Srbecky1109fb32015-04-07 20:21:06 +0100415 LOCAL_SHARED_LIBRARIES += libartd $$(art_gtest_extra_shared_libraries) libart-gtest libart-disassembler
Dmitriy Ivanove49a4f62014-10-20 14:11:00 -0700416 LOCAL_WHOLE_STATIC_LIBRARIES += libsigchain
Brian Carlstrom4478eb02013-07-14 21:05:57 -0700417
Ian Rogerse63db272014-07-15 15:36:11 -0700418 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
419 LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk
Brian Carlstromb9cc1ca2012-01-27 00:57:42 -0800420
Elliott Hughes0f096762012-01-31 10:32:46 -0800421 # Mac OS linker doesn't understand --export-dynamic.
Ian Rogersafd9acc2014-06-17 08:21:54 -0700422 ifneq ($$(HOST_OS)-$$(art_target_or_host),darwin-host)
Elliott Hughesb264f082012-04-06 17:10:10 -0700423 # Allow jni_compiler_test to find Java_MyClassNatives_bar within itself using dlopen(NULL, ...).
424 LOCAL_LDFLAGS := -Wl,--export-dynamic -Wl,-u,Java_MyClassNatives_bar -Wl,-u,Java_MyClassNatives_sbar
Brian Carlstromcfede662012-01-29 17:25:54 -0800425 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -0700426
Ian Rogersafd9acc2014-06-17 08:21:54 -0700427 LOCAL_CFLAGS := $$(ART_TEST_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -0700428 ifeq ($$(art_target_or_host),target)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700429 $$(eval $$(call set-target-local-clang-vars))
430 $$(eval $$(call set-target-local-cflags-vars,debug))
Serban Constantinescu32f5b4d2014-11-25 20:05:46 +0000431 LOCAL_SHARED_LIBRARIES += libdl libicuuc libicui18n libnativehelper libz libcutils libvixld
Ian Rogersafd9acc2014-06-17 08:21:54 -0700432 LOCAL_MODULE_PATH_32 := $$(ART_TARGET_NATIVETEST_OUT)/$$(ART_TARGET_ARCH_32)
433 LOCAL_MODULE_PATH_64 := $$(ART_TARGET_NATIVETEST_OUT)/$$(ART_TARGET_ARCH_64)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700434 LOCAL_MULTILIB := both
Andreas Gampe9b14dc32015-04-06 15:35:02 -0700435 LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
Ian Rogersafd9acc2014-06-17 08:21:54 -0700436 include $$(BUILD_EXECUTABLE)
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000437 library_path :=
438 2nd_library_path :=
439 ifneq ($$(ART_TEST_ANDROID_ROOT),)
440 ifdef TARGET_2ND_ARCH
441 2nd_library_path := $$(ART_TEST_ANDROID_ROOT)/lib
442 library_path := $$(ART_TEST_ANDROID_ROOT)/lib64
443 else
Nicolas Geoffrayc1dea4a2014-11-10 08:33:52 +0000444 ifneq ($(filter %64,$(TARGET_ARCH)),)
445 library_path := $$(ART_TEST_ANDROID_ROOT)/lib64
446 else
447 library_path := $$(ART_TEST_ANDROID_ROOT)/lib
448 endif
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000449 endif
450 endif
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700451
Ian Rogersafd9acc2014-06-17 08:21:54 -0700452 ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES :=
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700453 ifdef TARGET_2ND_ARCH
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000454 $$(eval $$(call define-art-gtest-rule-target,$$(art_gtest_name),2ND_,$$(2nd_library_path)))
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700455 endif
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000456 $$(eval $$(call define-art-gtest-rule-target,$$(art_gtest_name),,$$(library_path)))
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700457
Ian Rogersafd9acc2014-06-17 08:21:54 -0700458 # A rule to run the different architecture versions of the gtest.
459.PHONY: test-art-target-gtest-$$(art_gtest_name)
460test-art-target-gtest-$$(art_gtest_name): $$(ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES)
461 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
462
463 # Clear locally defined variables.
464 ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES :=
Brian Carlstrom0796af02011-10-12 14:31:45 -0700465 else # host
Ian Rogersafd9acc2014-06-17 08:21:54 -0700466 LOCAL_CLANG := $$(ART_HOST_CLANG)
467 LOCAL_CFLAGS += $$(ART_HOST_CFLAGS) $$(ART_HOST_DEBUG_CFLAGS)
Serban Constantinescu32f5b4d2014-11-25 20:05:46 +0000468 LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host libnativehelper libziparchive-host libz-host libvixld
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700469 LOCAL_LDLIBS := $(ART_HOST_LDLIBS) -lpthread -ldl
Ian Rogersbd5ea6a2014-04-16 16:34:44 -0700470 LOCAL_IS_HOST_MODULE := true
Ian Rogersafd9acc2014-06-17 08:21:54 -0700471 LOCAL_MULTILIB := both
472 LOCAL_MODULE_STEM_32 := $$(art_gtest_name)32
473 LOCAL_MODULE_STEM_64 := $$(art_gtest_name)64
Andreas Gampe9b14dc32015-04-06 15:35:02 -0700474 LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
Ian Rogersafd9acc2014-06-17 08:21:54 -0700475 include $$(BUILD_HOST_EXECUTABLE)
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700476
Ian Rogersafd9acc2014-06-17 08:21:54 -0700477 ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES :=
478 ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
479 ifneq ($$(HOST_PREFER_32_BIT),true)
480 $$(eval $$(call define-art-gtest-rule-host,$$(art_gtest_name),2ND_))
481 endif
482 $$(eval $$(call define-art-gtest-rule-host,$$(art_gtest_name),))
Ian Rogersd912e5c2013-11-13 12:40:11 -0800483
Ian Rogersafd9acc2014-06-17 08:21:54 -0700484 # Rules to run the different architecture versions of the gtest.
485.PHONY: test-art-host-gtest-$$(art_gtest_name)
486test-art-host-gtest-$$(art_gtest_name): $$(ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES)
487 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
Ian Rogersd912e5c2013-11-13 12:40:11 -0800488
Ian Rogersafd9acc2014-06-17 08:21:54 -0700489.PHONY: valgrind-test-art-host-gtest-$$(art_gtest_name)
490valgrind-test-art-host-gtest-$$(art_gtest_name): $$(ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES)
491 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
492
493 # Clear locally defined variables.
494 ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES :=
495 ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
496 endif # host_or_target
497
498 # Clear locally defined variables.
499 art_target_or_host :=
500 art_gtest_filename :=
501 art_gtest_extra_c_includes :=
502 art_gtest_extra_shared_libraries :=
503 art_gtest_name :=
Nicolas Geoffray96a37c82014-10-29 23:50:40 +0000504 library_path :=
505 2nd_library_path :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700506endef # define-art-gtest
Carl Shapiro008e4122011-06-23 17:27:46 -0700507
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700508ifeq ($(ART_BUILD_TARGET),true)
Richard Uhler66d874d2015-01-15 09:37:19 -0800509 $(foreach file,$(RUNTIME_GTEST_TARGET_SRC_FILES), $(eval $(call define-art-gtest,target,$(file),,libbacktrace)))
510 $(foreach file,$(COMPILER_GTEST_TARGET_SRC_FILES), $(eval $(call define-art-gtest,target,$(file),art/compiler,libartd-compiler libbacktrace)))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700511endif
Ian Rogersc5f17732014-06-05 20:48:42 -0700512ifeq ($(ART_BUILD_HOST),true)
Richard Uhler66d874d2015-01-15 09:37:19 -0800513 $(foreach file,$(RUNTIME_GTEST_HOST_SRC_FILES), $(eval $(call define-art-gtest,host,$(file),,libbacktrace)))
514 $(foreach file,$(COMPILER_GTEST_HOST_SRC_FILES), $(eval $(call define-art-gtest,host,$(file),art/compiler,libartd-compiler libbacktrace)))
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700515endif
Tsu Chiang Chuangec245a42014-05-15 21:16:21 -0700516
517# Used outside the art project to get a list of the current tests
518RUNTIME_TARGET_GTEST_MAKE_TARGETS :=
519$(foreach file, $(RUNTIME_GTEST_TARGET_SRC_FILES), $(eval RUNTIME_TARGET_GTEST_MAKE_TARGETS += $$(notdir $$(basename $$(file)))))
520COMPILER_TARGET_GTEST_MAKE_TARGETS :=
521$(foreach file, $(COMPILER_GTEST_TARGET_SRC_FILES), $(eval COMPILER_TARGET_GTEST_MAKE_TARGETS += $$(notdir $$(basename $$(file)))))
Ian Rogersafd9acc2014-06-17 08:21:54 -0700522
523# Define all the combinations of host/target, valgrind and suffix such as:
524# test-art-host-gtest or valgrind-test-art-host-gtest64
525# $(1): host or target
526# $(2): HOST or TARGET
527# $(3): valgrind- or undefined
528# $(4): undefined, 32 or 64
529define define-test-art-gtest-combination
530 ifeq ($(1),host)
531 ifneq ($(2),HOST)
532 $$(error argument mismatch $(1) and ($2))
533 endif
534 else
535 ifneq ($(1),target)
536 $$(error found $(1) expected host or target)
537 endif
538 ifneq ($(2),TARGET)
539 $$(error argument mismatch $(1) and ($2))
540 endif
541 endif
542
543 rule_name := $(3)test-art-$(1)-gtest$(4)
Andreas Gampe928f72b2014-09-09 19:53:48 -0700544 ifeq ($(3),valgrind-)
545 ifneq ($(1),host)
546 $$(error valgrind tests only wired up for the host)
547 endif
548 dependencies := $$(ART_TEST_$(2)_VALGRIND_GTEST$(4)_RULES)
549 else
550 dependencies := $$(ART_TEST_$(2)_GTEST$(4)_RULES)
551 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700552
553.PHONY: $$(rule_name)
554$$(rule_name): $$(dependencies)
555 $(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
556
557 # Clear locally defined variables.
558 rule_name :=
559 dependencies :=
560endef # define-test-art-gtest-combination
561
562$(eval $(call define-test-art-gtest-combination,target,TARGET,,))
563$(eval $(call define-test-art-gtest-combination,target,TARGET,,$(ART_PHONY_TEST_TARGET_SUFFIX)))
564ifdef TARGET_2ND_ARCH
565$(eval $(call define-test-art-gtest-combination,target,TARGET,,$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)))
566endif
567$(eval $(call define-test-art-gtest-combination,host,HOST,,))
568$(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,))
569$(eval $(call define-test-art-gtest-combination,host,HOST,,$(ART_PHONY_TEST_HOST_SUFFIX)))
570$(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,$(ART_PHONY_TEST_HOST_SUFFIX)))
571ifneq ($(HOST_PREFER_32_BIT),true)
572$(eval $(call define-test-art-gtest-combination,host,HOST,,$(2ND_ART_PHONY_TEST_HOST_SUFFIX)))
573$(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,$(2ND_ART_PHONY_TEST_HOST_SUFFIX)))
574endif
575
576# Clear locally defined variables.
577define-art-gtest-rule-target :=
578define-art-gtest-rule-host :=
579define-art-gtest :=
580define-test-art-gtest-combination :=
581RUNTIME_GTEST_COMMON_SRC_FILES :=
582COMPILER_GTEST_COMMON_SRC_FILES :=
583RUNTIME_GTEST_TARGET_SRC_FILES :=
584RUNTIME_GTEST_HOST_SRC_FILES :=
585COMPILER_GTEST_TARGET_SRC_FILES :=
586COMPILER_GTEST_HOST_SRC_FILES :=
587ART_TEST_CFLAGS :=
588ART_TEST_HOST_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
589ART_TEST_HOST_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
590ART_TEST_HOST_GTEST_RULES :=
591ART_TEST_HOST_VALGRIND_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
592ART_TEST_HOST_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
593ART_TEST_HOST_VALGRIND_GTEST_RULES :=
594ART_TEST_TARGET_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
595ART_TEST_TARGET_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
596ART_TEST_TARGET_GTEST_RULES :=
Nicolas Geoffray96a37c82014-10-29 23:50:40 +0000597ART_GTEST_TARGET_ANDROID_ROOT :=
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700598ART_GTEST_class_linker_test_DEX_DEPS :=
599ART_GTEST_compiler_driver_test_DEX_DEPS :=
600ART_GTEST_dex_file_test_DEX_DEPS :=
601ART_GTEST_exception_test_DEX_DEPS :=
602ART_GTEST_elf_writer_test_HOST_DEPS :=
603ART_GTEST_elf_writer_test_TARGET_DEPS :=
604ART_GTEST_jni_compiler_test_DEX_DEPS :=
605ART_GTEST_jni_internal_test_DEX_DEPS :=
Richard Uhler66d874d2015-01-15 09:37:19 -0800606ART_GTEST_oat_file_assistant_test_DEX_DEPS :=
607ART_GTEST_oat_file_assistant_test_HOST_DEPS :=
608ART_GTEST_oat_file_assistant_test_TARGET_DEPS :=
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700609ART_GTEST_object_test_DEX_DEPS :=
610ART_GTEST_proxy_test_DEX_DEPS :=
611ART_GTEST_reflection_test_DEX_DEPS :=
612ART_GTEST_stub_test_DEX_DEPS :=
613ART_GTEST_transaction_test_DEX_DEPS :=
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800614ART_VALGRIND_DEPENDENCIES :=
Ian Rogers1a2f84e2014-07-07 16:05:18 -0700615$(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval ART_TEST_TARGET_GTEST_$(dir)_DEX :=))
616$(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval ART_TEST_HOST_GTEST_$(dir)_DEX :=))
Richard Uhler66d874d2015-01-15 09:37:19 -0800617ART_TEST_HOST_GTEST_MainStripped_DEX :=
618ART_TEST_TARGET_GTEST_MainStripped_DEX :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700619GTEST_DEX_DIRECTORIES :=
Brian Carlstrom532714a2014-06-25 02:15:31 -0700620LOCAL_PATH :=