blob: f708e26efd31c002e65d67ee2c187f8543d012d4 [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 \
Nicolas Geoffray01b70e82016-11-17 10:58:36 +000028 DexToDexDecompiler \
Mathieu Chartier1e4841e2016-12-15 14:21:04 -080029 ErroneousA \
30 ErroneousB \
Ian Rogersafd9acc2014-06-17 08:21:54 -070031 ExceptionHandle \
32 GetMethodSignature \
Mathieu Chartier496577f2016-09-20 15:33:31 -070033 ImageLayoutA \
34 ImageLayoutB \
Andreas Gampea1ff30f2016-09-27 12:19:45 -070035 IMTA \
36 IMTB \
Sebastien Hertz0462c4c2015-04-01 16:34:17 +020037 Instrumentation \
Ian Rogersafd9acc2014-06-17 08:21:54 -070038 Interfaces \
Artem Udovichenkod9786b02015-10-14 16:36:55 +030039 Lookup \
Ian Rogersafd9acc2014-06-17 08:21:54 -070040 Main \
Narayan Kamath25352fc2016-08-03 12:46:58 +010041 MethodTypes \
Richard Uhler66d874d2015-01-15 09:37:19 -080042 MultiDex \
Richard Uhler67ff7d12015-05-14 13:21:13 -070043 MultiDexModifiedSecondary \
Ian Rogersafd9acc2014-06-17 08:21:54 -070044 MyClass \
45 MyClassNatives \
46 Nested \
47 NonStaticLeafMethods \
Mathieu Chartier279ac5c2016-09-08 17:34:25 -070048 Packages \
Ian Rogersafd9acc2014-06-17 08:21:54 -070049 ProtoCompare \
50 ProtoCompare2 \
Calin Juravle877fd962016-01-05 14:29:29 +000051 ProfileTestMultiDex \
Ian Rogersafd9acc2014-06-17 08:21:54 -070052 StaticLeafMethods \
53 Statics \
54 StaticsFromCode \
55 Transaction \
56 XandY
57
58# Create build rules for each dex file recording the dependency.
59$(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval $(call build-art-test-dex,art-gtest,$(dir), \
Ian Rogers1a2f84e2014-07-07 16:05:18 -070060 $(ART_TARGET_NATIVETEST_OUT),art/build/Android.gtest.mk,ART_TEST_TARGET_GTEST_$(dir)_DEX, \
61 ART_TEST_HOST_GTEST_$(dir)_DEX)))
Ian Rogersafd9acc2014-06-17 08:21:54 -070062
Richard Uhler66d874d2015-01-15 09:37:19 -080063# Create rules for MainStripped, a copy of Main with the classes.dex stripped
64# for the oat file assistant tests.
65ART_TEST_HOST_GTEST_MainStripped_DEX := $(basename $(ART_TEST_HOST_GTEST_Main_DEX))Stripped$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
66ART_TEST_TARGET_GTEST_MainStripped_DEX := $(basename $(ART_TEST_TARGET_GTEST_Main_DEX))Stripped$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))
67
68$(ART_TEST_HOST_GTEST_MainStripped_DEX): $(ART_TEST_HOST_GTEST_Main_DEX)
69 cp $< $@
70 $(call dexpreopt-remove-classes.dex,$@)
71
72$(ART_TEST_TARGET_GTEST_MainStripped_DEX): $(ART_TEST_TARGET_GTEST_Main_DEX)
73 cp $< $@
74 $(call dexpreopt-remove-classes.dex,$@)
75
David Brazdilca3c8c32016-09-06 14:04:48 +010076ART_TEST_GTEST_VerifierDeps_SRC := $(abspath $(wildcard $(LOCAL_PATH)/VerifierDeps/*.smali))
77ART_TEST_HOST_GTEST_VerifierDeps_DEX := $(dir $(ART_TEST_HOST_GTEST_Main_DEX))$(subst Main,VerifierDeps,$(basename $(notdir $(ART_TEST_HOST_GTEST_Main_DEX))))$(suffix $(ART_TEST_HOST_GTEST_Main_DEX))
David Brazdilf906f122016-09-16 16:33:31 +010078ART_TEST_TARGET_GTEST_VerifierDeps_DEX := $(dir $(ART_TEST_TARGET_GTEST_Main_DEX))$(subst Main,VerifierDeps,$(basename $(notdir $(ART_TEST_TARGET_GTEST_Main_DEX))))$(suffix $(ART_TEST_TARGET_GTEST_Main_DEX))
David Brazdilca3c8c32016-09-06 14:04:48 +010079
80$(ART_TEST_HOST_GTEST_VerifierDeps_DEX): $(ART_TEST_GTEST_VerifierDeps_SRC) $(HOST_OUT_EXECUTABLES)/smali
81 $(HOST_OUT_EXECUTABLES)/smali --output=$@ $(filter %.smali,$^)
82
David Brazdilf906f122016-09-16 16:33:31 +010083$(ART_TEST_TARGET_GTEST_VerifierDeps_DEX): $(ART_TEST_GTEST_VerifierDeps_SRC) $(HOST_OUT_EXECUTABLES)/smali
84 $(HOST_OUT_EXECUTABLES)/smali --output=$@ $(filter %.smali,$^)
85
Ian Rogersafd9acc2014-06-17 08:21:54 -070086# Dex file dependencies for each gtest.
Andreas Gampee1459ae2016-06-29 09:36:30 -070087ART_GTEST_dex2oat_environment_tests_DEX_DEPS := Main MainStripped MultiDex MultiDexModifiedSecondary Nested
88
Mathieu Chartier9df89312016-11-23 13:28:16 -080089ART_GTEST_atomic_method_ref_map_test_DEX_DEPS := Interfaces
Mathieu Chartier1e4841e2016-12-15 14:21:04 -080090ART_GTEST_class_linker_test_DEX_DEPS := ErroneousA ErroneousB Interfaces MethodTypes MultiDex MyClass Nested Statics StaticsFromCode
Mathieu Chartierdb70ce52016-12-12 11:06:59 -080091ART_GTEST_class_table_test_DEX_DEPS := XandY
Calin Juravle877fd962016-01-05 14:29:29 +000092ART_GTEST_compiler_driver_test_DEX_DEPS := AbstractMethod StaticLeafMethods ProfileTestMultiDex
Narayan Kamath25352fc2016-08-03 12:46:58 +010093ART_GTEST_dex_cache_test_DEX_DEPS := Main Packages MethodTypes
Andreas Gampeda823442014-11-03 15:36:53 -080094ART_GTEST_dex_file_test_DEX_DEPS := GetMethodSignature Main Nested
Andreas Gampe7adeda82016-07-25 08:27:35 -070095ART_GTEST_dex2oat_test_DEX_DEPS := $(ART_GTEST_dex2oat_environment_tests_DEX_DEPS) Statics
Brian Carlstromeb85f2b2014-06-25 13:23:00 -070096ART_GTEST_exception_test_DEX_DEPS := ExceptionHandle
Mathieu Chartier496577f2016-09-20 15:33:31 -070097ART_GTEST_image_test_DEX_DEPS := ImageLayoutA ImageLayoutB
Andreas Gampea1ff30f2016-09-27 12:19:45 -070098ART_GTEST_imtable_test_DEX_DEPS := IMTA IMTB
Sebastien Hertz0462c4c2015-04-01 16:34:17 +020099ART_GTEST_instrumentation_test_DEX_DEPS := Instrumentation
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700100ART_GTEST_jni_compiler_test_DEX_DEPS := MyClassNatives
101ART_GTEST_jni_internal_test_DEX_DEPS := AllFields StaticLeafMethods
Andreas Gampee1459ae2016-06-29 09:36:30 -0700102ART_GTEST_oat_file_assistant_test_DEX_DEPS := $(ART_GTEST_dex2oat_environment_tests_DEX_DEPS)
Andreas Gampe7848da42015-04-09 11:15:04 -0700103ART_GTEST_oat_file_test_DEX_DEPS := Main MultiDex
Mathieu Chartier07ddb6f2015-11-05 11:16:34 -0800104ART_GTEST_oat_test_DEX_DEPS := Main
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700105ART_GTEST_object_test_DEX_DEPS := ProtoCompare ProtoCompare2 StaticsFromCode XandY
106ART_GTEST_proxy_test_DEX_DEPS := Interfaces
107ART_GTEST_reflection_test_DEX_DEPS := Main NonStaticLeafMethods StaticLeafMethods
Calin Juravle877fd962016-01-05 14:29:29 +0000108ART_GTEST_profile_assistant_test_DEX_DEPS := ProfileTestMultiDex
109ART_GTEST_profile_compilation_info_test_DEX_DEPS := ProfileTestMultiDex
Andreas Gampe0f01b582017-01-18 15:22:37 -0800110ART_GTEST_runtime_callbacks_test_DEX_DEPS := XandY
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700111ART_GTEST_stub_test_DEX_DEPS := AllFields
112ART_GTEST_transaction_test_DEX_DEPS := Transaction
Artem Udovichenkod9786b02015-10-14 16:36:55 +0300113ART_GTEST_type_lookup_table_test_DEX_DEPS := Lookup
Nicolas Geoffrayd01f60c2016-10-28 14:45:48 +0100114ART_GTEST_verifier_deps_test_DEX_DEPS := VerifierDeps MultiDex
Nicolas Geoffray01b70e82016-11-17 10:58:36 +0000115ART_GTEST_dex_to_dex_decompiler_test_DEX_DEPS := VerifierDeps DexToDexDecompiler
Ian Rogersafd9acc2014-06-17 08:21:54 -0700116
117# The elf writer test has dependencies on core.oat.
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +0000118ART_GTEST_elf_writer_test_HOST_DEPS := $(HOST_CORE_IMAGE_optimizing_no-pic_64) $(HOST_CORE_IMAGE_optimizing_no-pic_32)
119ART_GTEST_elf_writer_test_TARGET_DEPS := $(TARGET_CORE_IMAGE_optimizing_no-pic_64) $(TARGET_CORE_IMAGE_optimizing_no-pic_32)
Brian Carlstrom53463ea2014-11-09 14:11:51 -0800120
Andreas Gampee1459ae2016-06-29 09:36:30 -0700121ART_GTEST_dex2oat_environment_tests_HOST_DEPS := \
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +0000122 $(HOST_CORE_IMAGE_optimizing_pic_64) \
123 $(HOST_CORE_IMAGE_optimizing_pic_32) \
Richard Uhlercb6a5912017-01-19 10:53:59 +0000124 $(HOST_CORE_IMAGE_optimizing_no-pic_64) \
125 $(HOST_CORE_IMAGE_optimizing_no-pic_32) \
Richard Uhlerf51ac422016-07-08 09:22:33 -0700126 $(HOST_OUT_EXECUTABLES)/patchoatd
Andreas Gampee1459ae2016-06-29 09:36:30 -0700127ART_GTEST_dex2oat_environment_tests_TARGET_DEPS := \
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +0000128 $(TARGET_CORE_IMAGE_optimizing_pic_64) \
129 $(TARGET_CORE_IMAGE_optimizing_pic_32) \
Richard Uhlercb6a5912017-01-19 10:53:59 +0000130 $(TARGET_CORE_IMAGE_optimizing_no-pic_64) \
131 $(TARGET_CORE_IMAGE_optimizing_no-pic_32) \
Richard Uhlerf51ac422016-07-08 09:22:33 -0700132 $(TARGET_OUT_EXECUTABLES)/patchoatd
Andreas Gampee1459ae2016-06-29 09:36:30 -0700133
134ART_GTEST_oat_file_assistant_test_HOST_DEPS := \
Richard Uhlerf51ac422016-07-08 09:22:33 -0700135 $(ART_GTEST_dex2oat_environment_tests_HOST_DEPS)
Andreas Gampee1459ae2016-06-29 09:36:30 -0700136ART_GTEST_oat_file_assistant_test_TARGET_DEPS := \
Richard Uhlerf51ac422016-07-08 09:22:33 -0700137 $(ART_GTEST_dex2oat_environment_tests_TARGET_DEPS)
Andreas Gampee1459ae2016-06-29 09:36:30 -0700138
139
140ART_GTEST_dex2oat_test_HOST_DEPS := \
141 $(ART_GTEST_dex2oat_environment_tests_HOST_DEPS)
142ART_GTEST_dex2oat_test_TARGET_DEPS := \
143 $(ART_GTEST_dex2oat_environment_tests_TARGET_DEPS)
Richard Uhler66d874d2015-01-15 09:37:19 -0800144
Brian Carlstrom53463ea2014-11-09 14:11:51 -0800145# TODO: document why this is needed.
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +0000146ART_GTEST_proxy_test_HOST_DEPS := $(HOST_CORE_IMAGE_optimizing_no-pic_64) $(HOST_CORE_IMAGE_optimizing_no-pic_32)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700147
Aart Bikcfbe53c2015-07-06 14:27:27 -0700148# The dexdump test requires an image and the dexdump utility.
Aart Bik22c26f52015-07-08 21:20:13 +0000149# TODO: rename into dexdump when migration completes
Aart Bikcfbe53c2015-07-06 14:27:27 -0700150ART_GTEST_dexdump_test_HOST_DEPS := \
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +0000151 $(HOST_CORE_IMAGE_optimizing_no-pic_64) \
152 $(HOST_CORE_IMAGE_optimizing_no-pic_32) \
Aart Bik22c26f52015-07-08 21:20:13 +0000153 $(HOST_OUT_EXECUTABLES)/dexdump2
Aart Bikcfbe53c2015-07-06 14:27:27 -0700154ART_GTEST_dexdump_test_TARGET_DEPS := \
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +0000155 $(TARGET_CORE_IMAGE_optimizing_no-pic_64) \
156 $(TARGET_CORE_IMAGE_optimizing_no-pic_32) \
Aart Bik22c26f52015-07-08 21:20:13 +0000157 dexdump2
Aart Bikcfbe53c2015-07-06 14:27:27 -0700158
Jeff Haoc3acfc52016-08-29 14:18:26 -0700159# The dexlayout test requires an image and the dexlayout utility.
160# TODO: rename into dexdump when migration completes
161ART_GTEST_dexlayout_test_HOST_DEPS := \
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +0000162 $(HOST_CORE_IMAGE_optimizing_no-pic_64) \
163 $(HOST_CORE_IMAGE_optimizing_no-pic_32) \
Jeff Haoc3acfc52016-08-29 14:18:26 -0700164 $(HOST_OUT_EXECUTABLES)/dexlayout \
165 $(HOST_OUT_EXECUTABLES)/dexdump2
166ART_GTEST_dexlayout_test_TARGET_DEPS := \
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +0000167 $(TARGET_CORE_IMAGE_optimizing_no-pic_64) \
168 $(TARGET_CORE_IMAGE_optimizing_no-pic_32) \
Jeff Haoc3acfc52016-08-29 14:18:26 -0700169 dexlayout \
170 dexdump2
171
Aart Bik3e40f4a2015-07-07 17:09:41 -0700172# The dexlist test requires an image and the dexlist utility.
Aart Bik3e40f4a2015-07-07 17:09:41 -0700173ART_GTEST_dexlist_test_HOST_DEPS := \
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +0000174 $(HOST_CORE_IMAGE_optimizing_no-pic_64) \
175 $(HOST_CORE_IMAGE_optimizing_no-pic_32) \
Aart Bikb1b45be2015-08-28 11:09:29 -0700176 $(HOST_OUT_EXECUTABLES)/dexlist
Aart Bik3e40f4a2015-07-07 17:09:41 -0700177ART_GTEST_dexlist_test_TARGET_DEPS := \
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +0000178 $(TARGET_CORE_IMAGE_optimizing_no-pic_64) \
179 $(TARGET_CORE_IMAGE_optimizing_no-pic_32) \
Aart Bikb1b45be2015-08-28 11:09:29 -0700180 dexlist
Aart Bik3e40f4a2015-07-07 17:09:41 -0700181
Igor Murashkin37743352014-11-13 14:38:00 -0800182# The imgdiag test has dependencies on core.oat since it needs to load it during the test.
Andreas Gampec93b8b52014-12-19 23:12:25 -0800183# For the host, also add the installed tool (in the base size, that should suffice). For the
184# target, just the module is fine, the sync will happen late enough.
185ART_GTEST_imgdiag_test_HOST_DEPS := \
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +0000186 $(HOST_CORE_IMAGE_optimizing_no-pic_64) \
187 $(HOST_CORE_IMAGE_optimizing_no-pic_32) \
Andreas Gampec93b8b52014-12-19 23:12:25 -0800188 $(HOST_OUT_EXECUTABLES)/imgdiagd
189ART_GTEST_imgdiag_test_TARGET_DEPS := \
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +0000190 $(TARGET_CORE_IMAGE_optimizing_no-pic_64) \
191 $(TARGET_CORE_IMAGE_optimizing_no-pic_32) \
Andreas Gampec93b8b52014-12-19 23:12:25 -0800192 imgdiagd
Igor Murashkin37743352014-11-13 14:38:00 -0800193
Mathieu Chartierea216b32015-05-26 19:48:16 -0700194# Oatdump test requires an image and oatfile to dump.
195ART_GTEST_oatdump_test_HOST_DEPS := \
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +0000196 $(HOST_CORE_IMAGE_optimizing_no-pic_64) \
197 $(HOST_CORE_IMAGE_optimizing_no-pic_32) \
Colin Crossb20be212016-09-19 13:02:47 -0700198 $(HOST_OUT_EXECUTABLES)/oatdumpd \
199 $(HOST_OUT_EXECUTABLES)/oatdumpds
Mathieu Chartierea216b32015-05-26 19:48:16 -0700200ART_GTEST_oatdump_test_TARGET_DEPS := \
Nicolas Geoffrayb76bc782016-09-14 12:33:34 +0000201 $(TARGET_CORE_IMAGE_optimizing_no-pic_64) \
202 $(TARGET_CORE_IMAGE_optimizing_no-pic_32) \
Mathieu Chartierea216b32015-05-26 19:48:16 -0700203 oatdump
204
Calin Juravle2e2db782016-02-23 12:00:03 +0000205# Profile assistant tests requires profman utility.
206ART_GTEST_profile_assistant_test_HOST_DEPS := \
207 $(HOST_OUT_EXECUTABLES)/profmand
208ART_GTEST_profile_assistant_test_TARGET_DEPS := \
209 profman
210
Ian Rogersafd9acc2014-06-17 08:21:54 -0700211# The path for which all the source files are relative, not actually the current directory.
Brian Carlstrom7940e442013-07-12 13:46:57 -0700212LOCAL_PATH := art
213
Colin Cross6e95dd52016-09-12 15:37:10 -0700214ART_TEST_MODULES := \
215 art_cmdline_tests \
216 art_compiler_tests \
217 art_compiler_host_tests \
218 art_dex2oat_tests \
219 art_dexdump_tests \
220 art_dexlayout_tests \
221 art_dexlist_tests \
222 art_imgdiag_tests \
223 art_oatdump_tests \
224 art_profman_tests \
225 art_runtime_tests \
226 art_runtime_compiler_tests \
Brian Carlstroma1ce1fe2014-02-24 23:23:58 -0800227
Colin Cross6e95dd52016-09-12 15:37:10 -0700228ART_TARGET_GTEST_FILES := $(foreach m,$(ART_TEST_MODULES),\
229 $(ART_TEST_LIST_device_$(TARGET_ARCH)_$(m)))
Alex Light50fa9932015-08-10 15:30:07 -0700230
Nicolas Geoffray6bbea4c2016-09-16 16:41:43 +0100231ifdef TARGET_2ND_ARCH
2322ND_ART_TARGET_GTEST_FILES := $(foreach m,$(ART_TEST_MODULES),\
233 $(ART_TEST_LIST_device_$(2ND_TARGET_ARCH)_$(m)))
234endif
235
Colin Cross6e95dd52016-09-12 15:37:10 -0700236ART_HOST_GTEST_FILES := $(foreach m,$(ART_TEST_MODULES),\
Colin Cross124f8812016-09-15 20:57:47 -0700237 $(ART_TEST_LIST_host_$(ART_HOST_ARCH)_$(m)))
Alex Light50fa9932015-08-10 15:30:07 -0700238
Nicolas Geoffray6bbea4c2016-09-16 16:41:43 +0100239ifneq ($(HOST_PREFER_32_BIT),true)
2402ND_ART_HOST_GTEST_FILES += $(foreach m,$(ART_TEST_MODULES),\
241 $(ART_TEST_LIST_host_$(2ND_ART_HOST_ARCH)_$(m)))
242endif
243
Ian Rogersafd9acc2014-06-17 08:21:54 -0700244# Variables holding collections of gtest pre-requisits used to run a number of gtests.
245ART_TEST_HOST_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
246ART_TEST_HOST_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
247ART_TEST_HOST_GTEST_RULES :=
248ART_TEST_HOST_VALGRIND_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
249ART_TEST_HOST_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
250ART_TEST_HOST_VALGRIND_GTEST_RULES :=
251ART_TEST_TARGET_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
252ART_TEST_TARGET_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
253ART_TEST_TARGET_GTEST_RULES :=
Anton Kirilove5e76f42016-05-03 16:15:36 +0100254ART_TEST_TARGET_VALGRIND_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
255ART_TEST_TARGET_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
256ART_TEST_TARGET_VALGRIND_GTEST_RULES :=
Nicolas Geoffray58035ae2015-05-27 19:10:27 +0100257ART_TEST_HOST_GTEST_DEPENDENCIES :=
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700258
Nicolas Geoffray96a37c82014-10-29 23:50:40 +0000259ART_GTEST_TARGET_ANDROID_ROOT := '/system'
260ifneq ($(ART_TEST_ANDROID_ROOT),)
261 ART_GTEST_TARGET_ANDROID_ROOT := $(ART_TEST_ANDROID_ROOT)
262endif
263
Anton Kirilove5e76f42016-05-03 16:15:36 +0100264ART_VALGRIND_TARGET_DEPENDENCIES := \
265 $(TARGET_OUT_EXECUTABLES)/valgrind \
266 $(TARGET_OUT_SHARED_LIBRARIES)/valgrind/memcheck-$(TARGET_ARCH)-linux \
267 $(TARGET_OUT_SHARED_LIBRARIES)/valgrind/vgpreload_core-$(TARGET_ARCH)-linux.so \
268 $(TARGET_OUT_SHARED_LIBRARIES)/valgrind/vgpreload_memcheck-$(TARGET_ARCH)-linux.so \
269 $(TARGET_OUT_SHARED_LIBRARIES)/valgrind/default.supp
270
271ifdef TARGET_2ND_ARCH
272ART_VALGRIND_TARGET_DEPENDENCIES += \
273 $(TARGET_OUT_SHARED_LIBRARIES)/valgrind/memcheck-$(TARGET_2ND_ARCH)-linux \
274 $(TARGET_OUT_SHARED_LIBRARIES)/valgrind/vgpreload_core-$(TARGET_2ND_ARCH)-linux.so \
275 $(TARGET_OUT_SHARED_LIBRARIES)/valgrind/vgpreload_memcheck-$(TARGET_2ND_ARCH)-linux.so
276endif
277
278include $(CLEAR_VARS)
279LOCAL_MODULE := valgrind-target-suppressions.txt
280LOCAL_MODULE_CLASS := ETC
281LOCAL_MODULE_TAGS := optional
282LOCAL_SRC_FILES := test/valgrind-target-suppressions.txt
283LOCAL_MODULE_PATH := $(ART_TARGET_TEST_OUT)
284include $(BUILD_PREBUILT)
285
Ian Rogersafd9acc2014-06-17 08:21:54 -0700286# Define a make rule for a target device gtest.
287# $(1): gtest name - the name of the test we're building such as leb128_test.
Colin Cross6e95dd52016-09-12 15:37:10 -0700288# $(2): path relative to $OUT to the test binary
289# $(3): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
290# $(4): LD_LIBRARY_PATH or undefined - used in case libartd.so is not in /system/lib/
Ian Rogersafd9acc2014-06-17 08:21:54 -0700291define define-art-gtest-rule-target
Colin Cross6e95dd52016-09-12 15:37:10 -0700292 gtest_rule := test-art-target-gtest-$(1)$$($(3)ART_PHONY_TEST_TARGET_SUFFIX)
293 gtest_exe := $(OUT_DIR)/$(2)
294 gtest_target_exe := $$(patsubst $(PRODUCT_OUT)/%,/%,$$(gtest_exe))
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700295
Brian Carlstrom532714a2014-06-25 02:15:31 -0700296 # Add the test dependencies to test-art-target-sync, which will be a prerequisite for the test
Ian Rogersafd9acc2014-06-17 08:21:54 -0700297 # to ensure files are pushed to the device.
298 TEST_ART_TARGET_SYNC_DEPS += \
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700299 $$(ART_GTEST_$(1)_TARGET_DEPS) \
Ian Rogers1a2f84e2014-07-07 16:05:18 -0700300 $(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_TARGET_GTEST_$(file)_DEX)) \
Colin Cross6e95dd52016-09-12 15:37:10 -0700301 $$(gtest_exe) \
302 $$($(3)TARGET_OUT_SHARED_LIBRARIES)/libjavacore.so \
303 $$($(3)TARGET_OUT_SHARED_LIBRARIES)/libopenjdkd.so \
Andreas Gampec7d4a582015-09-30 11:52:02 -0700304 $$(TARGET_OUT_JAVA_LIBRARIES)/core-libart-testdex.jar \
Anton Kirilove5e76f42016-05-03 16:15:36 +0100305 $$(TARGET_OUT_JAVA_LIBRARIES)/core-oj-testdex.jar \
306 $$(ART_TARGET_TEST_OUT)/valgrind-target-suppressions.txt
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700307
Colin Cross6e95dd52016-09-12 15:37:10 -0700308$$(gtest_rule) valgrind-$$(gtest_rule): PRIVATE_TARGET_EXE := $$(gtest_target_exe)
309
Ian Rogersafd9acc2014-06-17 08:21:54 -0700310.PHONY: $$(gtest_rule)
311$$(gtest_rule): test-art-target-sync
Colin Cross6e95dd52016-09-12 15:37:10 -0700312 $(hide) adb shell touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID
313 $(hide) adb shell rm $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID
314 $(hide) adb shell chmod 755 $$(PRIVATE_TARGET_EXE)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700315 $(hide) $$(call ART_TEST_SKIP,$$@) && \
Colin Cross6e95dd52016-09-12 15:37:10 -0700316 (adb shell "$(GCOV_ENV) LD_LIBRARY_PATH=$(4) ANDROID_ROOT=$(ART_GTEST_TARGET_ANDROID_ROOT) \
317 $$(PRIVATE_TARGET_EXE) && touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID" \
318 && (adb pull $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID /tmp/ \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700319 && $$(call ART_TEST_PASSED,$$@)) \
320 || $$(call ART_TEST_FAILED,$$@))
Ian Rogers6f3dbba2014-10-14 17:41:57 -0700321 $(hide) rm -f /tmp/$$@-$$$$PPID
Ian Rogersafd9acc2014-06-17 08:21:54 -0700322
Colin Cross6e95dd52016-09-12 15:37:10 -0700323 ART_TEST_TARGET_GTEST$($(3)ART_PHONY_TEST_TARGET_SUFFIX)_RULES += $$(gtest_rule)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700324 ART_TEST_TARGET_GTEST_RULES += $$(gtest_rule)
325 ART_TEST_TARGET_GTEST_$(1)_RULES += $$(gtest_rule)
326
Anton Kirilove5e76f42016-05-03 16:15:36 +0100327.PHONY: valgrind-$$(gtest_rule)
328valgrind-$$(gtest_rule): $(ART_VALGRIND_TARGET_DEPENDENCIES) test-art-target-sync
Colin Cross6e95dd52016-09-12 15:37:10 -0700329 $(hide) adb shell touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID
330 $(hide) adb shell rm $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID
331 $(hide) adb shell chmod 755 $$(PRIVATE_TARGET_EXE)
Anton Kirilove5e76f42016-05-03 16:15:36 +0100332 $(hide) $$(call ART_TEST_SKIP,$$@) && \
Colin Cross6e95dd52016-09-12 15:37:10 -0700333 (adb shell "$(GCOV_ENV) LD_LIBRARY_PATH=$(4) ANDROID_ROOT=$(ART_GTEST_TARGET_ANDROID_ROOT) \
Anton Kirilove5e76f42016-05-03 16:15:36 +0100334 valgrind --leak-check=full --error-exitcode=1 --workaround-gcc296-bugs=yes \
335 --suppressions=$(ART_TARGET_TEST_DIR)/valgrind-target-suppressions.txt \
Anton Kirilov3a2e78e2017-01-06 13:33:42 +0000336 --num-callers=50 --show-mismatched-frees=no \
Colin Cross6e95dd52016-09-12 15:37:10 -0700337 $$(PRIVATE_TARGET_EXE) && touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID" \
338 && (adb pull $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID /tmp/ \
Anton Kirilove5e76f42016-05-03 16:15:36 +0100339 && $$(call ART_TEST_PASSED,$$@)) \
340 || $$(call ART_TEST_FAILED,$$@))
341 $(hide) rm -f /tmp/$$@-$$$$PPID
342
Colin Cross6e95dd52016-09-12 15:37:10 -0700343 ART_TEST_TARGET_VALGRIND_GTEST$$($(3)ART_PHONY_TEST_TARGET_SUFFIX)_RULES += valgrind-$$(gtest_rule)
Anton Kirilove5e76f42016-05-03 16:15:36 +0100344 ART_TEST_TARGET_VALGRIND_GTEST_RULES += valgrind-$$(gtest_rule)
345 ART_TEST_TARGET_VALGRIND_GTEST_$(1)_RULES += valgrind-$$(gtest_rule)
346
Ian Rogersafd9acc2014-06-17 08:21:54 -0700347 # Clear locally defined variables.
Anton Kirilove5e76f42016-05-03 16:15:36 +0100348 valgrind_gtest_rule :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700349 gtest_rule :=
Colin Cross6e95dd52016-09-12 15:37:10 -0700350 gtest_exe :=
351 gtest_target_exe :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700352endef # define-art-gtest-rule-target
353
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800354ART_VALGRIND_DEPENDENCIES := \
355 $(HOST_OUT_EXECUTABLES)/valgrind \
356 $(HOST_OUT)/lib64/valgrind/memcheck-amd64-linux \
357 $(HOST_OUT)/lib64/valgrind/memcheck-x86-linux \
358 $(HOST_OUT)/lib64/valgrind/default.supp \
359 $(HOST_OUT)/lib64/valgrind/vgpreload_core-amd64-linux.so \
360 $(HOST_OUT)/lib64/valgrind/vgpreload_core-x86-linux.so \
361 $(HOST_OUT)/lib64/valgrind/vgpreload_memcheck-amd64-linux.so \
362 $(HOST_OUT)/lib64/valgrind/vgpreload_memcheck-x86-linux.so
363
Ian Rogersafd9acc2014-06-17 08:21:54 -0700364# Define make rules for a host gtests.
365# $(1): gtest name - the name of the test we're building such as leb128_test.
Colin Cross6e95dd52016-09-12 15:37:10 -0700366# $(2): path relative to $OUT to the test binary
367# $(3): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
Ian Rogersafd9acc2014-06-17 08:21:54 -0700368define define-art-gtest-rule-host
Colin Cross6e95dd52016-09-12 15:37:10 -0700369 gtest_rule := test-art-host-gtest-$(1)$$($(3)ART_PHONY_TEST_HOST_SUFFIX)
370 gtest_exe := $(OUT_DIR)/$(2)
Ian Rogers665de8a2014-06-24 21:34:09 -0700371 # Dependencies for all host gtests.
372 gtest_deps := $$(HOST_CORE_DEX_LOCATIONS) \
Colin Cross6e95dd52016-09-12 15:37:10 -0700373 $$($(3)ART_HOST_OUT_SHARED_LIBRARIES)/libjavacore$$(ART_HOST_SHLIB_EXTENSION) \
374 $$($(3)ART_HOST_OUT_SHARED_LIBRARIES)/libopenjdkd$$(ART_HOST_SHLIB_EXTENSION) \
Nicolas Geoffray58035ae2015-05-27 19:10:27 +0100375 $$(gtest_exe) \
376 $$(ART_GTEST_$(1)_HOST_DEPS) \
377 $(foreach file,$(ART_GTEST_$(1)_DEX_DEPS),$(ART_TEST_HOST_GTEST_$(file)_DEX))
Ian Rogers665de8a2014-06-24 21:34:09 -0700378
Nicolas Geoffray58035ae2015-05-27 19:10:27 +0100379 ART_TEST_HOST_GTEST_DEPENDENCIES += $$(gtest_deps)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700380
381.PHONY: $$(gtest_rule)
Nicolas Geoffray0f7c06d2015-05-28 10:21:03 +0100382$$(gtest_rule): $$(gtest_exe) $$(gtest_deps)
Dmitriy Ivanov8508a432014-10-14 11:38:46 -0700383 $(hide) ($$(call ART_TEST_SKIP,$$@) && $$< && $$(call ART_TEST_PASSED,$$@)) \
Ian Rogersafd9acc2014-06-17 08:21:54 -0700384 || $$(call ART_TEST_FAILED,$$@)
385
Colin Cross6e95dd52016-09-12 15:37:10 -0700386 ART_TEST_HOST_GTEST$$($(3)ART_PHONY_TEST_HOST_SUFFIX)_RULES += $$(gtest_rule)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700387 ART_TEST_HOST_GTEST_RULES += $$(gtest_rule)
388 ART_TEST_HOST_GTEST_$(1)_RULES += $$(gtest_rule)
389
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800390
Ian Rogersafd9acc2014-06-17 08:21:54 -0700391.PHONY: valgrind-$$(gtest_rule)
Andreas Gampe3db36002015-05-28 20:17:09 -0700392valgrind-$$(gtest_rule): $$(gtest_exe) $$(gtest_deps) $(ART_VALGRIND_DEPENDENCIES)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700393 $(hide) $$(call ART_TEST_SKIP,$$@) && \
Andreas Gampe8df91ac2015-02-20 13:15:15 -0800394 VALGRIND_LIB=$(HOST_OUT)/lib64/valgrind \
Hiroshi Yamauchidc15e892016-03-10 13:49:14 -0800395 $(HOST_OUT_EXECUTABLES)/valgrind --leak-check=full --error-exitcode=1 \
Andreas Gampebf13e802016-09-02 19:43:09 -0700396 --suppressions=art/test/valgrind-suppressions.txt --num-callers=50 \
397 $$< && \
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800398 $$(call ART_TEST_PASSED,$$@) || $$(call ART_TEST_FAILED,$$@)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700399
Colin Cross6e95dd52016-09-12 15:37:10 -0700400 ART_TEST_HOST_VALGRIND_GTEST$$($(3)ART_PHONY_TEST_HOST_SUFFIX)_RULES += valgrind-$$(gtest_rule)
Ian Rogersafd9acc2014-06-17 08:21:54 -0700401 ART_TEST_HOST_VALGRIND_GTEST_RULES += valgrind-$$(gtest_rule)
402 ART_TEST_HOST_VALGRIND_GTEST_$(1)_RULES += valgrind-$$(gtest_rule)
403
404 # Clear locally defined variables.
405 valgrind_gtest_rule :=
406 gtest_rule :=
407 gtest_exe :=
Ian Rogers665de8a2014-06-24 21:34:09 -0700408 gtest_deps :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700409endef # define-art-gtest-rule-host
410
411# Define the rules to build and run host and target gtests.
Nicolas Geoffray6bbea4c2016-09-16 16:41:43 +0100412# $(1): file name
413# $(2): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
414define define-art-gtest-target
415 art_gtest_filename := $(1)
Brian Carlstrom0796af02011-10-12 14:31:45 -0700416
Ian Rogersafd9acc2014-06-17 08:21:54 -0700417 include $$(CLEAR_VARS)
Brian Carlstrom47a0d5a2011-10-12 21:20:05 -0700418 art_gtest_name := $$(notdir $$(basename $$(art_gtest_filename)))
Colin Cross6e95dd52016-09-12 15:37:10 -0700419
Nicolas Geoffray6bbea4c2016-09-16 16:41:43 +0100420 library_path :=
421 2ND_library_path :=
422 ifneq ($$(ART_TEST_ANDROID_ROOT),)
423 ifdef TARGET_2ND_ARCH
424 2ND_library_path := $$(ART_TEST_ANDROID_ROOT)/lib
425 library_path := $$(ART_TEST_ANDROID_ROOT)/lib64
426 else
427 ifneq ($(filter %64,$(TARGET_ARCH)),)
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000428 library_path := $$(ART_TEST_ANDROID_ROOT)/lib64
429 else
Nicolas Geoffray6bbea4c2016-09-16 16:41:43 +0100430 library_path := $$(ART_TEST_ANDROID_ROOT)/lib
Nicolas Geoffray9eb40742014-10-29 22:38:53 +0000431 endif
432 endif
Nicolas Geoffray6bbea4c2016-09-16 16:41:43 +0100433 endif
Andreas Gampe5ca4eaa2014-05-29 02:09:33 -0700434
Nicolas Geoffray6bbea4c2016-09-16 16:41:43 +0100435 ifndef ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES
Ian Rogersafd9acc2014-06-17 08:21:54 -0700436 ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES :=
Anton Kirilove5e76f42016-05-03 16:15:36 +0100437 ART_TEST_TARGET_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
Nicolas Geoffray6bbea4c2016-09-16 16:41:43 +0100438 endif
439 $$(eval $$(call define-art-gtest-rule-target,$$(art_gtest_name),$$(art_gtest_filename),$(2),$$($(2)library_path)))
440
441 # Clear locally defined variables.
442 art_gtest_filename :=
443 art_gtest_name :=
444 library_path :=
445 2ND_library_path :=
446endef # define-art-gtest-target
447
448# $(1): file name
449# $(2): 2ND_ or undefined - used to differentiate between the primary and secondary architecture.
450define define-art-gtest-host
451 art_gtest_filename := $(1)
452
453 include $$(CLEAR_VARS)
454 art_gtest_name := $$(notdir $$(basename $$(art_gtest_filename)))
455 ifndef ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES
456 ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES :=
457 ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
458 endif
459 $$(eval $$(call define-art-gtest-rule-host,$$(art_gtest_name),$$(art_gtest_filename),$(2)))
460
461 # Clear locally defined variables.
462 art_gtest_filename :=
463 art_gtest_name :=
464endef # define-art-gtest-host
465
466# Define the rules to build and run gtests for both archs on target.
467# $(1): test name
468define define-art-gtest-target-both
469 art_gtest_name := $(1)
Andreas Gampeafbaa1a2014-03-25 18:09:32 -0700470
Ian Rogersafd9acc2014-06-17 08:21:54 -0700471 # A rule to run the different architecture versions of the gtest.
472.PHONY: test-art-target-gtest-$$(art_gtest_name)
473test-art-target-gtest-$$(art_gtest_name): $$(ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES)
474 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
475
Anton Kirilove5e76f42016-05-03 16:15:36 +0100476.PHONY: valgrind-test-art-target-gtest-$$(art_gtest_name)
477valgrind-test-art-target-gtest-$$(art_gtest_name): $$(ART_TEST_TARGET_VALGRIND_GTEST_$$(art_gtest_name)_RULES)
478 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
479
Nicolas Geoffray6bbea4c2016-09-16 16:41:43 +0100480 # Clear now unused variables.
481 ART_TEST_TARGET_GTEST_$$(art_gtest_name)_RULES :=
482 ART_TEST_TARGET_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
483 art_gtest_name :=
484endef # define-art-gtest-target-both
Ian Rogersd912e5c2013-11-13 12:40:11 -0800485
Nicolas Geoffray6bbea4c2016-09-16 16:41:43 +0100486# Define the rules to build and run gtests for both archs on host.
487# $(1): test name
488define define-art-gtest-host-both
489 art_gtest_name := $(1)
490
Ian Rogersafd9acc2014-06-17 08:21:54 -0700491.PHONY: test-art-host-gtest-$$(art_gtest_name)
492test-art-host-gtest-$$(art_gtest_name): $$(ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES)
493 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
Ian Rogersd912e5c2013-11-13 12:40:11 -0800494
Ian Rogersafd9acc2014-06-17 08:21:54 -0700495.PHONY: valgrind-test-art-host-gtest-$$(art_gtest_name)
496valgrind-test-art-host-gtest-$$(art_gtest_name): $$(ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES)
497 $$(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
498
Nicolas Geoffray6bbea4c2016-09-16 16:41:43 +0100499 # Clear now unused variables.
500 ART_TEST_HOST_GTEST_$$(art_gtest_name)_RULES :=
501 ART_TEST_HOST_VALGRIND_GTEST_$$(art_gtest_name)_RULES :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700502 art_gtest_name :=
Nicolas Geoffray6bbea4c2016-09-16 16:41:43 +0100503endef # define-art-gtest-host-both
Alex Light50fa9932015-08-10 15:30:07 -0700504
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700505ifeq ($(ART_BUILD_TARGET),true)
Nicolas Geoffray6bbea4c2016-09-16 16:41:43 +0100506 $(foreach file,$(ART_TARGET_GTEST_FILES), $(eval $(call define-art-gtest-target,$(file),)))
507 ifdef TARGET_2ND_ARCH
508 $(foreach file,$(2ND_ART_TARGET_GTEST_FILES), $(eval $(call define-art-gtest-target,$(file),2ND_)))
509 endif
510 # Rules to run the different architecture versions of the gtest.
511 $(foreach file,$(ART_TARGET_GTEST_FILES), $(eval $(call define-art-gtest-target-both,$$(notdir $$(basename $$(file))))))
Brian Carlstrom4b620ff2011-09-11 01:11:01 -0700512endif
Ian Rogersc5f17732014-06-05 20:48:42 -0700513ifeq ($(ART_BUILD_HOST),true)
Nicolas Geoffray6bbea4c2016-09-16 16:41:43 +0100514 $(foreach file,$(ART_HOST_GTEST_FILES), $(eval $(call define-art-gtest-host,$(file),)))
515 ifneq ($(HOST_PREFER_32_BIT),true)
516 $(foreach file,$(2ND_ART_HOST_GTEST_FILES), $(eval $(call define-art-gtest-host,$(file),2ND_)))
517 endif
518 # Rules to run the different architecture versions of the gtest.
519 $(foreach file,$(ART_HOST_GTEST_FILES), $(eval $(call define-art-gtest-host-both,$$(notdir $$(basename $$(file))))))
Brian Carlstrom07d579f2011-07-27 13:31:51 -0700520endif
Tsu Chiang Chuangec245a42014-05-15 21:16:21 -0700521
522# Used outside the art project to get a list of the current tests
523RUNTIME_TARGET_GTEST_MAKE_TARGETS :=
Colin Cross6e95dd52016-09-12 15:37:10 -0700524$(foreach file, $(ART_TARGET_GTEST_FILES), $(eval RUNTIME_TARGET_GTEST_MAKE_TARGETS += $$(notdir $$(basename $$(file)))))
Tsu Chiang Chuangec245a42014-05-15 21:16:21 -0700525COMPILER_TARGET_GTEST_MAKE_TARGETS :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700526
527# Define all the combinations of host/target, valgrind and suffix such as:
528# test-art-host-gtest or valgrind-test-art-host-gtest64
529# $(1): host or target
530# $(2): HOST or TARGET
531# $(3): valgrind- or undefined
532# $(4): undefined, 32 or 64
533define define-test-art-gtest-combination
534 ifeq ($(1),host)
535 ifneq ($(2),HOST)
536 $$(error argument mismatch $(1) and ($2))
537 endif
538 else
539 ifneq ($(1),target)
540 $$(error found $(1) expected host or target)
541 endif
542 ifneq ($(2),TARGET)
543 $$(error argument mismatch $(1) and ($2))
544 endif
545 endif
546
547 rule_name := $(3)test-art-$(1)-gtest$(4)
Andreas Gampe928f72b2014-09-09 19:53:48 -0700548 ifeq ($(3),valgrind-)
Andreas Gampe928f72b2014-09-09 19:53:48 -0700549 dependencies := $$(ART_TEST_$(2)_VALGRIND_GTEST$(4)_RULES)
550 else
551 dependencies := $$(ART_TEST_$(2)_GTEST$(4)_RULES)
552 endif
Ian Rogersafd9acc2014-06-17 08:21:54 -0700553
554.PHONY: $$(rule_name)
555$$(rule_name): $$(dependencies)
556 $(hide) $$(call ART_TEST_PREREQ_FINISHED,$$@)
557
558 # Clear locally defined variables.
559 rule_name :=
560 dependencies :=
561endef # define-test-art-gtest-combination
562
563$(eval $(call define-test-art-gtest-combination,target,TARGET,,))
Anton Kirilove5e76f42016-05-03 16:15:36 +0100564$(eval $(call define-test-art-gtest-combination,target,TARGET,valgrind-,))
Ian Rogersafd9acc2014-06-17 08:21:54 -0700565$(eval $(call define-test-art-gtest-combination,target,TARGET,,$(ART_PHONY_TEST_TARGET_SUFFIX)))
Anton Kirilove5e76f42016-05-03 16:15:36 +0100566$(eval $(call define-test-art-gtest-combination,target,TARGET,valgrind-,$(ART_PHONY_TEST_TARGET_SUFFIX)))
Ian Rogersafd9acc2014-06-17 08:21:54 -0700567ifdef TARGET_2ND_ARCH
568$(eval $(call define-test-art-gtest-combination,target,TARGET,,$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)))
Anton Kirilove5e76f42016-05-03 16:15:36 +0100569$(eval $(call define-test-art-gtest-combination,target,TARGET,valgrind-,$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)))
Ian Rogersafd9acc2014-06-17 08:21:54 -0700570endif
571$(eval $(call define-test-art-gtest-combination,host,HOST,,))
572$(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,))
573$(eval $(call define-test-art-gtest-combination,host,HOST,,$(ART_PHONY_TEST_HOST_SUFFIX)))
574$(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,$(ART_PHONY_TEST_HOST_SUFFIX)))
575ifneq ($(HOST_PREFER_32_BIT),true)
576$(eval $(call define-test-art-gtest-combination,host,HOST,,$(2ND_ART_PHONY_TEST_HOST_SUFFIX)))
577$(eval $(call define-test-art-gtest-combination,host,HOST,valgrind-,$(2ND_ART_PHONY_TEST_HOST_SUFFIX)))
578endif
579
580# Clear locally defined variables.
581define-art-gtest-rule-target :=
582define-art-gtest-rule-host :=
583define-art-gtest :=
584define-test-art-gtest-combination :=
585RUNTIME_GTEST_COMMON_SRC_FILES :=
586COMPILER_GTEST_COMMON_SRC_FILES :=
587RUNTIME_GTEST_TARGET_SRC_FILES :=
588RUNTIME_GTEST_HOST_SRC_FILES :=
589COMPILER_GTEST_TARGET_SRC_FILES :=
590COMPILER_GTEST_HOST_SRC_FILES :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700591ART_TEST_HOST_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
592ART_TEST_HOST_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
593ART_TEST_HOST_GTEST_RULES :=
594ART_TEST_HOST_VALGRIND_GTEST$(ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
595ART_TEST_HOST_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_HOST_SUFFIX)_RULES :=
596ART_TEST_HOST_VALGRIND_GTEST_RULES :=
597ART_TEST_TARGET_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
598ART_TEST_TARGET_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
599ART_TEST_TARGET_GTEST_RULES :=
Anton Kirilove5e76f42016-05-03 16:15:36 +0100600ART_TEST_TARGET_VALGRIND_GTEST$(ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
601ART_TEST_TARGET_VALGRIND_GTEST$(2ND_ART_PHONY_TEST_TARGET_SUFFIX)_RULES :=
602ART_TEST_TARGET_VALGRIND_GTEST_RULES :=
Nicolas Geoffray96a37c82014-10-29 23:50:40 +0000603ART_GTEST_TARGET_ANDROID_ROOT :=
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700604ART_GTEST_class_linker_test_DEX_DEPS :=
Mathieu Chartierdb70ce52016-12-12 11:06:59 -0800605ART_GTEST_class_table_test_DEX_DEPS :=
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700606ART_GTEST_compiler_driver_test_DEX_DEPS :=
607ART_GTEST_dex_file_test_DEX_DEPS :=
608ART_GTEST_exception_test_DEX_DEPS :=
609ART_GTEST_elf_writer_test_HOST_DEPS :=
610ART_GTEST_elf_writer_test_TARGET_DEPS :=
Andreas Gampea1ff30f2016-09-27 12:19:45 -0700611ART_GTEST_imtable_test_DEX_DEPS :=
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700612ART_GTEST_jni_compiler_test_DEX_DEPS :=
613ART_GTEST_jni_internal_test_DEX_DEPS :=
Richard Uhler66d874d2015-01-15 09:37:19 -0800614ART_GTEST_oat_file_assistant_test_DEX_DEPS :=
615ART_GTEST_oat_file_assistant_test_HOST_DEPS :=
616ART_GTEST_oat_file_assistant_test_TARGET_DEPS :=
Andreas Gampee1459ae2016-06-29 09:36:30 -0700617ART_GTEST_dex2oat_test_DEX_DEPS :=
618ART_GTEST_dex2oat_test_HOST_DEPS :=
619ART_GTEST_dex2oat_test_TARGET_DEPS :=
Brian Carlstromeb85f2b2014-06-25 13:23:00 -0700620ART_GTEST_object_test_DEX_DEPS :=
621ART_GTEST_proxy_test_DEX_DEPS :=
622ART_GTEST_reflection_test_DEX_DEPS :=
623ART_GTEST_stub_test_DEX_DEPS :=
624ART_GTEST_transaction_test_DEX_DEPS :=
Andreas Gampee1459ae2016-06-29 09:36:30 -0700625ART_GTEST_dex2oat_environment_tests_DEX_DEPS :=
David Brazdilca3c8c32016-09-06 14:04:48 +0100626ART_GTEST_verifier_deps_test_DEX_DEPS :=
Andreas Gampe3c0bb312015-02-19 10:02:19 -0800627ART_VALGRIND_DEPENDENCIES :=
Anton Kirilove5e76f42016-05-03 16:15:36 +0100628ART_VALGRIND_TARGET_DEPENDENCIES :=
Ian Rogers1a2f84e2014-07-07 16:05:18 -0700629$(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval ART_TEST_TARGET_GTEST_$(dir)_DEX :=))
630$(foreach dir,$(GTEST_DEX_DIRECTORIES), $(eval ART_TEST_HOST_GTEST_$(dir)_DEX :=))
Richard Uhler66d874d2015-01-15 09:37:19 -0800631ART_TEST_HOST_GTEST_MainStripped_DEX :=
632ART_TEST_TARGET_GTEST_MainStripped_DEX :=
David Brazdilca3c8c32016-09-06 14:04:48 +0100633ART_TEST_GTEST_VerifierDeps_SRC :=
634ART_TEST_HOST_GTEST_VerifierDeps_DEX :=
David Brazdilf906f122016-09-16 16:33:31 +0100635ART_TEST_TARGET_GTEST_VerifierDeps_DEX :=
Ian Rogersafd9acc2014-06-17 08:21:54 -0700636GTEST_DEX_DIRECTORIES :=
Brian Carlstrom532714a2014-06-25 02:15:31 -0700637LOCAL_PATH :=