blob: bc5695ab96e8764ee7e427c014674e69f8239565 [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
Alex Light50fa9932015-08-10 15:30:07 -070022include art/build/Android.common_build.mk
Ian Rogersafd9acc2014-06-17 08:21:54 -070023
24# Subdirectories in art/test which contain dex files used as inputs for gtests.
25GTEST_DEX_DIRECTORIES := \
26 AbstractMethod \
27 AllFields \
28 ExceptionHandle \
29 GetMethodSignature \
Sebastien Hertz0462c4c2015-04-01 16:34:17 +020030 Instrumentation \
Ian Rogersafd9acc2014-06-17 08:21:54 -070031 Interfaces \
Igor Murashkin457e8742015-10-22 17:37:50 -070032 LambdaInterfaces \
Artem Udovichenkod9786b02015-10-14 16:36:55 +030033 Lookup \
Ian Rogersafd9acc2014-06-17 08:21:54 -070034 Main \
Richard Uhler66d874d2015-01-15 09:37:19 -080035 MultiDex \
Richard Uhler67ff7d12015-05-14 13:21:13 -070036 MultiDexModifiedSecondary \
Ian Rogersafd9acc2014-06-17 08:21:54 -070037 MyClass \
38 MyClassNatives \
39 Nested \
40 NonStaticLeafMethods \
41 ProtoCompare \
42 ProtoCompare2 \
43 StaticLeafMethods \
44 Statics \
45 StaticsFromCode \
46 Transaction \
47 XandY
48
49# Create build rules for each dex file recording the dependency.
50$(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval $(call build-art-test-dex,art-gtest,$(dir), \
Ian Rogers1a2f84e2014-07-07 16:05:18 -070051 $(ART_TARGET_NATIVETEST_OUT),art/build/Android.gtest.mk,ART_TEST_TARGET_GTEST_$(dir)_DEX, \
52 ART_TEST_HOST_GTEST_$(dir)_DEX)))
Ian Rogersafd9acc2014-06-17 08:21:54 -070053
Richard Uhler66d874d2015-01-15 09:37:19 -080054# Create rules for MainStripped, a copy of Main with the classes.dex stripped
55# for the oat file assistant tests.
56ART_TEST_HOST_GTEST_MainStripped_DEX := $(basename $(ART_TEST_HOST_GTEST_Main_DEX))Stripped$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
57ART_TEST_TARGET_GTEST_MainStripped_DEX := $(basename $(ART_TEST_TARGET_GTEST_Main_DEX))Stripped$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))
58
59$(ART_TEST_HOST_GTEST_MainStripped_DEX): $(ART_TEST_HOST_GTEST_Main_DEX)
60 cp $< $@
61 $(call dexpreopt-remove-classes.dex,$@)
62
63$(ART_TEST_TARGET_GTEST_MainStripped_DEX): $(ART_TEST_TARGET_GTEST_Main_DEX)
64 cp $< $@
65 $(call dexpreopt-remove-classes.dex,$@)
66
Ian Rogersafd9acc2014-06-17 08:21:54 -070067# Dex file dependencies for each gtest.
Andreas Gampe81c6f8d2015-03-25 17:19:53 -070068ART_GTEST_class_linker_test_DEX_DEPS := Interfaces MultiDex MyClass Nested Statics StaticsFromCode
Andreas Gampe70bef0d2015-04-15 02:37:28 -070069ART_GTEST_compiler_driver_test_DEX_DEPS := AbstractMethod StaticLeafMethods
Mathieu Chartierd57d4542015-10-14 10:55:30 -070070ART_GTEST_dex_cache_test_DEX_DEPS := Main
Andreas Gampeda823442014-11-03 15:36:53 -080071ART_GTEST_dex_file_test_DEX_DEPS := GetMethodSignature Main Nested
Brian Carlstromeb85f2b2014-06-25 13:23:00 -070072ART_GTEST_exception_test_DEX_DEPS := ExceptionHandle
Sebastien Hertz0462c4c2015-04-01 16:34:17 +020073ART_GTEST_instrumentation_test_DEX_DEPS := Instrumentation
Brian Carlstromeb85f2b2014-06-25 13:23:00 -070074ART_GTEST_jni_compiler_test_DEX_DEPS := MyClassNatives
75ART_GTEST_jni_internal_test_DEX_DEPS := AllFields StaticLeafMethods
Richard Uhler67ff7d12015-05-14 13:21:13 -070076ART_GTEST_oat_file_assistant_test_DEX_DEPS := Main MainStripped MultiDex MultiDexModifiedSecondary Nested
Andreas Gampe7848da42015-04-09 11:15:04 -070077ART_GTEST_oat_file_test_DEX_DEPS := Main MultiDex
Mathieu Chartier07ddb6f2015-11-05 11:16:34 -080078ART_GTEST_oat_test_DEX_DEPS := Main
Brian Carlstromeb85f2b2014-06-25 13:23:00 -070079ART_GTEST_object_test_DEX_DEPS := ProtoCompare ProtoCompare2 StaticsFromCode XandY
80ART_GTEST_proxy_test_DEX_DEPS := Interfaces
Igor Murashkin457e8742015-10-22 17:37:50 -070081ART_GTEST_lambda_proxy_test_DEX_DEPS := LambdaInterfaces
Brian Carlstromeb85f2b2014-06-25 13:23:00 -070082ART_GTEST_reflection_test_DEX_DEPS := Main NonStaticLeafMethods StaticLeafMethods
83ART_GTEST_stub_test_DEX_DEPS := AllFields
84ART_GTEST_transaction_test_DEX_DEPS := Transaction
Artem Udovichenkod9786b02015-10-14 16:36:55 +030085ART_GTEST_type_lookup_table_test_DEX_DEPS := Lookup
Ian Rogersafd9acc2014-06-17 08:21:54 -070086
87# The elf writer test has dependencies on core.oat.
Andreas Gampec23c9c92014-10-28 14:47:25 -070088ART_GTEST_elf_writer_test_HOST_DEPS := $(HOST_CORE_IMAGE_default_no-pic_64) $(HOST_CORE_IMAGE_default_no-pic_32)
89ART_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 -080090
Richard Uhler9a44f872015-03-12 12:35:43 -070091ART_GTEST_oat_file_assistant_test_HOST_DEPS := \
92 $(HOST_CORE_IMAGE_default_no-pic_64) \
93 $(HOST_CORE_IMAGE_default_no-pic_32) \
94 $(HOST_OUT_EXECUTABLES)/patchoatd
95ART_GTEST_oat_file_assistant_test_TARGET_DEPS := \
96 $(TARGET_CORE_IMAGE_default_no-pic_64) \
97 $(TARGET_CORE_IMAGE_default_no-pic_32) \
98 $(TARGET_OUT_EXECUTABLES)/patchoatd
Richard Uhler66d874d2015-01-15 09:37:19 -080099
Brian Carlstrom53463ea2014-11-09 14:11:51 -0800100# TODO: document why this is needed.
Andreas Gampec23c9c92014-10-28 14:47:25 -0700101ART_GTEST_proxy_test_HOST_DEPS := $(HOST_CORE_IMAGE_default_no-pic_64) $(HOST_CORE_IMAGE_default_no-pic_32)
Igor Murashkin457e8742015-10-22 17:37:50 -0700102ART_GTEST_lambda_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 -0700103
Aart Bikcfbe53c2015-07-06 14:27:27 -0700104# The dexdump test requires an image and the dexdump utility.
Aart Bik22c26f52015-07-08 21:20:13 +0000105# TODO: rename into dexdump when migration completes
Aart Bikcfbe53c2015-07-06 14:27:27 -0700106ART_GTEST_dexdump_test_HOST_DEPS := \
107 $(HOST_CORE_IMAGE_default_no-pic_64) \
108 $(HOST_CORE_IMAGE_default_no-pic_32) \
Aart Bik22c26f52015-07-08 21:20:13 +0000109 $(HOST_OUT_EXECUTABLES)/dexdump2
Aart Bikcfbe53c2015-07-06 14:27:27 -0700110ART_GTEST_dexdump_test_TARGET_DEPS := \
111 $(TARGET_CORE_IMAGE_default_no-pic_64) \
112 $(TARGET_CORE_IMAGE_default_no-pic_32) \
Aart Bik22c26f52015-07-08 21:20:13 +0000113 dexdump2
Aart Bikcfbe53c2015-07-06 14:27:27 -0700114
Aart Bik3e40f4a2015-07-07 17:09:41 -0700115# The dexlist test requires an image and the dexlist utility.
Aart Bik3e40f4a2015-07-07 17:09:41 -0700116ART_GTEST_dexlist_test_HOST_DEPS := \
117 $(HOST_CORE_IMAGE_default_no-pic_64) \
118 $(HOST_CORE_IMAGE_default_no-pic_32) \
Aart Bikb1b45be2015-08-28 11:09:29 -0700119 $(HOST_OUT_EXECUTABLES)/dexlist
Aart Bik3e40f4a2015-07-07 17:09:41 -0700120ART_GTEST_dexlist_test_TARGET_DEPS := \
121 $(TARGET_CORE_IMAGE_default_no-pic_64) \
122 $(TARGET_CORE_IMAGE_default_no-pic_32) \
Aart Bikb1b45be2015-08-28 11:09:29 -0700123 dexlist
Aart Bik3e40f4a2015-07-07 17:09:41 -0700124
Igor Murashkin37743352014-11-13 14:38:00 -0800125# The imgdiag test has dependencies on core.oat since it needs to load it during the test.
Andreas Gampec93b8b52014-12-19 23:12:25 -0800126# For the host, also add the installed tool (in the base size, that should suffice). For the
127# target, just the module is fine, the sync will happen late enough.
128ART_GTEST_imgdiag_test_HOST_DEPS := \
129 $(HOST_CORE_IMAGE_default_no-pic_64) \
130 $(HOST_CORE_IMAGE_default_no-pic_32) \
131 $(HOST_OUT_EXECUTABLES)/imgdiagd
132ART_GTEST_imgdiag_test_TARGET_DEPS := \
133 $(TARGET_CORE_IMAGE_default_no-pic_64) \
134 $(TARGET_CORE_IMAGE_default_no-pic_32) \
135 imgdiagd
Igor Murashkin37743352014-11-13 14:38:00 -0800136
Mathieu Chartierea216b32015-05-26 19:48:16 -0700137# Oatdump test requires an image and oatfile to dump.
138ART_GTEST_oatdump_test_HOST_DEPS := \
139 $(HOST_CORE_IMAGE_default_no-pic_64) \
140 $(HOST_CORE_IMAGE_default_no-pic_32) \
141 $(HOST_OUT_EXECUTABLES)/oatdumpd
142ART_GTEST_oatdump_test_TARGET_DEPS := \
143 $(TARGET_CORE_IMAGE_default_no-pic_64) \
144 $(TARGET_CORE_IMAGE_default_no-pic_32) \
145 oatdump
146
Ian Rogersafd9acc2014-06-17 08:21:54 -0700147# The path for which all the source files are relative, not actually the current directory.
Brian Carlstrom7940e442013-07-12 13:46:57 -0700148LOCAL_PATH := art
149
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800150RUNTIME_GTEST_COMMON_SRC_FILES := \
Igor Murashkinaaebaa02015-01-26 10:55:53 -0800151 cmdline/cmdline_parser_test.cc \
Aart Bik69ae54a2015-07-01 14:52:26 -0700152 dexdump/dexdump_test.cc \
Aart Bik3e40f4a2015-07-07 17:09:41 -0700153 dexlist/dexlist_test.cc \
Igor Murashkin37743352014-11-13 14:38:00 -0800154 imgdiag/imgdiag_test.cc \
Mathieu Chartier19510f02015-05-26 14:44:35 -0700155 oatdump/oatdump_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700156 runtime/arch/arch_test.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800157 runtime/arch/instruction_set_test.cc \
158 runtime/arch/instruction_set_features_test.cc \
Serban Constantinescu86797a72014-06-19 16:17:56 +0100159 runtime/arch/memcmp16_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700160 runtime/arch/stub_test.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800161 runtime/arch/arm/instruction_set_features_arm_test.cc \
162 runtime/arch/arm64/instruction_set_features_arm64_test.cc \
163 runtime/arch/mips/instruction_set_features_mips_test.cc \
Andreas Gampe57b34292015-01-14 15:45:59 -0800164 runtime/arch/mips64/instruction_set_features_mips64_test.cc \
Ian Rogersd582fa42014-11-05 23:46:43 -0800165 runtime/arch/x86/instruction_set_features_x86_test.cc \
166 runtime/arch/x86_64/instruction_set_features_x86_64_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700167 runtime/barrier_test.cc \
168 runtime/base/bit_field_test.cc \
Vladimir Marko80afd022015-05-19 18:08:00 +0100169 runtime/base/bit_utils_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700170 runtime/base/bit_vector_test.cc \
Mathieu Chartierc2e20622014-11-03 11:41:47 -0800171 runtime/base/hash_set_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700172 runtime/base/hex_dump_test.cc \
173 runtime/base/histogram_test.cc \
174 runtime/base/mutex_test.cc \
175 runtime/base/scoped_flock_test.cc \
Brian Carlstrom2cbaccb2014-09-14 20:34:17 -0700176 runtime/base/stringprintf_test.cc \
Vladimir Marko80afd022015-05-19 18:08:00 +0100177 runtime/base/time_utils_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700178 runtime/base/timing_logger_test.cc \
Igor Murashkinaaebaa02015-01-26 10:55:53 -0800179 runtime/base/variant_map_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700180 runtime/base/unix_file/fd_file_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700181 runtime/class_linker_test.cc \
182 runtime/dex_file_test.cc \
183 runtime/dex_file_verifier_test.cc \
Aart Bikb1f37532015-06-29 11:03:55 -0700184 runtime/dex_instruction_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700185 runtime/dex_instruction_visitor_test.cc \
186 runtime/dex_method_iterator_test.cc \
187 runtime/entrypoints/math_entrypoints_test.cc \
188 runtime/entrypoints/quick/quick_trampoline_entrypoints_test.cc \
189 runtime/entrypoints_order_test.cc \
190 runtime/exception_test.cc \
Mathieu Chartier2c265012014-08-05 18:15:56 -0700191 runtime/gc/accounting/card_table_test.cc \
Mathieu Chartier4858a932015-01-23 13:18:53 -0800192 runtime/gc/accounting/mod_union_table_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700193 runtime/gc/accounting/space_bitmap_test.cc \
Mathieu Chartier763a31e2015-11-16 16:05:55 -0800194 runtime/gc/collector/immune_spaces_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700195 runtime/gc/heap_test.cc \
Mathieu Chartier9e2094f2014-12-11 18:43:48 -0800196 runtime/gc/reference_queue_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700197 runtime/gc/space/dlmalloc_space_base_test.cc \
198 runtime/gc/space/dlmalloc_space_static_test.cc \
199 runtime/gc/space/dlmalloc_space_random_test.cc \
200 runtime/gc/space/rosalloc_space_base_test.cc \
201 runtime/gc/space/rosalloc_space_static_test.cc \
202 runtime/gc/space/rosalloc_space_random_test.cc \
203 runtime/gc/space/large_object_space_test.cc \
Mathieu Chartiera5eae692014-12-17 17:56:03 -0800204 runtime/gc/task_processor_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700205 runtime/gtest_test.cc \
206 runtime/handle_scope_test.cc \
207 runtime/indenter_test.cc \
208 runtime/indirect_reference_table_test.cc \
Sebastien Hertz0462c4c2015-04-01 16:34:17 +0200209 runtime/instrumentation_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700210 runtime/intern_table_test.cc \
Ian Rogers5ac814a2014-11-04 16:39:32 -0800211 runtime/interpreter/safe_math_test.cc \
Andreas Gampe799681b2015-05-15 19:24:12 -0700212 runtime/interpreter/unstarted_runtime_test.cc \
Ian Rogersf4d4da12014-11-11 16:10:33 -0800213 runtime/java_vm_ext_test.cc \
Igor Murashkinfc1ccd72015-07-30 15:11:09 -0700214 runtime/lambda/closure_test.cc \
215 runtime/lambda/shorty_field_type_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700216 runtime/leb128_test.cc \
217 runtime/mem_map_test.cc \
Roland Levillaina2d8ec62015-03-12 15:25:29 +0000218 runtime/memory_region_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700219 runtime/mirror/dex_cache_test.cc \
220 runtime/mirror/object_test.cc \
Andreas Gampe74240812014-04-17 10:35:09 -0700221 runtime/monitor_pool_test.cc \
Elena Sayapina1af6a1f2014-06-20 16:58:37 +0700222 runtime/monitor_test.cc \
Richard Uhlere5fed032015-03-18 08:21:11 -0700223 runtime/oat_file_test.cc \
Richard Uhler66d874d2015-01-15 09:37:19 -0800224 runtime/oat_file_assistant_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700225 runtime/parsed_options_test.cc \
David Srbecky3e52aa42015-04-12 07:45:18 +0100226 runtime/prebuilt_tools_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700227 runtime/reference_table_test.cc \
228 runtime/thread_pool_test.cc \
229 runtime/transaction_test.cc \
Artem Udovichenkod9786b02015-10-14 16:36:55 +0300230 runtime/type_lookup_table_test.cc \
Narayan Kamatha5afcfc2015-01-29 20:06:46 +0000231 runtime/utf_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700232 runtime/utils_test.cc \
233 runtime/verifier/method_verifier_test.cc \
234 runtime/verifier/reg_type_test.cc \
235 runtime/zip_archive_test.cc
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800236
237COMPILER_GTEST_COMMON_SRC_FILES := \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700238 runtime/jni_internal_test.cc \
Igor Murashkin457e8742015-10-22 17:37:50 -0700239 runtime/lambda_proxy_test.cc \
Jeff Haodb8a6642014-08-14 17:18:52 -0700240 runtime/proxy_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700241 runtime/reflection_test.cc \
Vladimir Marko35831e82015-09-11 11:59:18 +0100242 compiler/compiled_method_test.cc \
Vladimir Marko7a01dc22015-01-02 17:00:44 +0000243 compiler/dex/gvn_dead_code_elimination_test.cc \
Vladimir Marko95a05972014-05-30 10:01:32 +0100244 compiler/dex/global_value_numbering_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700245 compiler/dex/local_value_numbering_test.cc \
Vladimir Marko55fff042014-07-10 12:42:52 +0100246 compiler/dex/mir_graph_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700247 compiler/dex/mir_optimization_test.cc \
Vladimir Markoc91df2d2015-04-23 09:29:21 +0000248 compiler/dex/type_inference_test.cc \
David Srbecky15c19752015-03-31 14:53:55 +0000249 compiler/dwarf/dwarf_test.cc \
Vladimir Marko35831e82015-09-11 11:59:18 +0100250 compiler/driver/compiled_method_storage_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700251 compiler/driver/compiler_driver_test.cc \
252 compiler/elf_writer_test.cc \
253 compiler/image_test.cc \
254 compiler/jni/jni_compiler_test.cc \
255 compiler/oat_test.cc \
Mingyao Yangf384f882014-10-22 16:08:18 -0700256 compiler/optimizing/bounds_check_elimination_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700257 compiler/optimizing/dominator_test.cc \
258 compiler/optimizing/find_loops_test.cc \
Roland Levillainccc07a92014-09-16 14:48:16 +0100259 compiler/optimizing/graph_checker_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700260 compiler/optimizing/graph_test.cc \
Nicolas Geoffrayd31cf3d2014-09-08 17:30:24 +0100261 compiler/optimizing/gvn_test.cc \
Aart Bik30efb4e2015-07-30 12:14:31 -0700262 compiler/optimizing/induction_var_analysis_test.cc \
Aart Bik22af3be2015-09-10 12:50:58 -0700263 compiler/optimizing/induction_var_range_test.cc \
Aart Bik3f307f32015-07-21 18:30:18 -0700264 compiler/optimizing/licm_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700265 compiler/optimizing/live_interval_test.cc \
Nicolas Geoffray724c9632014-09-22 12:27:27 +0100266 compiler/optimizing/nodes_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700267 compiler/optimizing/parallel_move_test.cc \
268 compiler/optimizing/pretty_printer_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 \
Alex Light50fa9932015-08-10 15:30:07 -0700278
279COMPILER_GTEST_COMMON_SRC_FILES_all := \
280 compiler/dex/quick/quick_cfi_test.cc \
281 compiler/jni/jni_cfi_test.cc \
282 compiler/optimizing/codegen_test.cc \
283 compiler/optimizing/constant_folding_test.cc \
284 compiler/optimizing/dead_code_elimination_test.cc \
285 compiler/optimizing/linearize_test.cc \
286 compiler/optimizing/liveness_test.cc \
287 compiler/optimizing/live_ranges_test.cc \
288 compiler/optimizing/optimizing_cfi_test.cc \
289 compiler/optimizing/register_allocator_test.cc \
290
291COMPILER_GTEST_COMMON_SRC_FILES_arm := \
292 compiler/linker/arm/relative_patcher_thumb2_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700293 compiler/utils/arm/managed_register_arm_test.cc \
Alex Light50fa9932015-08-10 15:30:07 -0700294
295COMPILER_GTEST_COMMON_SRC_FILES_arm64 := \
296 compiler/linker/arm64/relative_patcher_arm64_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700297 compiler/utils/arm64/managed_register_arm64_test.cc \
Alex Light50fa9932015-08-10 15:30:07 -0700298
299COMPILER_GTEST_COMMON_SRC_FILES_mips := \
300
301COMPILER_GTEST_COMMON_SRC_FILES_mips64 := \
302
303COMPILER_GTEST_COMMON_SRC_FILES_x86 := \
304 compiler/linker/x86/relative_patcher_x86_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700305 compiler/utils/x86/managed_register_x86_test.cc \
Brian Carlstrom51c24672013-07-11 16:00:56 -0700306
Alex Light50fa9932015-08-10 15:30:07 -0700307COMPILER_GTEST_COMMON_SRC_FILES_x86_64 := \
308 compiler/linker/x86_64/relative_patcher_x86_64_test.cc \
309
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800310RUNTIME_GTEST_TARGET_SRC_FILES := \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700311 $(RUNTIME_GTEST_COMMON_SRC_FILES)
Brian Carlstrom51c24672013-07-11 16:00:56 -0700312
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800313RUNTIME_GTEST_HOST_SRC_FILES := \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700314 $(RUNTIME_GTEST_COMMON_SRC_FILES)
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800315
316COMPILER_GTEST_TARGET_SRC_FILES := \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700317 $(COMPILER_GTEST_COMMON_SRC_FILES)
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800318
Alex Light50fa9932015-08-10 15:30:07 -0700319COMPILER_GTEST_TARGET_SRC_FILES_all := \
320 $(COMPILER_GTEST_COMMON_SRC_FILES_all) \
321
322COMPILER_GTEST_TARGET_SRC_FILES_arm := \
323 $(COMPILER_GTEST_COMMON_SRC_FILES_arm) \
324
325COMPILER_GTEST_TARGET_SRC_FILES_arm64 := \
326 $(COMPILER_GTEST_COMMON_SRC_FILES_arm64) \
327
328COMPILER_GTEST_TARGET_SRC_FILES_mips := \
329 $(COMPILER_GTEST_COMMON_SRC_FILES_mips) \
330
331COMPILER_GTEST_TARGET_SRC_FILES_mips64 := \
332 $(COMPILER_GTEST_COMMON_SRC_FILES_mips64) \
333
334COMPILER_GTEST_TARGET_SRC_FILES_x86 := \
335 $(COMPILER_GTEST_COMMON_SRC_FILES_x86) \
336
337COMPILER_GTEST_TARGET_SRC_FILES_x86_64 := \
338 $(COMPILER_GTEST_COMMON_SRC_FILES_x86_64) \
339
340$(foreach arch,$(ART_TARGET_CODEGEN_ARCHS),$(eval COMPILER_GTEST_TARGET_SRC_FILES += $$(COMPILER_GTEST_TARGET_SRC_FILES_$(arch))))
341ifeq (true,$(ART_TARGET_COMPILER_TESTS))
342 COMPILER_GTEST_TARGET_SRC_FILES += $(COMPILER_GTEST_TARGET_SRC_FILES_all)
343endif
344
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800345COMPILER_GTEST_HOST_SRC_FILES := \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700346 $(COMPILER_GTEST_COMMON_SRC_FILES) \
Alex Light50fa9932015-08-10 15:30:07 -0700347
348COMPILER_GTEST_HOST_SRC_FILES_all := \
349 $(COMPILER_GTEST_COMMON_SRC_FILES_all) \
350
351COMPILER_GTEST_HOST_SRC_FILES_arm := \
352 $(COMPILER_GTEST_COMMON_SRC_FILES_arm) \
Roland Levillain1a28fc42014-11-13 18:03:06 +0000353 compiler/utils/arm/assembler_arm32_test.cc \
354 compiler/utils/arm/assembler_thumb2_test.cc \
355 compiler/utils/assembler_thumb_test.cc \
Alex Light50fa9932015-08-10 15:30:07 -0700356
357COMPILER_GTEST_HOST_SRC_FILES_arm64 := \
358 $(COMPILER_GTEST_COMMON_SRC_FILES_arm64) \
359
360COMPILER_GTEST_HOST_SRC_FILES_mips := \
361 $(COMPILER_GTEST_COMMON_SRC_FILES_mips) \
Goran Jakovljevic8c434dc2015-08-26 14:39:44 +0200362 compiler/utils/mips/assembler_mips_test.cc \
Alex Light50fa9932015-08-10 15:30:07 -0700363
364COMPILER_GTEST_HOST_SRC_FILES_mips64 := \
365 $(COMPILER_GTEST_COMMON_SRC_FILES_mips64) \
Chris Larsendbce0d72015-09-17 13:34:00 -0700366 compiler/utils/mips64/assembler_mips64_test.cc \
Alex Light50fa9932015-08-10 15:30:07 -0700367
368COMPILER_GTEST_HOST_SRC_FILES_x86 := \
369 $(COMPILER_GTEST_COMMON_SRC_FILES_x86) \
370 compiler/dex/quick/x86/quick_assemble_x86_test.cc \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700371 compiler/utils/x86/assembler_x86_test.cc \
Alex Light50fa9932015-08-10 15:30:07 -0700372
373COMPILER_GTEST_HOST_SRC_FILES_x86_64 := \
374 $(COMPILER_GTEST_COMMON_SRC_FILES_x86_64) \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700375 compiler/utils/x86_64/assembler_x86_64_test.cc
Brian Carlstrom8ecd08c2011-07-27 17:50:51 -0700376
Alex Light50fa9932015-08-10 15:30:07 -0700377$(foreach arch,$(ART_HOST_CODEGEN_ARCHS),$(eval COMPILER_GTEST_HOST_SRC_FILES += $$(COMPILER_GTEST_HOST_SRC_FILES_$(arch))))
378ifeq (true,$(ART_HOST_COMPILER_TESTS))
379 COMPILER_GTEST_HOST_SRC_FILES += $(COMPILER_GTEST_HOST_SRC_FILES_all)
380endif
381
Shih-wei Liaoc4c98812012-03-10 21:55:51 -0800382ART_TEST_CFLAGS :=
buzbee2cfc6392012-05-07 14:51:40 -0700383
Ian Rogerse63db272014-07-15 15:36:11 -0700384include $(CLEAR_VARS)
385LOCAL_MODULE := libart-gtest
386LOCAL_MODULE_TAGS := optional
387LOCAL_CPP_EXTENSION := cc
Ian Rogerse63db272014-07-15 15:36:11 -0700388LOCAL_SRC_FILES := runtime/common_runtime_test.cc compiler/common_compiler_test.cc
389LOCAL_C_INCLUDES := $(ART_C_INCLUDES) art/runtime art/compiler
Ian Rogers872dd822014-10-30 11:19:14 -0700390LOCAL_SHARED_LIBRARIES := libartd libartd-compiler libdl
Dan Albertfd84f662014-11-11 18:53:41 -0800391LOCAL_STATIC_LIBRARIES += libgtest
Ian Rogerse63db272014-07-15 15:36:11 -0700392LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
393LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk
Andreas Gampebced67d2015-01-07 14:35:44 -0800394$(eval $(call set-target-local-clang-vars))
395$(eval $(call set-target-local-cflags-vars,debug))
Andreas Gampe9b14dc32015-04-06 15:35:02 -0700396LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
Ian Rogerse63db272014-07-15 15:36:11 -0700397include $(BUILD_SHARED_LIBRARY)
398
399include $(CLEAR_VARS)
400LOCAL_MODULE := libart-gtest
401LOCAL_MODULE_TAGS := optional
402LOCAL_CPP_EXTENSION := cc
403LOCAL_CFLAGS := $(ART_HOST_CFLAGS)
Roland Levillain12bd7212015-06-04 17:50:27 +0100404LOCAL_ASFLAGS := $(ART_HOST_ASFLAGS)
Ian Rogerse63db272014-07-15 15:36:11 -0700405LOCAL_SRC_FILES := runtime/common_runtime_test.cc compiler/common_compiler_test.cc
406LOCAL_C_INCLUDES := $(ART_C_INCLUDES) art/runtime art/compiler
407LOCAL_SHARED_LIBRARIES := libartd libartd-compiler
Nicolas Geoffray10fc34b2014-11-10 21:38:15 +0000408LOCAL_STATIC_LIBRARIES := libgtest_host
Ian Rogerse63db272014-07-15 15:36:11 -0700409LOCAL_LDLIBS += -ldl -lpthread
410LOCAL_MULTILIB := both
411LOCAL_CLANG := $(ART_HOST_CLANG)
Andreas Gampe9b14dc32015-04-06 15:35:02 -0700412LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
Ian Rogerse63db272014-07-15 15:36:11 -0700413LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
414LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk
Ian Rogerse63db272014-07-15 15:36:11 -0700415include $(BUILD_HOST_SHARED_LIBRARY)
416
Ian Rogersafd9acc2014-06-17 08:21:54 -0700417# Variables holding collections of gtest pre-requisits used to run a number of gtests.
418ART_TEST_HOST_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
419ART_TEST_HOST_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
420ART_TEST_HOST_GTEST_RULES :=
421ART_TEST_HOST_VALGRIND_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
422ART_TEST_HOST_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
423ART_TEST_HOST_VALGRIND_GTEST_RULES :=
424ART_TEST_TARGET_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
425ART_TEST_TARGET_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
426ART_TEST_TARGET_GTEST_RULES :=
Nicolas Geoffray58035ae2015-05-27 19:10:27 +0100427ART_TEST_HOST_GTEST_DEPENDENCIES :=
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700428
Nicolas Geoffray96a37c82014-10-29 23:50:40 +0000429ART_GTEST_TARGET_ANDROID_ROOT := '/system'
430ifneq ($(ART_TEST_ANDROID_ROOT),)
431 ART_GTEST_TARGET_ANDROID_ROOT := $(ART_TEST_ANDROID_ROOT)
432endif
433
Ian Rogersafd9acc2014-06-17 08:21:54 -0700434# Define a make rule for a target device gtest.
435# $(1): gtest name - the name of the test we're building such as leb128_test.
436# $(2): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000437# $(3): LD_LIBRARY_PATH or undefined - used in case libartd.so is not in /system/lib/
Ian Rogersafd9acc2014-06-17 08:21:54 -0700438define define-art-gtest-rule-target
439 gtest_rule := test-art-target-gtest-$(1)$$($(2)ART_PHONY_TEST_TARGET_SUFFIX)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700440
Brian Carlstrom532714a2014-06-25 02:15:31 -0700441 # Add the test dependencies to test-art-target-sync, which will be a prerequisite for the test
Ian Rogersafd9acc2014-06-17 08:21:54 -0700442 # to ensure files are pushed to the device.
443 TEST_ART_TARGET_SYNC_DEPS += \
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700444 $$(ART_GTEST_$(1)_TARGET_DEPS) \
Ian Rogers1a2f84e2014-07-07 16:05:18 -0700445 $(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_TARGET_GTEST_$(file)_DEX)) \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700446 $$(ART_TARGET_NATIVETEST_OUT)/$$(TARGET_$(2)ARCH)/$(1) \
Nicolas Geoffray96a63452014-10-30 12:13:17 +0000447 $$($(2)TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so \
Narayan Kamathd7b3c7f2015-11-18 09:49:10 +0000448 $$($(2)TARGET_OUT_SHARED_LIBRARIES)/libopenjdk.so \
Narayan Kamathd50687e2015-11-17 12:37:27 +0000449 $$(TARGET_OUT_JAVA_LIBRARIES)/core-libart.jar \
450 $$(TARGET_OUT_JAVA_LIBRARIES)/core-oj.jar
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700451
Ian Rogersafd9acc2014-06-17 08:21:54 -0700452.PHONY: $$(gtest_rule)
453$$(gtest_rule): test-art-target-sync
454 $(hide) adb shell touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID
455 $(hide) adb shell rm $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID
456 $(hide) adb shell chmod 755 $(ART_TARGET_NATIVETEST_DIR)/$(TARGET_$(2)ARCH)/$(1)
457 $(hide) $$(call ART_TEST_SKIP,$$@) && \
Dan Albert31fb2602014-09-30 22:10:10 -0700458 (adb shell "$(GCOV_ENV) LD_LIBRARY_PATH=$(3) ANDROID_ROOT=$(ART_GTEST_TARGET_ANDROID_ROOT) \
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000459 $(ART_TARGET_NATIVETEST_DIR)/$(TARGET_$(2)ARCH)/$(1) && touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID" \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700460 && (adb pull $(ART_TARGET_TEST_DIR)/$(TARGET_$(2)ARCH)/$$@-$$$$PPID /tmp/ \
461 && $$(call ART_TEST_PASSED,$$@)) \
462 || $$(call ART_TEST_FAILED,$$@))
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700463 $(hide) rm -f /tmp/$$@-$$$$PPID
Ian Rogersafd9acc2014-06-17 08:21:54 -0700464
465 ART_TEST_TARGET_GTEST$($(2)ART_PHONY_TEST_TARGET_SUFFIX)_RULES += $$(gtest_rule)
466 ART_TEST_TARGET_GTEST_RULES += $$(gtest_rule)
467 ART_TEST_TARGET_GTEST_$(1)_RULES += $$(gtest_rule)
468
469 # Clear locally defined variables.
470 gtest_rule :=
471endef # define-art-gtest-rule-target
472
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800473ART_VALGRIND_DEPENDENCIES := \
474 $(HOST_OUT_EXECUTABLES)/valgrind \
475 $(HOST_OUT)/lib64/valgrind/memcheck-amd64-linux \
476 $(HOST_OUT)/lib64/valgrind/memcheck-x86-linux \
477 $(HOST_OUT)/lib64/valgrind/default.supp \
478 $(HOST_OUT)/lib64/valgrind/vgpreload_core-amd64-linux.so \
479 $(HOST_OUT)/lib64/valgrind/vgpreload_core-x86-linux.so \
480 $(HOST_OUT)/lib64/valgrind/vgpreload_memcheck-amd64-linux.so \
481 $(HOST_OUT)/lib64/valgrind/vgpreload_memcheck-x86-linux.so
482
Ian Rogersafd9acc2014-06-17 08:21:54 -0700483# Define make rules for a host gtests.
484# $(1): gtest name - the name of the test we're building such as leb128_test.
485# $(2): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
486define define-art-gtest-rule-host
487 gtest_rule := test-art-host-gtest-$(1)$$($(2)ART_PHONY_TEST_HOST_SUFFIX)
488 gtest_exe := $$(HOST_OUT_EXECUTABLES)/$(1)$$($(2)ART_PHONY_TEST_HOST_SUFFIX)
Ian Rogers665de8a2014-06-24 21:34:09 -0700489 # Dependencies for all host gtests.
490 gtest_deps := $$(HOST_CORE_DEX_LOCATIONS) \
Nicolas Geoffray58035ae2015-05-27 19:10:27 +0100491 $$($(2)ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$$(ART_HOST_SHLIB_EXTENSION) \
Przemyslaw Szczepaniak121b25e2015-11-20 11:24:33 +0000492 $$($(2)ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdk$$(ART_HOST_SHLIB_EXTENSION) \
Nicolas Geoffray58035ae2015-05-27 19:10:27 +0100493 $$(gtest_exe) \
494 $$(ART_GTEST_$(1)_HOST_DEPS) \
495 $(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_HOST_GTEST_$(file)_DEX))
Ian Rogers665de8a2014-06-24 21:34:09 -0700496
Nicolas Geoffray58035ae2015-05-27 19:10:27 +0100497 ART_TEST_HOST_GTEST_DEPENDENCIES += $$(gtest_deps)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700498
499.PHONY: $$(gtest_rule)
Nicolas Geoffray0f7c06d2015-05-28 10:21:03 +0100500$$(gtest_rule): $$(gtest_exe) $$(gtest_deps)
Dmitriy Ivanov8508a432014-10-14 11:38:46 -0700501 $(hide) ($$(call ART_TEST_SKIP,$$@) && $$< && $$(call ART_TEST_PASSED,$$@)) \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700502 || $$(call ART_TEST_FAILED,$$@)
503
504 ART_TEST_HOST_GTEST$$($(2)ART_PHONY_TEST_HOST_SUFFIX)_RULES += $$(gtest_rule)
505 ART_TEST_HOST_GTEST_RULES += $$(gtest_rule)
506 ART_TEST_HOST_GTEST_$(1)_RULES += $$(gtest_rule)
507
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800508
Ian Rogersafd9acc2014-06-17 08:21:54 -0700509.PHONY: valgrind-$$(gtest_rule)
Andreas Gampe3db36002015-05-28 20:17:09 -0700510valgrind-$$(gtest_rule): $$(gtest_exe) $$(gtest_deps) $(ART_VALGRIND_DEPENDENCIES)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700511 $(hide) $$(call ART_TEST_SKIP,$$@) && \
Andreas Gampe8df91ac2015-02-20 13:15:15 -0800512 VALGRIND_LIB=$(HOST_OUT)/lib64/valgrind \
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800513 $(HOST_OUT_EXECUTABLES)/valgrind --leak-check=full --error-exitcode=1 $$< && \
514 $$(call ART_TEST_PASSED,$$@) || $$(call ART_TEST_FAILED,$$@)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700515
516 ART_TEST_HOST_VALGRIND_GTEST$$($(2)ART_PHONY_TEST_HOST_SUFFIX)_RULES += valgrind-$$(gtest_rule)
517 ART_TEST_HOST_VALGRIND_GTEST_RULES += valgrind-$$(gtest_rule)
518 ART_TEST_HOST_VALGRIND_GTEST_$(1)_RULES += valgrind-$$(gtest_rule)
519
520 # Clear locally defined variables.
521 valgrind_gtest_rule :=
522 gtest_rule :=
523 gtest_exe :=
Ian Rogers665de8a2014-06-24 21:34:09 -0700524 gtest_deps :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700525endef # define-art-gtest-rule-host
526
527# Define the rules to build and run host and target gtests.
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700528# $(1): target or host
Brian Carlstrom0796af02011-10-12 14:31:45 -0700529# $(2): file name
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800530# $(3): extra C includes
531# $(4): extra shared libraries
Ian Rogersafd9acc2014-06-17 08:21:54 -0700532define define-art-gtest
Brian Carlstrom0796af02011-10-12 14:31:45 -0700533 ifneq ($(1),target)
534 ifneq ($(1),host)
535 $$(error expected target or host for argument 1, received $(1))
536 endif
537 endif
538
539 art_target_or_host := $(1)
540 art_gtest_filename := $(2)
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800541 art_gtest_extra_c_includes := $(3)
542 art_gtest_extra_shared_libraries := $(4)
Brian Carlstrom0796af02011-10-12 14:31:45 -0700543
Ian Rogersafd9acc2014-06-17 08:21:54 -0700544 include $$(CLEAR_VARS)
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700545 art_gtest_name := $$(notdir $$(basename $$(art_gtest_filename)))
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700546 LOCAL_MODULE := $$(art_gtest_name)
Brian Carlstrom871599a2012-09-06 13:27:49 -0700547 ifeq ($$(art_target_or_host),target)
548 LOCAL_MODULE_TAGS := tests
549 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700550 LOCAL_CPP_EXTENSION := $$(ART_CPP_EXTENSION)
Dmitriy Ivanove49a4f62014-10-20 14:11:00 -0700551 LOCAL_SRC_FILES := $$(art_gtest_filename)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700552 LOCAL_C_INCLUDES += $$(ART_C_INCLUDES) art/runtime $$(art_gtest_extra_c_includes)
Andreas Gampe0ae3bf82015-05-20 16:09:36 -0700553 LOCAL_SHARED_LIBRARIES += libartd $$(art_gtest_extra_shared_libraries) libart-gtest libartd-disassembler
Dmitriy Ivanove49a4f62014-10-20 14:11:00 -0700554 LOCAL_WHOLE_STATIC_LIBRARIES += libsigchain
Brian Carlstrom4478eb02013-07-14 21:05:57 -0700555
Ian Rogerse63db272014-07-15 15:36:11 -0700556 LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common_build.mk
557 LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk
Brian Carlstromb9cc1ca2012-01-27 00:57:42 -0800558
Elliott Hughes0f096762012-01-31 10:32:46 -0800559 # Mac OS linker doesn't understand --export-dynamic.
Ian Rogersafd9acc2014-06-17 08:21:54 -0700560 ifneq ($$(HOST_OS)-$$(art_target_or_host),darwin-host)
Elliott Hughesb264f082012-04-06 17:10:10 -0700561 # Allow jni_compiler_test to find Java_MyClassNatives_bar within itself using dlopen(NULL, ...).
562 LOCAL_LDFLAGS := -Wl,--export-dynamic -Wl,-u,Java_MyClassNatives_bar -Wl,-u,Java_MyClassNatives_sbar
Brian Carlstromcfede662012-01-29 17:25:54 -0800563 endif
Brian Carlstrom0796af02011-10-12 14:31:45 -0700564
Ian Rogersafd9acc2014-06-17 08:21:54 -0700565 LOCAL_CFLAGS := $$(ART_TEST_CFLAGS)
Brian Carlstrom0796af02011-10-12 14:31:45 -0700566 ifeq ($$(art_target_or_host),target)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700567 $$(eval $$(call set-target-local-clang-vars))
568 $$(eval $$(call set-target-local-cflags-vars,debug))
Serban Constantinescu32f5b4d2014-11-25 20:05:46 +0000569 LOCAL_SHARED_LIBRARIES += libdl libicuuc libicui18n libnativehelper libz libcutils libvixld
Ian Rogersafd9acc2014-06-17 08:21:54 -0700570 LOCAL_MODULE_PATH_32 := $$(ART_TARGET_NATIVETEST_OUT)/$$(ART_TARGET_ARCH_32)
571 LOCAL_MODULE_PATH_64 := $$(ART_TARGET_NATIVETEST_OUT)/$$(ART_TARGET_ARCH_64)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700572 LOCAL_MULTILIB := both
Andreas Gampe9b14dc32015-04-06 15:35:02 -0700573 LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
Ian Rogersafd9acc2014-06-17 08:21:54 -0700574 include $$(BUILD_EXECUTABLE)
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000575 library_path :=
576 2nd_library_path :=
577 ifneq ($$(ART_TEST_ANDROID_ROOT),)
578 ifdef TARGET_2ND_ARCH
579 2nd_library_path := $$(ART_TEST_ANDROID_ROOT)/lib
580 library_path := $$(ART_TEST_ANDROID_ROOT)/lib64
581 else
Nicolas Geoffrayc1dea4a2014-11-10 08:33:52 +0000582 ifneq ($(filter %64,$(TARGET_ARCH)),)
583 library_path := $$(ART_TEST_ANDROID_ROOT)/lib64
584 else
585 library_path := $$(ART_TEST_ANDROID_ROOT)/lib
586 endif
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000587 endif
588 endif
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700589
Ian Rogersafd9acc2014-06-17 08:21:54 -0700590 ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES :=
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700591 ifdef TARGET_2ND_ARCH
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000592 $$(eval $$(call define-art-gtest-rule-target,$$(art_gtest_name),2ND_,$$(2nd_library_path)))
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700593 endif
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000594 $$(eval $$(call define-art-gtest-rule-target,$$(art_gtest_name),,$$(library_path)))
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700595
Ian Rogersafd9acc2014-06-17 08:21:54 -0700596 # A rule to run the different architecture versions of the gtest.
597.PHONY: test-art-target-gtest-$$(art_gtest_name)
598test-art-target-gtest-$$(art_gtest_name): $$(ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES)
599 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
600
601 # Clear locally defined variables.
602 ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES :=
Brian Carlstrom0796af02011-10-12 14:31:45 -0700603 else # host
Ian Rogersafd9acc2014-06-17 08:21:54 -0700604 LOCAL_CLANG := $$(ART_HOST_CLANG)
605 LOCAL_CFLAGS += $$(ART_HOST_CFLAGS) $$(ART_HOST_DEBUG_CFLAGS)
Roland Levillain12bd7212015-06-04 17:50:27 +0100606 LOCAL_ASFLAGS += $$(ART_HOST_ASFLAGS)
Serban Constantinescu32f5b4d2014-11-25 20:05:46 +0000607 LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host libnativehelper libziparchive-host libz-host libvixld
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700608 LOCAL_LDLIBS := $(ART_HOST_LDLIBS) -lpthread -ldl
Ian Rogersbd5ea6a2014-04-16 16:34:44 -0700609 LOCAL_IS_HOST_MODULE := true
Ian Rogersafd9acc2014-06-17 08:21:54 -0700610 LOCAL_MULTILIB := both
611 LOCAL_MODULE_STEM_32 := $$(art_gtest_name)32
612 LOCAL_MODULE_STEM_64 := $$(art_gtest_name)64
Andreas Gampe9b14dc32015-04-06 15:35:02 -0700613 LOCAL_CLANG_CFLAGS += -Wno-used-but-marked-unused -Wno-deprecated -Wno-missing-noreturn # gtest issue
Ian Rogersafd9acc2014-06-17 08:21:54 -0700614 include $$(BUILD_HOST_EXECUTABLE)
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700615
Ian Rogersafd9acc2014-06-17 08:21:54 -0700616 ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES :=
617 ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
618 ifneq ($$(HOST_PREFER_32_BIT),true)
619 $$(eval $$(call define-art-gtest-rule-host,$$(art_gtest_name),2ND_))
620 endif
621 $$(eval $$(call define-art-gtest-rule-host,$$(art_gtest_name),))
Ian Rogersd912e5c2013-11-13 12:40:11 -0800622
Ian Rogersafd9acc2014-06-17 08:21:54 -0700623 # Rules to run the different architecture versions of the gtest.
624.PHONY: test-art-host-gtest-$$(art_gtest_name)
625test-art-host-gtest-$$(art_gtest_name): $$(ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES)
626 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
Ian Rogersd912e5c2013-11-13 12:40:11 -0800627
Ian Rogersafd9acc2014-06-17 08:21:54 -0700628.PHONY: valgrind-test-art-host-gtest-$$(art_gtest_name)
629valgrind-test-art-host-gtest-$$(art_gtest_name): $$(ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES)
630 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
631
632 # Clear locally defined variables.
633 ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES :=
634 ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
635 endif # host_or_target
636
637 # Clear locally defined variables.
638 art_target_or_host :=
639 art_gtest_filename :=
640 art_gtest_extra_c_includes :=
641 art_gtest_extra_shared_libraries :=
642 art_gtest_name :=
Nicolas Geoffray96a37c82014-10-29 23:50:40 +0000643 library_path :=
644 2nd_library_path :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700645endef # define-art-gtest
Carl Shapiro008e4122011-06-23 17:27:46 -0700646
Alex Light50fa9932015-08-10 15:30:07 -0700647
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700648ifeq ($(ART_BUILD_TARGET),true)
Richard Uhler66d874d2015-01-15 09:37:19 -0800649 $(foreach file,$(RUNTIME_GTEST_TARGET_SRC_FILES), $(eval $(call define-art-gtest,target,$(file),,libbacktrace)))
650 $(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 -0700651endif
Ian Rogersc5f17732014-06-05 20:48:42 -0700652ifeq ($(ART_BUILD_HOST),true)
Richard Uhler66d874d2015-01-15 09:37:19 -0800653 $(foreach file,$(RUNTIME_GTEST_HOST_SRC_FILES), $(eval $(call define-art-gtest,host,$(file),,libbacktrace)))
654 $(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 -0700655endif
Tsu Chiang Chuangec245a42014-05-15 21:16:21 -0700656
657# Used outside the art project to get a list of the current tests
658RUNTIME_TARGET_GTEST_MAKE_TARGETS :=
659$(foreach file, $(RUNTIME_GTEST_TARGET_SRC_FILES), $(eval RUNTIME_TARGET_GTEST_MAKE_TARGETS += $$(notdir $$(basename $$(file)))))
660COMPILER_TARGET_GTEST_MAKE_TARGETS :=
661$(foreach file, $(COMPILER_GTEST_TARGET_SRC_FILES), $(eval COMPILER_TARGET_GTEST_MAKE_TARGETS += $$(notdir $$(basename $$(file)))))
Ian Rogersafd9acc2014-06-17 08:21:54 -0700662
663# Define all the combinations of host/target, valgrind and suffix such as:
664# test-art-host-gtest or valgrind-test-art-host-gtest64
665# $(1): host or target
666# $(2): HOST or TARGET
667# $(3): valgrind- or undefined
668# $(4): undefined, 32 or 64
669define define-test-art-gtest-combination
670 ifeq ($(1),host)
671 ifneq ($(2),HOST)
672 $$(error argument mismatch $(1) and ($2))
673 endif
674 else
675 ifneq ($(1),target)
676 $$(error found $(1) expected host or target)
677 endif
678 ifneq ($(2),TARGET)
679 $$(error argument mismatch $(1) and ($2))
680 endif
681 endif
682
683 rule_name := $(3)test-art-$(1)-gtest$(4)
Andreas Gampe928f72b2014-09-09 19:53:48 -0700684 ifeq ($(3),valgrind-)
685 ifneq ($(1),host)
686 $$(error valgrind tests only wired up for the host)
687 endif
688 dependencies := $$(ART_TEST_$(2)_VALGRIND_GTEST$(4)_RULES)
689 else
690 dependencies := $$(ART_TEST_$(2)_GTEST$(4)_RULES)
691 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700692
693.PHONY: $$(rule_name)
694$$(rule_name): $$(dependencies)
695 $(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
696
697 # Clear locally defined variables.
698 rule_name :=
699 dependencies :=
700endef # define-test-art-gtest-combination
701
702$(eval $(call define-test-art-gtest-combination,target,TARGET,,))
703$(eval $(call define-test-art-gtest-combination,target,TARGET,,$(ART_PHONY_TEST_TARGET_SUFFIX)))
704ifdef TARGET_2ND_ARCH
705$(eval $(call define-test-art-gtest-combination,target,TARGET,,$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)))
706endif
707$(eval $(call define-test-art-gtest-combination,host,HOST,,))
708$(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,))
709$(eval $(call define-test-art-gtest-combination,host,HOST,,$(ART_PHONY_TEST_HOST_SUFFIX)))
710$(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,$(ART_PHONY_TEST_HOST_SUFFIX)))
711ifneq ($(HOST_PREFER_32_BIT),true)
712$(eval $(call define-test-art-gtest-combination,host,HOST,,$(2ND_ART_PHONY_TEST_HOST_SUFFIX)))
713$(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,$(2ND_ART_PHONY_TEST_HOST_SUFFIX)))
714endif
715
716# Clear locally defined variables.
717define-art-gtest-rule-target :=
718define-art-gtest-rule-host :=
719define-art-gtest :=
720define-test-art-gtest-combination :=
721RUNTIME_GTEST_COMMON_SRC_FILES :=
722COMPILER_GTEST_COMMON_SRC_FILES :=
723RUNTIME_GTEST_TARGET_SRC_FILES :=
724RUNTIME_GTEST_HOST_SRC_FILES :=
725COMPILER_GTEST_TARGET_SRC_FILES :=
726COMPILER_GTEST_HOST_SRC_FILES :=
727ART_TEST_CFLAGS :=
728ART_TEST_HOST_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
729ART_TEST_HOST_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
730ART_TEST_HOST_GTEST_RULES :=
731ART_TEST_HOST_VALGRIND_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
732ART_TEST_HOST_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
733ART_TEST_HOST_VALGRIND_GTEST_RULES :=
734ART_TEST_TARGET_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
735ART_TEST_TARGET_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
736ART_TEST_TARGET_GTEST_RULES :=
Nicolas Geoffray96a37c82014-10-29 23:50:40 +0000737ART_GTEST_TARGET_ANDROID_ROOT :=
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700738ART_GTEST_class_linker_test_DEX_DEPS :=
739ART_GTEST_compiler_driver_test_DEX_DEPS :=
740ART_GTEST_dex_file_test_DEX_DEPS :=
741ART_GTEST_exception_test_DEX_DEPS :=
742ART_GTEST_elf_writer_test_HOST_DEPS :=
743ART_GTEST_elf_writer_test_TARGET_DEPS :=
744ART_GTEST_jni_compiler_test_DEX_DEPS :=
745ART_GTEST_jni_internal_test_DEX_DEPS :=
Richard Uhler66d874d2015-01-15 09:37:19 -0800746ART_GTEST_oat_file_assistant_test_DEX_DEPS :=
747ART_GTEST_oat_file_assistant_test_HOST_DEPS :=
748ART_GTEST_oat_file_assistant_test_TARGET_DEPS :=
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700749ART_GTEST_object_test_DEX_DEPS :=
750ART_GTEST_proxy_test_DEX_DEPS :=
Igor Murashkin457e8742015-10-22 17:37:50 -0700751ART_GTEST_lambda_proxy_test_DEX_DEPS :=
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700752ART_GTEST_reflection_test_DEX_DEPS :=
753ART_GTEST_stub_test_DEX_DEPS :=
754ART_GTEST_transaction_test_DEX_DEPS :=
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800755ART_VALGRIND_DEPENDENCIES :=
Ian Rogers1a2f84e2014-07-07 16:05:18 -0700756$(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval ART_TEST_TARGET_GTEST_$(dir)_DEX :=))
757$(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval ART_TEST_HOST_GTEST_$(dir)_DEX :=))
Richard Uhler66d874d2015-01-15 09:37:19 -0800758ART_TEST_HOST_GTEST_MainStripped_DEX :=
759ART_TEST_TARGET_GTEST_MainStripped_DEX :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700760GTEST_DEX_DIRECTORIES :=
Brian Carlstrom532714a2014-06-25 02:15:31 -0700761LOCAL_PATH :=