Carl Shapiro | 008e412 | 2011-06-23 17:27:46 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2011 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 17 | LOCAL_PATH := art |
| 18 | |
Brian Carlstrom | 51c2467 | 2013-07-11 16:00:56 -0700 | [diff] [blame] | 19 | TEST_COMMON_SRC_FILES := \ |
Brian Carlstrom | ba150c3 | 2013-08-27 17:31:03 -0700 | [diff] [blame] | 20 | compiler/dex/arena_allocator_test.cc \ |
Ian Rogers | 166db04 | 2013-07-26 12:05:57 -0700 | [diff] [blame] | 21 | compiler/driver/compiler_driver_test.cc \ |
| 22 | compiler/elf_writer_test.cc \ |
Ian Rogers | 0e480ca | 2013-08-16 14:36:13 -0700 | [diff] [blame] | 23 | compiler/image_test.cc \ |
Ian Rogers | 166db04 | 2013-07-26 12:05:57 -0700 | [diff] [blame] | 24 | compiler/jni/jni_compiler_test.cc \ |
Ian Rogers | 500793f | 2013-11-14 17:49:12 -0800 | [diff] [blame] | 25 | compiler/leb128_encoder_test.cc \ |
Ian Rogers | 0e480ca | 2013-08-16 14:36:13 -0700 | [diff] [blame] | 26 | compiler/oat_test.cc \ |
| 27 | compiler/output_stream_test.cc \ |
Mathieu Chartier | 193bad9 | 2013-08-29 18:46:00 -0700 | [diff] [blame] | 28 | compiler/utils/dedupe_set_test.cc \ |
Ian Rogers | 166db04 | 2013-07-26 12:05:57 -0700 | [diff] [blame] | 29 | compiler/utils/arm/managed_register_arm_test.cc \ |
| 30 | compiler/utils/x86/managed_register_x86_test.cc \ |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 31 | runtime/barrier_test.cc \ |
Brian Carlstrom | ba150c3 | 2013-08-27 17:31:03 -0700 | [diff] [blame] | 32 | runtime/base/bit_vector_test.cc \ |
Ian Rogers | 43b2e0f | 2014-01-30 16:58:39 -0800 | [diff] [blame^] | 33 | runtime/base/hex_dump_test.cc \ |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 34 | runtime/base/histogram_test.cc \ |
| 35 | runtime/base/mutex_test.cc \ |
Anwar Ghuloum | 4446ab9 | 2013-08-09 21:17:25 -0700 | [diff] [blame] | 36 | runtime/base/timing_logger_test.cc \ |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 37 | runtime/base/unix_file/fd_file_test.cc \ |
| 38 | runtime/base/unix_file/mapped_file_test.cc \ |
| 39 | runtime/base/unix_file/null_file_test.cc \ |
| 40 | runtime/base/unix_file/random_access_file_utils_test.cc \ |
| 41 | runtime/base/unix_file/string_file_test.cc \ |
| 42 | runtime/class_linker_test.cc \ |
| 43 | runtime/dex_file_test.cc \ |
| 44 | runtime/dex_instruction_visitor_test.cc \ |
| 45 | runtime/dex_method_iterator_test.cc \ |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 46 | runtime/entrypoints/math_entrypoints_test.cc \ |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 47 | runtime/exception_test.cc \ |
| 48 | runtime/gc/accounting/space_bitmap_test.cc \ |
| 49 | runtime/gc/heap_test.cc \ |
| 50 | runtime/gc/space/space_test.cc \ |
| 51 | runtime/gtest_test.cc \ |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 52 | runtime/indenter_test.cc \ |
| 53 | runtime/indirect_reference_table_test.cc \ |
| 54 | runtime/intern_table_test.cc \ |
| 55 | runtime/jni_internal_test.cc \ |
Brian Carlstrom | 9004cb6 | 2013-07-26 15:48:31 -0700 | [diff] [blame] | 56 | runtime/mem_map_test.cc \ |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 57 | runtime/mirror/dex_cache_test.cc \ |
| 58 | runtime/mirror/object_test.cc \ |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 59 | runtime/reference_table_test.cc \ |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 60 | runtime/runtime_test.cc \ |
| 61 | runtime/thread_pool_test.cc \ |
| 62 | runtime/utils_test.cc \ |
| 63 | runtime/verifier/method_verifier_test.cc \ |
| 64 | runtime/verifier/reg_type_test.cc \ |
Ian Rogers | 166db04 | 2013-07-26 12:05:57 -0700 | [diff] [blame] | 65 | runtime/zip_archive_test.cc |
Brian Carlstrom | 51c2467 | 2013-07-11 16:00:56 -0700 | [diff] [blame] | 66 | |
Dragos Sbirlea | 8cc5162 | 2013-06-21 09:20:34 -0700 | [diff] [blame] | 67 | ifeq ($(ART_SEA_IR_MODE),true) |
| 68 | TEST_COMMON_SRC_FILES += \ |
Dragos Sbirlea | 423fb4d | 2013-08-05 18:33:30 -0700 | [diff] [blame] | 69 | compiler/utils/scoped_hashtable_test.cc \ |
| 70 | compiler/sea_ir/types/type_data_test.cc \ |
Dragos Sbirlea | 597e46b | 2013-08-07 18:15:44 -0700 | [diff] [blame] | 71 | compiler/sea_ir/types/type_inference_visitor_test.cc \ |
| 72 | compiler/sea_ir/ir/regions_test.cc |
Dragos Sbirlea | 8cc5162 | 2013-06-21 09:20:34 -0700 | [diff] [blame] | 73 | endif |
| 74 | |
Brian Carlstrom | 51c2467 | 2013-07-11 16:00:56 -0700 | [diff] [blame] | 75 | TEST_TARGET_SRC_FILES := \ |
| 76 | $(TEST_COMMON_SRC_FILES) |
| 77 | |
| 78 | TEST_HOST_SRC_FILES := \ |
| 79 | $(TEST_COMMON_SRC_FILES) \ |
Ian Rogers | 166db04 | 2013-07-26 12:05:57 -0700 | [diff] [blame] | 80 | compiler/utils/x86/assembler_x86_test.cc |
Brian Carlstrom | 51c2467 | 2013-07-11 16:00:56 -0700 | [diff] [blame] | 81 | |
Brian Carlstrom | 8ecd08c | 2011-07-27 17:50:51 -0700 | [diff] [blame] | 82 | ART_HOST_TEST_EXECUTABLES := |
| 83 | ART_TARGET_TEST_EXECUTABLES := |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 84 | ART_HOST_TEST_TARGETS := |
Ian Rogers | 86aed2a | 2013-11-13 15:56:44 -0800 | [diff] [blame] | 85 | ART_HOST_VALGRIND_TEST_TARGETS := |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 86 | ART_TARGET_TEST_TARGETS := |
Brian Carlstrom | 8ecd08c | 2011-07-27 17:50:51 -0700 | [diff] [blame] | 87 | |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 88 | ART_TEST_CFLAGS := |
buzbee | c531cef | 2012-10-18 07:09:20 -0700 | [diff] [blame] | 89 | ifeq ($(ART_USE_PORTABLE_COMPILER),true) |
| 90 | ART_TEST_CFLAGS += -DART_USE_PORTABLE_COMPILER=1 |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 91 | endif |
| 92 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 93 | # $(1): target or host |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 94 | # $(2): file name |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 95 | define build-art-test |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 96 | ifneq ($(1),target) |
| 97 | ifneq ($(1),host) |
| 98 | $$(error expected target or host for argument 1, received $(1)) |
| 99 | endif |
| 100 | endif |
| 101 | |
| 102 | art_target_or_host := $(1) |
| 103 | art_gtest_filename := $(2) |
| 104 | |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 105 | art_gtest_name := $$(notdir $$(basename $$(art_gtest_filename))) |
| 106 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 107 | include $(CLEAR_VARS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 108 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 109 | include external/stlport/libstlport.mk |
| 110 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 111 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 112 | LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION) |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 113 | LOCAL_MODULE := $$(art_gtest_name) |
Brian Carlstrom | 871599a | 2012-09-06 13:27:49 -0700 | [diff] [blame] | 114 | ifeq ($$(art_target_or_host),target) |
| 115 | LOCAL_MODULE_TAGS := tests |
| 116 | endif |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 117 | LOCAL_SRC_FILES := $$(art_gtest_filename) runtime/common_test.cc |
| 118 | LOCAL_C_INCLUDES += $(ART_C_INCLUDES) art/runtime art/compiler |
Elliott Hughes | 025218c | 2013-07-30 17:13:06 -0700 | [diff] [blame] | 119 | LOCAL_SHARED_LIBRARIES += libartd-compiler libartd |
Brian Carlstrom | 0cb7853 | 2013-07-16 17:17:47 -0700 | [diff] [blame] | 120 | # dex2oatd is needed to go libartd-compiler and libartd |
Elliott Hughes | 025218c | 2013-07-30 17:13:06 -0700 | [diff] [blame] | 121 | LOCAL_REQUIRED_MODULES := dex2oatd |
Brian Carlstrom | 4478eb0 | 2013-07-14 21:05:57 -0700 | [diff] [blame] | 122 | |
Brian Carlstrom | 17bfe26 | 2013-07-16 17:31:22 -0700 | [diff] [blame] | 123 | LOCAL_ADDITIONAL_DEPENDENCIES := art/build/Android.common.mk |
Brian Carlstrom | 7940e44 | 2013-07-12 13:46:57 -0700 | [diff] [blame] | 124 | LOCAL_ADDITIONAL_DEPENDENCIES += art/build/Android.gtest.mk |
Brian Carlstrom | b9cc1ca | 2012-01-27 00:57:42 -0800 | [diff] [blame] | 125 | |
Elliott Hughes | 0f09676 | 2012-01-31 10:32:46 -0800 | [diff] [blame] | 126 | # Mac OS linker doesn't understand --export-dynamic. |
| 127 | ifneq ($(HOST_OS)-$$(art_target_or_host),darwin-host) |
Elliott Hughes | b264f08 | 2012-04-06 17:10:10 -0700 | [diff] [blame] | 128 | # Allow jni_compiler_test to find Java_MyClassNatives_bar within itself using dlopen(NULL, ...). |
| 129 | LOCAL_LDFLAGS := -Wl,--export-dynamic -Wl,-u,Java_MyClassNatives_bar -Wl,-u,Java_MyClassNatives_sbar |
Brian Carlstrom | cfede66 | 2012-01-29 17:25:54 -0800 | [diff] [blame] | 130 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 131 | |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 132 | LOCAL_CFLAGS := $(ART_TEST_CFLAGS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 133 | ifeq ($$(art_target_or_host),target) |
Ian Rogers | cd5d042 | 2013-05-17 15:54:01 -0700 | [diff] [blame] | 134 | LOCAL_CLANG := $(ART_TARGET_CLANG) |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 135 | LOCAL_CFLAGS += $(ART_TARGET_CFLAGS) $(ART_TARGET_DEBUG_CFLAGS) |
Elliott Hughes | 025218c | 2013-07-30 17:13:06 -0700 | [diff] [blame] | 136 | LOCAL_SHARED_LIBRARIES += libdl libicuuc libicui18n libnativehelper libz libcutils |
Elliott Hughes | eb02a12 | 2012-06-12 11:35:40 -0700 | [diff] [blame] | 137 | LOCAL_STATIC_LIBRARIES += libgtest |
Brian Carlstrom | 32b4b2a | 2012-01-31 16:21:40 -0800 | [diff] [blame] | 138 | LOCAL_MODULE_PATH := $(ART_NATIVETEST_OUT) |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 139 | include $(LLVM_DEVICE_BUILD_MK) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 140 | include $(BUILD_EXECUTABLE) |
Brian Carlstrom | b9cc1ca | 2012-01-27 00:57:42 -0800 | [diff] [blame] | 141 | art_gtest_exe := $$(LOCAL_MODULE_PATH)/$$(LOCAL_MODULE) |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 142 | ART_TARGET_TEST_EXECUTABLES += $$(art_gtest_exe) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 143 | else # host |
Ian Rogers | cd5d042 | 2013-05-17 15:54:01 -0700 | [diff] [blame] | 144 | LOCAL_CLANG := $(ART_HOST_CLANG) |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 145 | LOCAL_CFLAGS += $(ART_HOST_CFLAGS) $(ART_HOST_DEBUG_CFLAGS) |
Elliott Hughes | 18c0753 | 2011-08-18 15:50:51 -0700 | [diff] [blame] | 146 | LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host libnativehelper libz-host |
Mathieu Chartier | 0e4627e | 2012-10-23 16:13:36 -0700 | [diff] [blame] | 147 | LOCAL_STATIC_LIBRARIES += libcutils |
Elliott Hughes | eb02a12 | 2012-06-12 11:35:40 -0700 | [diff] [blame] | 148 | ifeq ($(HOST_OS),darwin) |
| 149 | # Mac OS complains about unresolved symbols if you don't include this. |
| 150 | LOCAL_WHOLE_STATIC_LIBRARIES := libgtest_host |
Elliott Hughes | 34cf514 | 2012-01-20 16:39:13 -0800 | [diff] [blame] | 151 | endif |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 152 | include $(LLVM_HOST_BUILD_MK) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 153 | include $(BUILD_HOST_EXECUTABLE) |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 154 | art_gtest_exe := $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE) |
| 155 | ART_HOST_TEST_EXECUTABLES += $$(art_gtest_exe) |
Brian Carlstrom | 8ecd08c | 2011-07-27 17:50:51 -0700 | [diff] [blame] | 156 | endif |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 157 | art_gtest_target := test-art-$$(art_target_or_host)-gtest-$$(art_gtest_name) |
| 158 | ifeq ($$(art_target_or_host),target) |
| 159 | .PHONY: $$(art_gtest_target) |
| 160 | $$(art_gtest_target): $$(art_gtest_exe) test-art-target-sync |
| 161 | adb shell touch $(ART_TEST_DIR)/$$@ |
| 162 | adb shell rm $(ART_TEST_DIR)/$$@ |
Brian Carlstrom | eaec3ae | 2012-06-17 23:30:57 -0700 | [diff] [blame] | 163 | adb shell chmod 755 $(ART_NATIVETEST_DIR)/$$(notdir $$<) |
Brian Carlstrom | 32b4b2a | 2012-01-31 16:21:40 -0800 | [diff] [blame] | 164 | adb shell sh -c "$(ART_NATIVETEST_DIR)/$$(notdir $$<) && touch $(ART_TEST_DIR)/$$@" |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 165 | $(hide) (adb pull $(ART_TEST_DIR)/$$@ /tmp/ && echo $$@ PASSED) || (echo $$@ FAILED && exit 1) |
| 166 | $(hide) rm /tmp/$$@ |
| 167 | |
| 168 | ART_TARGET_TEST_TARGETS += $$(art_gtest_target) |
| 169 | else |
| 170 | .PHONY: $$(art_gtest_target) |
Brian Carlstrom | b0aa9d3 | 2012-04-07 23:12:22 -0700 | [diff] [blame] | 171 | $$(art_gtest_target): $$(art_gtest_exe) test-art-host-dependencies |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 172 | $$< |
| 173 | @echo $$@ PASSED |
| 174 | |
| 175 | ART_HOST_TEST_TARGETS += $$(art_gtest_target) |
Ian Rogers | d912e5c | 2013-11-13 12:40:11 -0800 | [diff] [blame] | 176 | |
| 177 | .PHONY: valgrind-$$(art_gtest_target) |
| 178 | valgrind-$$(art_gtest_target): $$(art_gtest_exe) test-art-host-dependencies |
Ian Rogers | 86aed2a | 2013-11-13 15:56:44 -0800 | [diff] [blame] | 179 | valgrind --leak-check=full --error-exitcode=1 $$< |
Ian Rogers | d912e5c | 2013-11-13 12:40:11 -0800 | [diff] [blame] | 180 | @echo $$@ PASSED |
| 181 | |
| 182 | ART_HOST_VALGRIND_TEST_TARGETS += valgrind-$$(art_gtest_target) |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 183 | endif |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 184 | endef |
Carl Shapiro | 008e412 | 2011-06-23 17:27:46 -0700 | [diff] [blame] | 185 | |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 186 | ifeq ($(ART_BUILD_TARGET),true) |
| 187 | $(foreach file,$(TEST_TARGET_SRC_FILES), $(eval $(call build-art-test,target,$(file)))) |
| 188 | endif |
Brian Carlstrom | 19e776c | 2013-07-23 12:16:44 -0700 | [diff] [blame] | 189 | ifeq ($(WITH_HOST_DALVIK),true) |
| 190 | ifeq ($(ART_BUILD_HOST),true) |
| 191 | $(foreach file,$(TEST_HOST_SRC_FILES), $(eval $(call build-art-test,host,$(file)))) |
| 192 | endif |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 193 | endif |