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 | 51c2467 | 2013-07-11 16:00:56 -0700 | [diff] [blame] | 17 | TEST_COMMON_SRC_FILES := \ |
| 18 | src/barrier_test.cc \ |
| 19 | src/base/histogram_test.cc \ |
| 20 | src/base/mutex_test.cc \ |
| 21 | src/base/unix_file/fd_file_test.cc \ |
| 22 | src/base/unix_file/mapped_file_test.cc \ |
| 23 | src/base/unix_file/null_file_test.cc \ |
| 24 | src/base/unix_file/random_access_file_utils_test.cc \ |
| 25 | src/base/unix_file/string_file_test.cc \ |
| 26 | src/class_linker_test.cc \ |
| 27 | src/compiler/driver/compiler_driver_test.cc \ |
| 28 | src/compiler/elf_writer_test.cc \ |
| 29 | src/compiler/jni/jni_compiler_test.cc \ |
| 30 | src/dex_file_test.cc \ |
| 31 | src/dex_instruction_visitor_test.cc \ |
| 32 | src/dex_method_iterator_test.cc \ |
| 33 | src/exception_test.cc \ |
| 34 | src/gc/accounting/space_bitmap_test.cc \ |
| 35 | src/gc/heap_test.cc \ |
| 36 | src/gc/space/space_test.cc \ |
| 37 | src/gtest_test.cc \ |
| 38 | src/image_test.cc \ |
| 39 | src/indenter_test.cc \ |
| 40 | src/indirect_reference_table_test.cc \ |
| 41 | src/intern_table_test.cc \ |
| 42 | src/jni_internal_test.cc \ |
| 43 | src/mirror/dex_cache_test.cc \ |
| 44 | src/mirror/object_test.cc \ |
| 45 | src/oat/utils/arm/managed_register_arm_test.cc \ |
| 46 | src/oat/utils/x86/managed_register_x86_test.cc \ |
| 47 | src/oat_test.cc \ |
| 48 | src/output_stream_test.cc \ |
| 49 | src/reference_table_test.cc \ |
| 50 | src/runtime_support_test.cc \ |
| 51 | src/runtime_test.cc \ |
| 52 | src/thread_pool_test.cc \ |
| 53 | src/utils_test.cc \ |
| 54 | src/verifier/method_verifier_test.cc \ |
| 55 | src/verifier/reg_type_test.cc \ |
| 56 | src/zip_archive_test.cc |
| 57 | |
Dragos Sbirlea | 8cc5162 | 2013-06-21 09:20:34 -0700 | [diff] [blame^] | 58 | ifeq ($(ART_SEA_IR_MODE),true) |
| 59 | TEST_COMMON_SRC_FILES += \ |
| 60 | src/compiler/utils/scoped_hashtable_test.cc |
| 61 | endif |
| 62 | |
Brian Carlstrom | 51c2467 | 2013-07-11 16:00:56 -0700 | [diff] [blame] | 63 | TEST_TARGET_SRC_FILES := \ |
| 64 | $(TEST_COMMON_SRC_FILES) |
| 65 | |
| 66 | TEST_HOST_SRC_FILES := \ |
| 67 | $(TEST_COMMON_SRC_FILES) \ |
| 68 | src/oat/utils/x86/assembler_x86_test.cc |
| 69 | |
Brian Carlstrom | 8ecd08c | 2011-07-27 17:50:51 -0700 | [diff] [blame] | 70 | ART_HOST_TEST_EXECUTABLES := |
| 71 | ART_TARGET_TEST_EXECUTABLES := |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 72 | ART_HOST_TEST_TARGETS := |
| 73 | ART_TARGET_TEST_TARGETS := |
Brian Carlstrom | 8ecd08c | 2011-07-27 17:50:51 -0700 | [diff] [blame] | 74 | |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 75 | ART_TEST_CFLAGS := |
buzbee | c531cef | 2012-10-18 07:09:20 -0700 | [diff] [blame] | 76 | ifeq ($(ART_USE_PORTABLE_COMPILER),true) |
| 77 | ART_TEST_CFLAGS += -DART_USE_PORTABLE_COMPILER=1 |
buzbee | 2cfc639 | 2012-05-07 14:51:40 -0700 | [diff] [blame] | 78 | endif |
| 79 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 80 | # $(1): target or host |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 81 | # $(2): file name |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 82 | define build-art-test |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 83 | ifneq ($(1),target) |
| 84 | ifneq ($(1),host) |
| 85 | $$(error expected target or host for argument 1, received $(1)) |
| 86 | endif |
| 87 | endif |
| 88 | |
| 89 | art_target_or_host := $(1) |
| 90 | art_gtest_filename := $(2) |
| 91 | |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 92 | art_gtest_name := $$(notdir $$(basename $$(art_gtest_filename))) |
| 93 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 94 | include $(CLEAR_VARS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 95 | ifeq ($$(art_target_or_host),target) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 96 | include external/stlport/libstlport.mk |
| 97 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 98 | |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 99 | LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION) |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 100 | LOCAL_MODULE := $$(art_gtest_name) |
Brian Carlstrom | 871599a | 2012-09-06 13:27:49 -0700 | [diff] [blame] | 101 | ifeq ($$(art_target_or_host),target) |
| 102 | LOCAL_MODULE_TAGS := tests |
| 103 | endif |
Elliott Hughes | eb02a12 | 2012-06-12 11:35:40 -0700 | [diff] [blame] | 104 | LOCAL_SRC_FILES := $$(art_gtest_filename) src/common_test.cc |
Brian Carlstrom | b0460ea | 2011-07-29 10:08:05 -0700 | [diff] [blame] | 105 | LOCAL_C_INCLUDES += $(ART_C_INCLUDES) |
Brian Carlstrom | 51c2467 | 2013-07-11 16:00:56 -0700 | [diff] [blame] | 106 | LOCAL_SHARED_LIBRARIES := libartd-compiler libartd |
| 107 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/build/Android.common.mk |
| 108 | LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/build/Android.gtest.mk |
Brian Carlstrom | b9cc1ca | 2012-01-27 00:57:42 -0800 | [diff] [blame] | 109 | |
Elliott Hughes | 0f09676 | 2012-01-31 10:32:46 -0800 | [diff] [blame] | 110 | # Mac OS linker doesn't understand --export-dynamic. |
| 111 | ifneq ($(HOST_OS)-$$(art_target_or_host),darwin-host) |
Elliott Hughes | b264f08 | 2012-04-06 17:10:10 -0700 | [diff] [blame] | 112 | # Allow jni_compiler_test to find Java_MyClassNatives_bar within itself using dlopen(NULL, ...). |
| 113 | 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] | 114 | endif |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 115 | |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 116 | LOCAL_CFLAGS := $(ART_TEST_CFLAGS) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 117 | ifeq ($$(art_target_or_host),target) |
Ian Rogers | cd5d042 | 2013-05-17 15:54:01 -0700 | [diff] [blame] | 118 | LOCAL_CLANG := $(ART_TARGET_CLANG) |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 119 | LOCAL_CFLAGS += $(ART_TARGET_CFLAGS) $(ART_TARGET_DEBUG_CFLAGS) |
Mathieu Chartier | 0e4627e | 2012-10-23 16:13:36 -0700 | [diff] [blame] | 120 | LOCAL_SHARED_LIBRARIES += libdl libicuuc libicui18n libnativehelper libstlport libz libcutils |
Elliott Hughes | eb02a12 | 2012-06-12 11:35:40 -0700 | [diff] [blame] | 121 | LOCAL_STATIC_LIBRARIES += libgtest |
Brian Carlstrom | 32b4b2a | 2012-01-31 16:21:40 -0800 | [diff] [blame] | 122 | LOCAL_MODULE_PATH := $(ART_NATIVETEST_OUT) |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 123 | include $(LLVM_DEVICE_BUILD_MK) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 124 | include $(BUILD_EXECUTABLE) |
Brian Carlstrom | b9cc1ca | 2012-01-27 00:57:42 -0800 | [diff] [blame] | 125 | art_gtest_exe := $$(LOCAL_MODULE_PATH)/$$(LOCAL_MODULE) |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 126 | ART_TARGET_TEST_EXECUTABLES += $$(art_gtest_exe) |
Brian Carlstrom | 0796af0 | 2011-10-12 14:31:45 -0700 | [diff] [blame] | 127 | else # host |
Ian Rogers | cd5d042 | 2013-05-17 15:54:01 -0700 | [diff] [blame] | 128 | LOCAL_CLANG := $(ART_HOST_CLANG) |
Shih-wei Liao | c4c9881 | 2012-03-10 21:55:51 -0800 | [diff] [blame] | 129 | LOCAL_CFLAGS += $(ART_HOST_CFLAGS) $(ART_HOST_DEBUG_CFLAGS) |
Elliott Hughes | 18c0753 | 2011-08-18 15:50:51 -0700 | [diff] [blame] | 130 | LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host libnativehelper libz-host |
Mathieu Chartier | 0e4627e | 2012-10-23 16:13:36 -0700 | [diff] [blame] | 131 | LOCAL_STATIC_LIBRARIES += libcutils |
Elliott Hughes | eb02a12 | 2012-06-12 11:35:40 -0700 | [diff] [blame] | 132 | ifeq ($(HOST_OS),darwin) |
| 133 | # Mac OS complains about unresolved symbols if you don't include this. |
| 134 | LOCAL_WHOLE_STATIC_LIBRARIES := libgtest_host |
Elliott Hughes | 34cf514 | 2012-01-20 16:39:13 -0800 | [diff] [blame] | 135 | endif |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 136 | include $(LLVM_HOST_BUILD_MK) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 137 | include $(BUILD_HOST_EXECUTABLE) |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 138 | art_gtest_exe := $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE) |
| 139 | ART_HOST_TEST_EXECUTABLES += $$(art_gtest_exe) |
Brian Carlstrom | 8ecd08c | 2011-07-27 17:50:51 -0700 | [diff] [blame] | 140 | endif |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 141 | art_gtest_target := test-art-$$(art_target_or_host)-gtest-$$(art_gtest_name) |
| 142 | ifeq ($$(art_target_or_host),target) |
| 143 | .PHONY: $$(art_gtest_target) |
| 144 | $$(art_gtest_target): $$(art_gtest_exe) test-art-target-sync |
| 145 | adb shell touch $(ART_TEST_DIR)/$$@ |
| 146 | adb shell rm $(ART_TEST_DIR)/$$@ |
Brian Carlstrom | eaec3ae | 2012-06-17 23:30:57 -0700 | [diff] [blame] | 147 | adb shell chmod 755 $(ART_NATIVETEST_DIR)/$$(notdir $$<) |
Brian Carlstrom | 32b4b2a | 2012-01-31 16:21:40 -0800 | [diff] [blame] | 148 | adb shell sh -c "$(ART_NATIVETEST_DIR)/$$(notdir $$<) && touch $(ART_TEST_DIR)/$$@" |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 149 | $(hide) (adb pull $(ART_TEST_DIR)/$$@ /tmp/ && echo $$@ PASSED) || (echo $$@ FAILED && exit 1) |
| 150 | $(hide) rm /tmp/$$@ |
| 151 | |
| 152 | ART_TARGET_TEST_TARGETS += $$(art_gtest_target) |
| 153 | else |
| 154 | .PHONY: $$(art_gtest_target) |
Brian Carlstrom | b0aa9d3 | 2012-04-07 23:12:22 -0700 | [diff] [blame] | 155 | $$(art_gtest_target): $$(art_gtest_exe) test-art-host-dependencies |
Brian Carlstrom | 47a0d5a | 2011-10-12 21:20:05 -0700 | [diff] [blame] | 156 | $$< |
| 157 | @echo $$@ PASSED |
| 158 | |
| 159 | ART_HOST_TEST_TARGETS += $$(art_gtest_target) |
| 160 | endif |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 161 | endef |
Carl Shapiro | 008e412 | 2011-06-23 17:27:46 -0700 | [diff] [blame] | 162 | |
Brian Carlstrom | 4b620ff | 2011-09-11 01:11:01 -0700 | [diff] [blame] | 163 | ifeq ($(ART_BUILD_TARGET),true) |
| 164 | $(foreach file,$(TEST_TARGET_SRC_FILES), $(eval $(call build-art-test,target,$(file)))) |
| 165 | endif |
| 166 | ifeq ($(ART_BUILD_HOST),true) |
Brian Carlstrom | 07d579f | 2011-07-27 13:31:51 -0700 | [diff] [blame] | 167 | $(foreach file,$(TEST_HOST_SRC_FILES), $(eval $(call build-art-test,host,$(file)))) |
| 168 | endif |