1 # Copyright (C) 2009 The Android Open Source Project 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 # 15 16 # To integrate with the nightly build, we use 17 # LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS) 18 # to put the tests under /data and not /system/bin (default). 19 20 LOCAL_PATH := $(call my-dir) 21 22 libastl_test_includes:= \ 23 bionic/libstdc++/include \ 24 external/astl/include 25 libastl_test_static_lib := libastl 26 libastl_test_host_static_lib := libastl_host 27 28 # $(3) and $(5) must be set or cleared in sync. $(3) is used to 29 # generate the right make target (host vs device). $(5) is used in the 30 # module's name to have different name for the host vs device 31 # builds. Also $(5) is used to pickup the right set of libraries, 32 # typically the host libs have a _host suffix in their names. 33 # $(1): source list 34 # $(2): tags 35 # $(3): "HOST_" or empty 36 # $(4): extra CFLAGS or empty 37 # $(5): "_host" or empty 38 define _define-test 39 $(foreach file,$(1), \ 40 $(eval include $(CLEAR_VARS)) \ 41 $(eval LOCAL_SRC_FILES := $(file)) \ 42 $(eval LOCAL_C_INCLUDES := $(libastl_test_includes)) \ 43 $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))$(5)) \ 44 $(eval LOCAL_CFLAGS += $(4)) \ 45 $(eval LOCAL_STATIC_LIBRARIES := $(libastl_test$(5)_static_lib)) \ 46 $(eval LOCAL_MODULE_TAGS := $(2) ) \ 47 $(eval $(if $(3),,LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS))) \ 48 $(eval include $(BUILD_$(3)EXECUTABLE)) \ 49 ) 50 endef 51 52 ifeq ($(HOST_OS),linux) 53 # Compile using the host only on linux for valgrind support. 54 define host-test 55 $(call _define-test,$(1),eng,HOST_,-O0 -g,_host) 56 endef 57 endif 58 59 define target-test 60 $(call _define-test,$(1),eng tests) 61 endef 62 63 sources := \ 64 test_algorithm.cpp \ 65 test_char_traits.cpp \ 66 test_functional.cpp \ 67 test_ios_base.cpp \ 68 test_iomanip.cpp \ 69 test_ios_pos_types.cpp \ 70 test_iostream.cpp \ 71 test_iterator.cpp \ 72 test_limits.cpp \ 73 test_list.cpp \ 74 test_memory.cpp \ 75 test_set.cpp \ 76 test_sstream.cpp \ 77 test_streambuf.cpp \ 78 test_string.cpp \ 79 test_type_traits.cpp \ 80 test_uninitialized.cpp \ 81 test_vector.cpp 82 83 ifeq ($(HOST_OS),linux) 84 $(call host-test, $(sources)) 85 endif 86 87 $(call device-test, $(sources)) 88