blob: 9dabd4f2194da6c4fd53330dbe76bd0572fa3243 [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
Brian Carlstrom8ecd08c2011-07-27 17:50:51 -070017ART_HOST_TEST_EXECUTABLES :=
18ART_TARGET_TEST_EXECUTABLES :=
19
Brian Carlstrom07d579f2011-07-27 13:31:51 -070020# $(1): target or host
21# $(2): file name with .cc or .cc.arm extension
22define build-art-test
23 include $(CLEAR_VARS)
24 ifeq ($(1),target)
25 include external/stlport/libstlport.mk
26 endif
27 LOCAL_CPP_EXTENSION := $(ART_CPP_EXTENSION)
28 LOCAL_MODULE := $(notdir $(basename $(2:%.arm=%)))
29 LOCAL_MODULE_TAGS := tests
30 LOCAL_SRC_FILES := $(2)
Brian Carlstrom74eb46a2011-08-02 20:10:14 -070031 LOCAL_CFLAGS := $(ART_CFLAGS) -UNDEBUG
Brian Carlstromb0460ea2011-07-29 10:08:05 -070032 LOCAL_C_INCLUDES += $(ART_C_INCLUDES)
Brian Carlstrom8ecd08c2011-07-27 17:50:51 -070033 LOCAL_SHARED_LIBRARIES := libarttest libartd
Brian Carlstrom07d579f2011-07-27 13:31:51 -070034 ifeq ($(1),target)
Elliott Hughes18c07532011-08-18 15:50:51 -070035 LOCAL_SHARED_LIBRARIES += libdl libicuuc libicui18n libnativehelper libstlport libz
Brian Carlstrom07d579f2011-07-27 13:31:51 -070036 LOCAL_STATIC_LIBRARIES := libgtest libgtest_main
37 else
Elliott Hughes18c07532011-08-18 15:50:51 -070038 LOCAL_SHARED_LIBRARIES += libicuuc-host libicui18n-host libnativehelper libz-host
Brian Carlstrom07d579f2011-07-27 13:31:51 -070039 LOCAL_WHOLE_STATIC_LIBRARIES := libgtest_host libgtest_main_host
40 endif
41 ifeq ($(1),target)
42 include $(BUILD_EXECUTABLE)
43 else
44 include $(BUILD_HOST_EXECUTABLE)
45 endif
Brian Carlstrom8ecd08c2011-07-27 17:50:51 -070046 ifeq ($(1),target)
47 ART_TARGET_TEST_EXECUTABLES += $(TARGET_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
48 else
49 ART_HOST_TEST_EXECUTABLES += $(HOST_OUT_EXECUTABLES)/$$(LOCAL_MODULE)
50 endif
Brian Carlstrom07d579f2011-07-27 13:31:51 -070051endef
Carl Shapiro008e4122011-06-23 17:27:46 -070052
Brian Carlstrom07d579f2011-07-27 13:31:51 -070053$(foreach file,$(TEST_TARGET_SRC_FILES), $(eval $(call build-art-test,target,$(file))))
54ifeq ($(WITH_HOST_DALVIK),true)
55 $(foreach file,$(TEST_HOST_SRC_FILES), $(eval $(call build-art-test,host,$(file))))
56endif
Brian Carlstrom9f30b382011-08-28 22:41:38 -070057
58ART_TEST_DEX_FILES :=
59
60# $(1): directory
61define build-art-test-dex
62 include $(CLEAR_VARS)
63 LOCAL_MODULE := art-test-dex-$(1)
64 LOCAL_MODULE_TAGS := optional
65 LOCAL_SRC_FILES := $(call all-java-files-under, test/$(1))
Brian Carlstrom881dd562011-08-30 09:09:07 -070066 LOCAL_JAVA_LIBRARIES := core
67 LOCAL_NO_STANDARD_LIBRARIES := true
Brian Carlstrom9f30b382011-08-28 22:41:38 -070068 include $(BUILD_JAVA_LIBRARY)
69 ART_TEST_DEX_FILES += $(TARGET_OUT_JAVA_LIBRARIES)/$$(LOCAL_MODULE).jar
70endef
71$(foreach dir,$(TEST_DEX_DIRECTORIES), $(eval $(call build-art-test-dex,$(dir))))