blob: 4850e6c44ebc995ae777edc8535637398d16423e [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 \
Sebastien Hertz0462c4c2015-04-01 16:34:17 +020029 Instrumentation \
Ian Rogersafd9acc2014-06-17 08:21:54 -070030 Interfaces \
31 Main \
Richard Uhler66d874d2015-01-15 09:37:19 -080032 MultiDex \
Richard Uhler67ff7d12015-05-14 13:21:13 -070033 MultiDexModifiedSecondary \
Ian Rogersafd9acc2014-06-17 08:21:54 -070034 MyClass \
35 MyClassNatives \
36 Nested \
37 NonStaticLeafMethods \
38 ProtoCompare \
39 ProtoCompare2 \
40 StaticLeafMethods \
41 Statics \
42 StaticsFromCode \
43 Transaction \
44 XandY
45
46# Create build rules for each dex file recording the dependency.
47$(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval $(call build-art-test-dex,art-gtest,$(dir), \
Ian Rogers1a2f84e2014-07-07 16:05:18 -070048 $(ART_TARGET_NATIVETEST_OUT),art/build/Android.gtest.mk,ART_TEST_TARGET_GTEST_$(dir)_DEX, \
49 ART_TEST_HOST_GTEST_$(dir)_DEX)))
Ian Rogersafd9acc2014-06-17 08:21:54 -070050
Richard Uhler66d874d2015-01-15 09:37:19 -080051# Create rules for MainStripped, a copy of Main with the classes.dex stripped
52# for the oat file assistant tests.
53ART_TEST_HOST_GTEST_MainStripped_DEX := $(basename $(ART_TEST_HOST_GTEST_Main_DEX))Stripped$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
54ART_TEST_TARGET_GTEST_MainStripped_DEX := $(basename $(ART_TEST_TARGET_GTEST_Main_DEX))Stripped$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))
55
56$(ART_TEST_HOST_GTEST_MainStripped_DEX): $(ART_TEST_HOST_GTEST_Main_DEX)
57 cp $< $@
58 $(call dexpreopt-remove-classes.dex,$@)
59
60$(ART_TEST_TARGET_GTEST_MainStripped_DEX): $(ART_TEST_TARGET_GTEST_Main_DEX)
61 cp $< $@
62 $(call dexpreopt-remove-classes.dex,$@)
63
Ian Rogersafd9acc2014-06-17 08:21:54 -070064# Dex file dependencies for each gtest.
Andreas Gampe81c6f8d2015-03-25 17:19:53 -070065ART_GTEST_class_linker_test_DEX_DEPS := Interfaces MultiDex MyClass Nested Statics StaticsFromCode
Andreas Gampe70bef0d2015-04-15 02:37:28 -070066ART_GTEST_compiler_driver_test_DEX_DEPS := AbstractMethod StaticLeafMethods
Andreas Gampeda823442014-11-03 15:36:53 -080067ART_GTEST_dex_file_test_DEX_DEPS := GetMethodSignature Main Nested
Brian Carlstromeb85f2b2014-06-25 13:23:00 -070068ART_GTEST_exception_test_DEX_DEPS := ExceptionHandle
Sebastien Hertz0462c4c2015-04-01 16:34:17 +020069ART_GTEST_instrumentation_test_DEX_DEPS := Instrumentation
Brian Carlstromeb85f2b2014-06-25 13:23:00 -070070ART_GTEST_jni_compiler_test_DEX_DEPS := MyClassNatives
71ART_GTEST_jni_internal_test_DEX_DEPS := AllFields StaticLeafMethods
Richard Uhler67ff7d12015-05-14 13:21:13 -070072ART_GTEST_oat_file_assistant_test_DEX_DEPS := Main MainStripped MultiDex MultiDexModifiedSecondary Nested
Andreas Gampe7848da42015-04-09 11:15:04 -070073ART_GTEST_oat_file_test_DEX_DEPS := Main MultiDex
Brian Carlstromeb85f2b2014-06-25 13:23:00 -070074ART_GTEST_object_test_DEX_DEPS := ProtoCompare ProtoCompare2 StaticsFromCode XandY
75ART_GTEST_proxy_test_DEX_DEPS := Interfaces
76ART_GTEST_reflection_test_DEX_DEPS := Main NonStaticLeafMethods StaticLeafMethods
77ART_GTEST_stub_test_DEX_DEPS := AllFields
78ART_GTEST_transaction_test_DEX_DEPS := Transaction
Ian Rogersafd9acc2014-06-17 08:21:54 -070079
80# The elf writer test has dependencies on core.oat.
Andreas Gampec23c9c92014-10-28 14:47:25 -070081ART_GTEST_elf_writer_test_HOST_DEPS := $(HOST_CORE_IMAGE_default_no-pic_64) $(HOST_CORE_IMAGE_default_no-pic_32)
82ART_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 -080083
Richard Uhler9a44f872015-03-12 12:35:43 -070084ART_GTEST_oat_file_assistant_test_HOST_DEPS := \
85 $(HOST_CORE_IMAGE_default_no-pic_64) \
86 $(HOST_CORE_IMAGE_default_no-pic_32) \
87 $(HOST_OUT_EXECUTABLES)/patchoatd
88ART_GTEST_oat_file_assistant_test_TARGET_DEPS := \
89 $(TARGET_CORE_IMAGE_default_no-pic_64) \
90 $(TARGET_CORE_IMAGE_default_no-pic_32) \
91 $(TARGET_OUT_EXECUTABLES)/patchoatd
Richard Uhler66d874d2015-01-15 09:37:19 -080092
Brian Carlstrom53463ea2014-11-09 14:11:51 -080093# TODO: document why this is needed.
Andreas Gampec23c9c92014-10-28 14:47:25 -070094ART_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 -070095
Aart Bikcfbe53c2015-07-06 14:27:27 -070096# The dexdump test requires an image and the dexdump utility.
Aart Bik22c26f52015-07-08 21:20:13 +000097# TODO: rename into dexdump when migration completes
Aart Bikcfbe53c2015-07-06 14:27:27 -070098ART_GTEST_dexdump_test_HOST_DEPS := \
99 $(HOST_CORE_IMAGE_default_no-pic_64) \
100 $(HOST_CORE_IMAGE_default_no-pic_32) \
Aart Bik22c26f52015-07-08 21:20:13 +0000101 $(HOST_OUT_EXECUTABLES)/dexdump2
Aart Bikcfbe53c2015-07-06 14:27:27 -0700102ART_GTEST_dexdump_test_TARGET_DEPS := \
103 $(TARGET_CORE_IMAGE_default_no-pic_64) \
104 $(TARGET_CORE_IMAGE_default_no-pic_32) \
Aart Bik22c26f52015-07-08 21:20:13 +0000105 dexdump2
Aart Bikcfbe53c2015-07-06 14:27:27 -0700106
Aart Bik3e40f4a2015-07-07 17:09:41 -0700107# The dexlist test requires an image and the dexlist utility.
Aart Bik22c26f52015-07-08 21:20:13 +0000108# TODO: rename into dexlist when migration completes
Aart Bik3e40f4a2015-07-07 17:09:41 -0700109ART_GTEST_dexlist_test_HOST_DEPS := \
110 $(HOST_CORE_IMAGE_default_no-pic_64) \
111 $(HOST_CORE_IMAGE_default_no-pic_32) \
Aart Bik22c26f52015-07-08 21:20:13 +0000112 $(HOST_OUT_EXECUTABLES)/dexlist2
Aart Bik3e40f4a2015-07-07 17:09:41 -0700113ART_GTEST_dexlist_test_TARGET_DEPS := \
114 $(TARGET_CORE_IMAGE_default_no-pic_64) \
115 $(TARGET_CORE_IMAGE_default_no-pic_32) \
Aart Bik22c26f52015-07-08 21:20:13 +0000116 dexlist2
Aart Bik3e40f4a2015-07-07 17:09:41 -0700117
Igor Murashkin37743352014-11-13 14:38:00 -0800118# The imgdiag test has dependencies on core.oat since it needs to load it during the test.
Andreas Gampec93b8b52014-12-19 23:12:25 -0800119# For the host, also add the installed tool (in the base size, that should suffice). For the
120# target, just the module is fine, the sync will happen late enough.
121ART_GTEST_imgdiag_test_HOST_DEPS := \
122 $(HOST_CORE_IMAGE_default_no-pic_64) \
123 $(HOST_CORE_IMAGE_default_no-pic_32) \
124 $(HOST_OUT_EXECUTABLES)/imgdiagd
125ART_GTEST_imgdiag_test_TARGET_DEPS := \
126 $(TARGET_CORE_IMAGE_default_no-pic_64) \
127 $(TARGET_CORE_IMAGE_default_no-pic_32) \
128 imgdiagd
Igor Murashkin37743352014-11-13 14:38:00 -0800129
Mathieu Chartierea216b32015-05-26 19:48:16 -0700130# Oatdump test requires an image and oatfile to dump.
131ART_GTEST_oatdump_test_HOST_DEPS := \
132 $(HOST_CORE_IMAGE_default_no-pic_64) \
133 $(HOST_CORE_IMAGE_default_no-pic_32) \
134 $(HOST_OUT_EXECUTABLES)/oatdumpd
135ART_GTEST_oatdump_test_TARGET_DEPS := \
136 $(TARGET_CORE_IMAGE_default_no-pic_64) \
137 $(TARGET_CORE_IMAGE_default_no-pic_32) \
138 oatdump
139
Ian Rogersafd9acc2014-06-17 08:21:54 -0700140# The path for which all the source files are relative, not actually the current directory.
Brian Carlstrom7940e442013-07-12 13:46:57 -0700141LOCAL_PATH := art
142
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800143RUNTIME_GTEST_COMMON_SRC_FILES := \
Igor Murashkinaaebaa02015-01-26 10:55:53 -0800144 cmdline/cmdline_parser_test.cc \
Aart Bik69ae54a2015-07-01 14:52:26 -0700145 dexdump/dexdump_test.cc \
Aart Bik3e40f4a2015-07-07 17:09:41 -0700146 dexlist/dexlist_test.cc \
Igor Murashkin37743352014-11-13 14:38:00 -0800147 imgdiag/imgdiag_test.cc \
Mathieu Chartier19510f02015-05-26 14:44:35 -0700148 oatdump/oatdump_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700149 runtime/arch/arch_test.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800150 runtime/arch/instruction_set_test.cc \
151 runtime/arch/instruction_set_features_test.cc \
Serban Constantinescu86797a72014-06-19 16:17:56 +0100152 runtime/arch/memcmp16_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700153 runtime/arch/stub_test.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800154 runtime/arch/arm/instruction_set_features_arm_test.cc \
155 runtime/arch/arm64/instruction_set_features_arm64_test.cc \
156 runtime/arch/mips/instruction_set_features_mips_test.cc \
Andreas Gampe57b34292015-01-14 15:45:59 -0800157 runtime/arch/mips64/instruction_set_features_mips64_test.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800158 runtime/arch/x86/instruction_set_features_x86_test.cc \
159 runtime/arch/x86_64/instruction_set_features_x86_64_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700160 runtime/barrier_test.cc \
161 runtime/base/bit_field_test.cc \
Vladimir Marko80afd022015-05-19 18:08:00 +0100162 runtime/base/bit_utils_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700163 runtime/base/bit_vector_test.cc \
Mathieu Chartierc2e20622014-11-03 11:41:47 -0800164 runtime/base/hash_set_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700165 runtime/base/hex_dump_test.cc \
166 runtime/base/histogram_test.cc \
167 runtime/base/mutex_test.cc \
Igor Murashkinfb326cf2015-07-23 16:53:53 -0700168 runtime/base/out_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700169 runtime/base/scoped_flock_test.cc \
Brian Carlstrom2cbaccb2014-09-14 20:34:17 -0700170 runtime/base/stringprintf_test.cc \
Vladimir Marko80afd022015-05-19 18:08:00 +0100171 runtime/base/time_utils_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700172 runtime/base/timing_logger_test.cc \
Igor Murashkinaaebaa02015-01-26 10:55:53 -0800173 runtime/base/variant_map_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700174 runtime/base/unix_file/fd_file_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700175 runtime/class_linker_test.cc \
176 runtime/dex_file_test.cc \
177 runtime/dex_file_verifier_test.cc \
Aart Bikb1f37532015-06-29 11:03:55 -0700178 runtime/dex_instruction_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700179 runtime/dex_instruction_visitor_test.cc \
180 runtime/dex_method_iterator_test.cc \
181 runtime/entrypoints/math_entrypoints_test.cc \
182 runtime/entrypoints/quick/quick_trampoline_entrypoints_test.cc \
183 runtime/entrypoints_order_test.cc \
184 runtime/exception_test.cc \
Mathieu Chartier2c265012014-08-05 18:15:56 -0700185 runtime/gc/accounting/card_table_test.cc \
Mathieu Chartier4858a932015-01-23 13:18:53 -0800186 runtime/gc/accounting/mod_union_table_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700187 runtime/gc/accounting/space_bitmap_test.cc \
188 runtime/gc/heap_test.cc \
Mathieu Chartier9e2094f2014-12-11 18:43:48 -0800189 runtime/gc/reference_queue_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700190 runtime/gc/space/dlmalloc_space_base_test.cc \
191 runtime/gc/space/dlmalloc_space_static_test.cc \
192 runtime/gc/space/dlmalloc_space_random_test.cc \
193 runtime/gc/space/rosalloc_space_base_test.cc \
194 runtime/gc/space/rosalloc_space_static_test.cc \
195 runtime/gc/space/rosalloc_space_random_test.cc \
196 runtime/gc/space/large_object_space_test.cc \
Mathieu Chartiera5eae692014-12-17 17:56:03 -0800197 runtime/gc/task_processor_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700198 runtime/gtest_test.cc \
199 runtime/handle_scope_test.cc \
200 runtime/indenter_test.cc \
201 runtime/indirect_reference_table_test.cc \
Sebastien Hertz0462c4c2015-04-01 16:34:17 +0200202 runtime/instrumentation_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700203 runtime/intern_table_test.cc \
Ian Rogers5ac814a2014-11-04 16:39:32 -0800204 runtime/interpreter/safe_math_test.cc \
Andreas Gampe799681b2015-05-15 19:24:12 -0700205 runtime/interpreter/unstarted_runtime_test.cc \
Ian Rogersf4d4da12014-11-11 16:10:33 -0800206 runtime/java_vm_ext_test.cc \
Mathieu Chartierbce416f2015-03-23 12:37:35 -0700207 runtime/jit/jit_code_cache_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700208 runtime/leb128_test.cc \
209 runtime/mem_map_test.cc \
Roland Levillaina2d8ec62015-03-12 15:25:29 +0000210 runtime/memory_region_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700211 runtime/mirror/dex_cache_test.cc \
212 runtime/mirror/object_test.cc \
Andreas Gampe74240812014-04-17 10:35:09 -0700213 runtime/monitor_pool_test.cc \
Elena Sayapina1af6a1f2014-06-20 16:58:37 +0700214 runtime/monitor_test.cc \
Richard Uhlere5fed032015-03-18 08:21:11 -0700215 runtime/oat_file_test.cc \
Richard Uhler66d874d2015-01-15 09:37:19 -0800216 runtime/oat_file_assistant_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700217 runtime/parsed_options_test.cc \
David Srbecky3e52aa42015-04-12 07:45:18 +0100218 runtime/prebuilt_tools_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700219 runtime/reference_table_test.cc \
220 runtime/thread_pool_test.cc \
221 runtime/transaction_test.cc \
Narayan Kamatha5afcfc2015-01-29 20:06:46 +0000222 runtime/utf_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700223 runtime/utils_test.cc \
224 runtime/verifier/method_verifier_test.cc \
225 runtime/verifier/reg_type_test.cc \
226 runtime/zip_archive_test.cc
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800227
228COMPILER_GTEST_COMMON_SRC_FILES := \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700229 runtime/jni_internal_test.cc \
Jeff Haodb8a6642014-08-14 17:18:52 -0700230 runtime/proxy_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700231 runtime/reflection_test.cc \
Vladimir Marko7a01dc22015-01-02 17:00:44 +0000232 compiler/dex/gvn_dead_code_elimination_test.cc \
Vladimir Marko95a05972014-05-30 10:01:32 +0100233 compiler/dex/global_value_numbering_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700234 compiler/dex/local_value_numbering_test.cc \
Vladimir Marko55fff042014-07-10 12:42:52 +0100235 compiler/dex/mir_graph_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700236 compiler/dex/mir_optimization_test.cc \
David Srbecky1109fb32015-04-07 20:21:06 +0100237 compiler/dex/quick/quick_cfi_test.cc \
Vladimir Markoc91df2d2015-04-23 09:29:21 +0000238 compiler/dex/type_inference_test.cc \
David Srbecky15c19752015-03-31 14:53:55 +0000239 compiler/dwarf/dwarf_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700240 compiler/driver/compiler_driver_test.cc \
241 compiler/elf_writer_test.cc \
242 compiler/image_test.cc \
David Srbeckydd973932015-04-07 20:29:48 +0100243 compiler/jni/jni_cfi_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700244 compiler/jni/jni_compiler_test.cc \
Vladimir Marko3f311cf2015-04-02 15:28:45 +0100245 compiler/linker/arm64/relative_patcher_arm64_test.cc \
Vladimir Marko4d23c9d2015-04-01 23:03:09 +0100246 compiler/linker/arm/relative_patcher_thumb2_test.cc \
Vladimir Markob163bb72015-03-31 21:49:49 +0100247 compiler/linker/x86/relative_patcher_x86_test.cc \
248 compiler/linker/x86_64/relative_patcher_x86_64_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700249 compiler/oat_test.cc \
Mingyao Yangf384f882014-10-22 16:08:18 -0700250 compiler/optimizing/bounds_check_elimination_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700251 compiler/optimizing/codegen_test.cc \
Roland Levillain72bceff2014-09-15 18:29:00 +0100252 compiler/optimizing/dead_code_elimination_test.cc \
Roland Levillain75be2832014-10-17 17:02:00 +0100253 compiler/optimizing/constant_folding_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700254 compiler/optimizing/dominator_test.cc \
255 compiler/optimizing/find_loops_test.cc \
Roland Levillainccc07a92014-09-16 14:48:16 +0100256 compiler/optimizing/graph_checker_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700257 compiler/optimizing/graph_test.cc \
Nicolas Geoffrayd31cf3d2014-09-08 17:30:24 +0100258 compiler/optimizing/gvn_test.cc \
Aart Bik3f307f32015-07-21 18:30:18 -0700259 compiler/optimizing/licm_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700260 compiler/optimizing/linearize_test.cc \
261 compiler/optimizing/liveness_test.cc \
262 compiler/optimizing/live_interval_test.cc \
263 compiler/optimizing/live_ranges_test.cc \
Nicolas Geoffray724c9632014-09-22 12:27:27 +0100264 compiler/optimizing/nodes_test.cc \
David Srbeckyc6b4dd82015-04-07 20:32:43 +0100265 compiler/optimizing/optimizing_cfi_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700266 compiler/optimizing/parallel_move_test.cc \
267 compiler/optimizing/pretty_printer_test.cc \
268 compiler/optimizing/register_allocator_test.cc \
Aart Bik854a02b2015-07-14 16:07:00 -0700269 compiler/optimizing/side_effects_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700270 compiler/optimizing/ssa_test.cc \
Nicolas Geoffray99ea58c2014-07-02 15:08:17 +0100271 compiler/optimizing/stack_map_test.cc \
Nicolas Geoffrayfbc695f2014-09-15 15:33:30 +0000272 compiler/optimizing/suspend_check_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700273 compiler/output_stream_test.cc \
274 compiler/utils/arena_allocator_test.cc \
275 compiler/utils/dedupe_set_test.cc \
Andreas Gampee21dc3d2014-12-08 16:59:43 -0800276 compiler/utils/swap_space_test.cc \
Vladimir Markoc91df2d2015-04-23 09:29:21 +0000277 compiler/utils/test_dex_file_builder_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700278 compiler/utils/arm/managed_register_arm_test.cc \
279 compiler/utils/arm64/managed_register_arm64_test.cc \
280 compiler/utils/x86/managed_register_x86_test.cc \
Brian Carlstrom51c24672013-07-11 16:00:56 -0700281
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800282RUNTIME_GTEST_TARGET_SRC_FILES := \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700283 $(RUNTIME_GTEST_COMMON_SRC_FILES)
Brian Carlstrom51c24672013-07-11 16:00:56 -0700284
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800285RUNTIME_GTEST_HOST_SRC_FILES := \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700286 $(RUNTIME_GTEST_COMMON_SRC_FILES)
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800287
288COMPILER_GTEST_TARGET_SRC_FILES := \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700289 $(COMPILER_GTEST_COMMON_SRC_FILES)
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800290
291COMPILER_GTEST_HOST_SRC_FILES := \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700292 $(COMPILER_GTEST_COMMON_SRC_FILES) \
Chao-ying Fuc4013ea2015-04-22 10:51:21 -0700293 compiler/dex/quick/x86/quick_assemble_x86_test.cc \
Roland Levillain1a28fc42014-11-13 18:03:06 +0000294 compiler/utils/arm/assembler_arm32_test.cc \
295 compiler/utils/arm/assembler_thumb2_test.cc \
296 compiler/utils/assembler_thumb_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700297 compiler/utils/x86/assembler_x86_test.cc \
298 compiler/utils/x86_64/assembler_x86_64_test.cc
Brian Carlstrom8ecd08c2011-07-27 17:50:51 -0700299
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800300ART_TEST_CFLAGS :=
buzbee2cfc6392012-05-07 14:51:40 -0700301
Ian Rogerse63db272014-07-15 15:36:11 -0700302include $(CLEAR_VARS)
303LOCAL_MODULE := libart-gtest
304LOCAL_MODULE_TAGS := optional
305LOCAL_CPP_EXTENSION := cc
Ian Rogerse63db272014-07-15 15:36:11 -0700306LOCAL_SRC_FILES := runtime/common_runtime_test.cc compiler/common_compiler_test.cc
307LOCAL_C_INCLUDES := $(ART_C_INCLUDES) art/runtime art/compiler
Ian Rogers872dd822014-10-30 11:19:14 -0700308LOCAL_SHARED_LIBRARIES := libartd libartd-compiler libdl
Dan Albertfd84f662014-11-11 18:53:41 -0800309LOCAL_STATIC_LIBRARIES += libgtest
Ian Rogerse63db272014-07-15 15:36:11 -0700310LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
311LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk
Andreas Gampebced67d2015-01-07 14:35:44 -0800312$(eval $(call set-target-local-clang-vars))
313$(eval $(call set-target-local-cflags-vars,debug))
Andreas Gampe9b14dc32015-04-06 15:35:02 -0700314LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
Ian Rogerse63db272014-07-15 15:36:11 -0700315include $(BUILD_SHARED_LIBRARY)
316
317include $(CLEAR_VARS)
318LOCAL_MODULE := libart-gtest
319LOCAL_MODULE_TAGS := optional
320LOCAL_CPP_EXTENSION := cc
321LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
Roland Levillain12bd7212015-06-04 17:50:27 +0100322LOCAL_ASFLAGS := $(ART_HOST_ASFLAGS)
Ian Rogerse63db272014-07-15 15:36:11 -0700323LOCAL_SRC_FILES := runtime/common_runtime_test.cc compiler/common_compiler_test.cc
324LOCAL_C_INCLUDES := $(ART_C_INCLUDES) art/runtime art/compiler
325LOCAL_SHARED_LIBRARIES := libartd libartd-compiler
Nicolas Geoffray10fc34b2014-11-10 21:38:15 +0000326LOCAL_STATIC_LIBRARIES := libgtest_host
Ian Rogerse63db272014-07-15 15:36:11 -0700327LOCAL_LDLIBS += -ldl -lpthread
328LOCAL_MULTILIB := both
329LOCAL_CLANG := $(ART_HOST_CLANG)
Andreas Gampe9b14dc32015-04-06 15:35:02 -0700330LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
Ian Rogerse63db272014-07-15 15:36:11 -0700331LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
332LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk
Ian Rogerse63db272014-07-15 15:36:11 -0700333include $(BUILD_HOST_SHARED_LIBRARY)
334
Ian Rogersafd9acc2014-06-17 08:21:54 -0700335# Variables holding collections of gtest pre-requisits used to run a number of gtests.
336ART_TEST_HOST_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
337ART_TEST_HOST_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
338ART_TEST_HOST_GTEST_RULES :=
339ART_TEST_HOST_VALGRIND_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
340ART_TEST_HOST_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
341ART_TEST_HOST_VALGRIND_GTEST_RULES :=
342ART_TEST_TARGET_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
343ART_TEST_TARGET_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
344ART_TEST_TARGET_GTEST_RULES :=
Nicolas Geoffray58035ae2015-05-27 19:10:27 +0100345ART_TEST_HOST_GTEST_DEPENDENCIES :=
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700346
Nicolas Geoffray96a37c82014-10-29 23:50:40 +0000347ART_GTEST_TARGET_ANDROID_ROOT := '/system'
348ifneq ($(ART_TEST_ANDROID_ROOT),)
349 ART_GTEST_TARGET_ANDROID_ROOT := $(ART_TEST_ANDROID_ROOT)
350endif
351
Ian Rogersafd9acc2014-06-17 08:21:54 -0700352# Define a make rule for a target device gtest.
353# $(1): gtest name - the name of the test we're building such as leb128_test.
354# $(2): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000355# $(3): LD_LIBRARY_PATH or undefined - used in case libartd.so is not in /system/lib/
Ian Rogersafd9acc2014-06-17 08:21:54 -0700356define define-art-gtest-rule-target
357 gtest_rule := test-art-target-gtest-$(1)$$($(2)ART_PHONY_TEST_TARGET_SUFFIX)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700358
Brian Carlstrom532714a2014-06-25 02:15:31 -0700359 # Add the test dependencies to test-art-target-sync, which will be a prerequisite for the test
Ian Rogersafd9acc2014-06-17 08:21:54 -0700360 # to ensure files are pushed to the device.
361 TEST_ART_TARGET_SYNC_DEPS += \
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700362 $$(ART_GTEST_$(1)_TARGET_DEPS) \
Ian Rogers1a2f84e2014-07-07 16:05:18 -0700363 $(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_TARGET_GTEST_$(file)_DEX)) \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700364 $$(ART_TARGET_NATIVETEST_OUT)/$$(TARGET_$(2)ARCH)/$(1) \
Nicolas Geoffray96a63452014-10-30 12:13:17 +0000365 $$($(2)TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so \
366 $$(TARGET_OUT_JAVA_LIBRARIES)/core-libart.jar
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700367
Ian Rogersafd9acc2014-06-17 08:21:54 -0700368.PHONY: $$(gtest_rule)
369$$(gtest_rule): test-art-target-sync
370 $(hide) adb shell touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID
371 $(hide) adb shell rm $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID
372 $(hide) adb shell chmod 755 $(ART_TARGET_NATIVETEST_DIR)/$(TARGET_$(2)ARCH)/$(1)
373 $(hide) $$(call ART_TEST_SKIP,$$@) && \
Dan Albert31fb2602014-09-30 22:10:10 -0700374 (adb shell "$(GCOV_ENV) LD_LIBRARY_PATH=$(3) ANDROID_ROOT=$(ART_GTEST_TARGET_ANDROID_ROOT) \
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000375 $(ART_TARGET_NATIVETEST_DIR)/$(TARGET_$(2)ARCH)/$(1) && touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID" \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700376 && (adb pull $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID /tmp/ \
377 && $$(call ART_TEST_PASSED,$$@)) \
378 || $$(call ART_TEST_FAILED,$$@))
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700379 $(hide) rm -f /tmp/$$@-$$$$PPID
Ian Rogersafd9acc2014-06-17 08:21:54 -0700380
381 ART_TEST_TARGET_GTEST$($(2)ART_PHONY_TEST_TARGET_SUFFIX)_RULES += $$(gtest_rule)
382 ART_TEST_TARGET_GTEST_RULES += $$(gtest_rule)
383 ART_TEST_TARGET_GTEST_$(1)_RULES += $$(gtest_rule)
384
385 # Clear locally defined variables.
386 gtest_rule :=
387endef # define-art-gtest-rule-target
388
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800389ART_VALGRIND_DEPENDENCIES := \
390 $(HOST_OUT_EXECUTABLES)/valgrind \
391 $(HOST_OUT)/lib64/valgrind/memcheck-amd64-linux \
392 $(HOST_OUT)/lib64/valgrind/memcheck-x86-linux \
393 $(HOST_OUT)/lib64/valgrind/default.supp \
394 $(HOST_OUT)/lib64/valgrind/vgpreload_core-amd64-linux.so \
395 $(HOST_OUT)/lib64/valgrind/vgpreload_core-x86-linux.so \
396 $(HOST_OUT)/lib64/valgrind/vgpreload_memcheck-amd64-linux.so \
397 $(HOST_OUT)/lib64/valgrind/vgpreload_memcheck-x86-linux.so
398
Ian Rogersafd9acc2014-06-17 08:21:54 -0700399# Define make rules for a host gtests.
400# $(1): gtest name - the name of the test we're building such as leb128_test.
401# $(2): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
402define define-art-gtest-rule-host
403 gtest_rule := test-art-host-gtest-$(1)$$($(2)ART_PHONY_TEST_HOST_SUFFIX)
404 gtest_exe := $$(HOST_OUT_EXECUTABLES)/$(1)$$($(2)ART_PHONY_TEST_HOST_SUFFIX)
Ian Rogers665de8a2014-06-24 21:34:09 -0700405 # Dependencies for all host gtests.
406 gtest_deps := $$(HOST_CORE_DEX_LOCATIONS) \
Nicolas Geoffray58035ae2015-05-27 19:10:27 +0100407 $$($(2)ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$$(ART_HOST_SHLIB_EXTENSION) \
408 $$(gtest_exe) \
409 $$(ART_GTEST_$(1)_HOST_DEPS) \
410 $(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_HOST_GTEST_$(file)_DEX))
Ian Rogers665de8a2014-06-24 21:34:09 -0700411
Nicolas Geoffray58035ae2015-05-27 19:10:27 +0100412 ART_TEST_HOST_GTEST_DEPENDENCIES += $$(gtest_deps)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700413
414.PHONY: $$(gtest_rule)
Nicolas Geoffray0f7c06d2015-05-28 10:21:03 +0100415$$(gtest_rule): $$(gtest_exe) $$(gtest_deps)
Dmitriy Ivanov8508a432014-10-14 11:38:46 -0700416 $(hide) ($$(call ART_TEST_SKIP,$$@) && $$< && $$(call ART_TEST_PASSED,$$@)) \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700417 || $$(call ART_TEST_FAILED,$$@)
418
419 ART_TEST_HOST_GTEST$$($(2)ART_PHONY_TEST_HOST_SUFFIX)_RULES += $$(gtest_rule)
420 ART_TEST_HOST_GTEST_RULES += $$(gtest_rule)
421 ART_TEST_HOST_GTEST_$(1)_RULES += $$(gtest_rule)
422
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800423
Ian Rogersafd9acc2014-06-17 08:21:54 -0700424.PHONY: valgrind-$$(gtest_rule)
Andreas Gampe3db36002015-05-28 20:17:09 -0700425valgrind-$$(gtest_rule): $$(gtest_exe) $$(gtest_deps) $(ART_VALGRIND_DEPENDENCIES)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700426 $(hide) $$(call ART_TEST_SKIP,$$@) && \
Andreas Gampe8df91ac2015-02-20 13:15:15 -0800427 VALGRIND_LIB=$(HOST_OUT)/lib64/valgrind \
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800428 $(HOST_OUT_EXECUTABLES)/valgrind --leak-check=full --error-exitcode=1 $$< && \
429 $$(call ART_TEST_PASSED,$$@) || $$(call ART_TEST_FAILED,$$@)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700430
431 ART_TEST_HOST_VALGRIND_GTEST$$($(2)ART_PHONY_TEST_HOST_SUFFIX)_RULES += valgrind-$$(gtest_rule)
432 ART_TEST_HOST_VALGRIND_GTEST_RULES += valgrind-$$(gtest_rule)
433 ART_TEST_HOST_VALGRIND_GTEST_$(1)_RULES += valgrind-$$(gtest_rule)
434
435 # Clear locally defined variables.
436 valgrind_gtest_rule :=
437 gtest_rule :=
438 gtest_exe :=
Ian Rogers665de8a2014-06-24 21:34:09 -0700439 gtest_deps :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700440endef # define-art-gtest-rule-host
441
442# Define the rules to build and run host and target gtests.
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700443# $(1): target or host
Brian Carlstrom0796af02011-10-12 14:31:45 -0700444# $(2): file name
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800445# $(3): extra C includes
446# $(4): extra shared libraries
Ian Rogersafd9acc2014-06-17 08:21:54 -0700447define define-art-gtest
Brian Carlstrom0796af02011-10-12 14:31:45 -0700448 ifneq ($(1),target)
449 ifneq ($(1),host)
450 $$(error expected target or host for argument 1, received $(1))
451 endif
452 endif
453
454 art_target_or_host := $(1)
455 art_gtest_filename := $(2)
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800456 art_gtest_extra_c_includes := $(3)
457 art_gtest_extra_shared_libraries := $(4)
Brian Carlstrom0796af02011-10-12 14:31:45 -0700458
Ian Rogersafd9acc2014-06-17 08:21:54 -0700459 include $$(CLEAR_VARS)
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700460 art_gtest_name := $$(notdir $$(basename $$(art_gtest_filename)))
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700461 LOCAL_MODULE := $$(art_gtest_name)
Brian Carlstrom871599a2012-09-06 13:27:49 -0700462 ifeq ($$(art_target_or_host),target)
463 LOCAL_MODULE_TAGS := tests
464 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700465 LOCAL_CPP_EXTENSION := $$(ART_CPP_EXTENSION)
Dmitriy Ivanove49a4f62014-10-20 14:11:00 -0700466 LOCAL_SRC_FILES := $$(art_gtest_filename)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700467 LOCAL_C_INCLUDES += $$(ART_C_INCLUDES) art/runtime $$(art_gtest_extra_c_includes)
Andreas Gampe0ae3bf82015-05-20 16:09:36 -0700468 LOCAL_SHARED_LIBRARIES += libartd $$(art_gtest_extra_shared_libraries) libart-gtest libartd-disassembler
Dmitriy Ivanove49a4f62014-10-20 14:11:00 -0700469 LOCAL_WHOLE_STATIC_LIBRARIES += libsigchain
Brian Carlstrom4478eb02013-07-14 21:05:57 -0700470
Ian Rogerse63db272014-07-15 15:36:11 -0700471 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
472 LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk
Brian Carlstromb9cc1ca2012-01-27 00:57:42 -0800473
Elliott Hughes0f096762012-01-31 10:32:46 -0800474 # Mac OS linker doesn't understand --export-dynamic.
Ian Rogersafd9acc2014-06-17 08:21:54 -0700475 ifneq ($$(HOST_OS)-$$(art_target_or_host),darwin-host)
Elliott Hughesb264f082012-04-06 17:10:10 -0700476 # Allow jni_compiler_test to find Java_MyClassNatives_bar within itself using dlopen(NULL, ...).
477 LOCAL_LDFLAGS := -Wl,--export-dynamic -Wl,-u,Java_MyClassNatives_bar -Wl,-u,Java_MyClassNatives_sbar
Brian Carlstromcfede662012-01-29 17:25:54 -0800478 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -0700479
Ian Rogersafd9acc2014-06-17 08:21:54 -0700480 LOCAL_CFLAGS := $$(ART_TEST_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -0700481 ifeq ($$(art_target_or_host),target)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700482 $$(eval $$(call set-target-local-clang-vars))
483 $$(eval $$(call set-target-local-cflags-vars,debug))
Serban Constantinescu32f5b4d2014-11-25 20:05:46 +0000484 LOCAL_SHARED_LIBRARIES += libdl libicuuc libicui18n libnativehelper libz libcutils libvixld
Ian Rogersafd9acc2014-06-17 08:21:54 -0700485 LOCAL_MODULE_PATH_32 := $$(ART_TARGET_NATIVETEST_OUT)/$$(ART_TARGET_ARCH_32)
486 LOCAL_MODULE_PATH_64 := $$(ART_TARGET_NATIVETEST_OUT)/$$(ART_TARGET_ARCH_64)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700487 LOCAL_MULTILIB := both
Andreas Gampe9b14dc32015-04-06 15:35:02 -0700488 LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
Ian Rogersafd9acc2014-06-17 08:21:54 -0700489 include $$(BUILD_EXECUTABLE)
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000490 library_path :=
491 2nd_library_path :=
492 ifneq ($$(ART_TEST_ANDROID_ROOT),)
493 ifdef TARGET_2ND_ARCH
494 2nd_library_path := $$(ART_TEST_ANDROID_ROOT)/lib
495 library_path := $$(ART_TEST_ANDROID_ROOT)/lib64
496 else
Nicolas Geoffrayc1dea4a2014-11-10 08:33:52 +0000497 ifneq ($(filter %64,$(TARGET_ARCH)),)
498 library_path := $$(ART_TEST_ANDROID_ROOT)/lib64
499 else
500 library_path := $$(ART_TEST_ANDROID_ROOT)/lib
501 endif
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000502 endif
503 endif
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700504
Ian Rogersafd9acc2014-06-17 08:21:54 -0700505 ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES :=
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700506 ifdef TARGET_2ND_ARCH
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000507 $$(eval $$(call define-art-gtest-rule-target,$$(art_gtest_name),2ND_,$$(2nd_library_path)))
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700508 endif
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000509 $$(eval $$(call define-art-gtest-rule-target,$$(art_gtest_name),,$$(library_path)))
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700510
Ian Rogersafd9acc2014-06-17 08:21:54 -0700511 # A rule to run the different architecture versions of the gtest.
512.PHONY: test-art-target-gtest-$$(art_gtest_name)
513test-art-target-gtest-$$(art_gtest_name): $$(ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES)
514 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
515
516 # Clear locally defined variables.
517 ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES :=
Brian Carlstrom0796af02011-10-12 14:31:45 -0700518 else # host
Ian Rogersafd9acc2014-06-17 08:21:54 -0700519 LOCAL_CLANG := $$(ART_HOST_CLANG)
520 LOCAL_CFLAGS += $$(ART_HOST_CFLAGS) $$(ART_HOST_DEBUG_CFLAGS)
Roland Levillain12bd7212015-06-04 17:50:27 +0100521 LOCAL_ASFLAGS += $$(ART_HOST_ASFLAGS)
Serban Constantinescu32f5b4d2014-11-25 20:05:46 +0000522 LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host libnativehelper libziparchive-host libz-host libvixld
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700523 LOCAL_LDLIBS := $(ART_HOST_LDLIBS) -lpthread -ldl
Ian Rogersbd5ea6a2014-04-16 16:34:44 -0700524 LOCAL_IS_HOST_MODULE := true
Ian Rogersafd9acc2014-06-17 08:21:54 -0700525 LOCAL_MULTILIB := both
526 LOCAL_MODULE_STEM_32 := $$(art_gtest_name)32
527 LOCAL_MODULE_STEM_64 := $$(art_gtest_name)64
Andreas Gampe9b14dc32015-04-06 15:35:02 -0700528 LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
Ian Rogersafd9acc2014-06-17 08:21:54 -0700529 include $$(BUILD_HOST_EXECUTABLE)
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700530
Ian Rogersafd9acc2014-06-17 08:21:54 -0700531 ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES :=
532 ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
533 ifneq ($$(HOST_PREFER_32_BIT),true)
534 $$(eval $$(call define-art-gtest-rule-host,$$(art_gtest_name),2ND_))
535 endif
536 $$(eval $$(call define-art-gtest-rule-host,$$(art_gtest_name),))
Ian Rogersd912e5c2013-11-13 12:40:11 -0800537
Ian Rogersafd9acc2014-06-17 08:21:54 -0700538 # Rules to run the different architecture versions of the gtest.
539.PHONY: test-art-host-gtest-$$(art_gtest_name)
540test-art-host-gtest-$$(art_gtest_name): $$(ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES)
541 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
Ian Rogersd912e5c2013-11-13 12:40:11 -0800542
Ian Rogersafd9acc2014-06-17 08:21:54 -0700543.PHONY: valgrind-test-art-host-gtest-$$(art_gtest_name)
544valgrind-test-art-host-gtest-$$(art_gtest_name): $$(ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES)
545 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
546
547 # Clear locally defined variables.
548 ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES :=
549 ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
550 endif # host_or_target
551
552 # Clear locally defined variables.
553 art_target_or_host :=
554 art_gtest_filename :=
555 art_gtest_extra_c_includes :=
556 art_gtest_extra_shared_libraries :=
557 art_gtest_name :=
Nicolas Geoffray96a37c82014-10-29 23:50:40 +0000558 library_path :=
559 2nd_library_path :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700560endef # define-art-gtest
Carl Shapiro008e4122011-06-23 17:27:46 -0700561
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700562ifeq ($(ART_BUILD_TARGET),true)
Richard Uhler66d874d2015-01-15 09:37:19 -0800563 $(foreach file,$(RUNTIME_GTEST_TARGET_SRC_FILES), $(eval $(call define-art-gtest,target,$(file),,libbacktrace)))
564 $(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 -0700565endif
Ian Rogersc5f17732014-06-05 20:48:42 -0700566ifeq ($(ART_BUILD_HOST),true)
Richard Uhler66d874d2015-01-15 09:37:19 -0800567 $(foreach file,$(RUNTIME_GTEST_HOST_SRC_FILES), $(eval $(call define-art-gtest,host,$(file),,libbacktrace)))
568 $(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 -0700569endif
Tsu Chiang Chuangec245a42014-05-15 21:16:21 -0700570
571# Used outside the art project to get a list of the current tests
572RUNTIME_TARGET_GTEST_MAKE_TARGETS :=
573$(foreach file, $(RUNTIME_GTEST_TARGET_SRC_FILES), $(eval RUNTIME_TARGET_GTEST_MAKE_TARGETS += $$(notdir $$(basename $$(file)))))
574COMPILER_TARGET_GTEST_MAKE_TARGETS :=
575$(foreach file, $(COMPILER_GTEST_TARGET_SRC_FILES), $(eval COMPILER_TARGET_GTEST_MAKE_TARGETS += $$(notdir $$(basename $$(file)))))
Ian Rogersafd9acc2014-06-17 08:21:54 -0700576
577# Define all the combinations of host/target, valgrind and suffix such as:
578# test-art-host-gtest or valgrind-test-art-host-gtest64
579# $(1): host or target
580# $(2): HOST or TARGET
581# $(3): valgrind- or undefined
582# $(4): undefined, 32 or 64
583define define-test-art-gtest-combination
584 ifeq ($(1),host)
585 ifneq ($(2),HOST)
586 $$(error argument mismatch $(1) and ($2))
587 endif
588 else
589 ifneq ($(1),target)
590 $$(error found $(1) expected host or target)
591 endif
592 ifneq ($(2),TARGET)
593 $$(error argument mismatch $(1) and ($2))
594 endif
595 endif
596
597 rule_name := $(3)test-art-$(1)-gtest$(4)
Andreas Gampe928f72b2014-09-09 19:53:48 -0700598 ifeq ($(3),valgrind-)
599 ifneq ($(1),host)
600 $$(error valgrind tests only wired up for the host)
601 endif
602 dependencies := $$(ART_TEST_$(2)_VALGRIND_GTEST$(4)_RULES)
603 else
604 dependencies := $$(ART_TEST_$(2)_GTEST$(4)_RULES)
605 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700606
607.PHONY: $$(rule_name)
608$$(rule_name): $$(dependencies)
609 $(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
610
611 # Clear locally defined variables.
612 rule_name :=
613 dependencies :=
614endef # define-test-art-gtest-combination
615
616$(eval $(call define-test-art-gtest-combination,target,TARGET,,))
617$(eval $(call define-test-art-gtest-combination,target,TARGET,,$(ART_PHONY_TEST_TARGET_SUFFIX)))
618ifdef TARGET_2ND_ARCH
619$(eval $(call define-test-art-gtest-combination,target,TARGET,,$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)))
620endif
621$(eval $(call define-test-art-gtest-combination,host,HOST,,))
622$(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,))
623$(eval $(call define-test-art-gtest-combination,host,HOST,,$(ART_PHONY_TEST_HOST_SUFFIX)))
624$(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,$(ART_PHONY_TEST_HOST_SUFFIX)))
625ifneq ($(HOST_PREFER_32_BIT),true)
626$(eval $(call define-test-art-gtest-combination,host,HOST,,$(2ND_ART_PHONY_TEST_HOST_SUFFIX)))
627$(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,$(2ND_ART_PHONY_TEST_HOST_SUFFIX)))
628endif
629
630# Clear locally defined variables.
631define-art-gtest-rule-target :=
632define-art-gtest-rule-host :=
633define-art-gtest :=
634define-test-art-gtest-combination :=
635RUNTIME_GTEST_COMMON_SRC_FILES :=
636COMPILER_GTEST_COMMON_SRC_FILES :=
637RUNTIME_GTEST_TARGET_SRC_FILES :=
638RUNTIME_GTEST_HOST_SRC_FILES :=
639COMPILER_GTEST_TARGET_SRC_FILES :=
640COMPILER_GTEST_HOST_SRC_FILES :=
641ART_TEST_CFLAGS :=
642ART_TEST_HOST_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
643ART_TEST_HOST_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
644ART_TEST_HOST_GTEST_RULES :=
645ART_TEST_HOST_VALGRIND_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
646ART_TEST_HOST_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
647ART_TEST_HOST_VALGRIND_GTEST_RULES :=
648ART_TEST_TARGET_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
649ART_TEST_TARGET_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
650ART_TEST_TARGET_GTEST_RULES :=
Nicolas Geoffray96a37c82014-10-29 23:50:40 +0000651ART_GTEST_TARGET_ANDROID_ROOT :=
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700652ART_GTEST_class_linker_test_DEX_DEPS :=
653ART_GTEST_compiler_driver_test_DEX_DEPS :=
654ART_GTEST_dex_file_test_DEX_DEPS :=
655ART_GTEST_exception_test_DEX_DEPS :=
656ART_GTEST_elf_writer_test_HOST_DEPS :=
657ART_GTEST_elf_writer_test_TARGET_DEPS :=
658ART_GTEST_jni_compiler_test_DEX_DEPS :=
659ART_GTEST_jni_internal_test_DEX_DEPS :=
Richard Uhler66d874d2015-01-15 09:37:19 -0800660ART_GTEST_oat_file_assistant_test_DEX_DEPS :=
661ART_GTEST_oat_file_assistant_test_HOST_DEPS :=
662ART_GTEST_oat_file_assistant_test_TARGET_DEPS :=
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700663ART_GTEST_object_test_DEX_DEPS :=
664ART_GTEST_proxy_test_DEX_DEPS :=
665ART_GTEST_reflection_test_DEX_DEPS :=
666ART_GTEST_stub_test_DEX_DEPS :=
667ART_GTEST_transaction_test_DEX_DEPS :=
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800668ART_VALGRIND_DEPENDENCIES :=
Ian Rogers1a2f84e2014-07-07 16:05:18 -0700669$(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval ART_TEST_TARGET_GTEST_$(dir)_DEX :=))
670$(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval ART_TEST_HOST_GTEST_$(dir)_DEX :=))
Richard Uhler66d874d2015-01-15 09:37:19 -0800671ART_TEST_HOST_GTEST_MainStripped_DEX :=
672ART_TEST_TARGET_GTEST_MainStripped_DEX :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700673GTEST_DEX_DIRECTORIES :=
Brian Carlstrom532714a2014-06-25 02:15:31 -0700674LOCAL_PATH :=