Android.mk revision 063cfb2084ea4b12d3c85b2d2c44e888f0857eb4
1# 2# Copyright (C) 2012 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 17ifneq ($(BUILD_TINY_ANDROID), true) 18 19LOCAL_PATH := $(call my-dir) 20 21test_c_flags = \ 22 -fstack-protector \ 23 -g \ 24 -Wall -Wextra \ 25 -Werror \ 26 27test_src_files = \ 28 dirent_test.cpp \ 29 getcwd_test.cpp \ 30 pthread_test.cpp \ 31 regex_test.cpp \ 32 stack_protector_test.cpp \ 33 stdio_test.cpp \ 34 stdlib_test.cpp \ 35 string_test.cpp \ 36 stubs_test.cpp \ 37 38test_dynamic_ldflags = -Wl,--export-dynamic -Wl,-u,DlSymTestFunction 39test_dynamic_src_files = \ 40 dlopen_test.cpp \ 41 42# Build for the device (with bionic's .so). Run with: 43# adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests 44include $(CLEAR_VARS) 45LOCAL_MODULE := bionic-unit-tests 46LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 47LOCAL_CFLAGS += $(test_c_flags) 48LOCAL_LDFLAGS += $(test_dynamic_ldflags) 49LOCAL_SHARED_LIBRARIES += libdl 50LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files) 51include $(BUILD_NATIVE_TEST) 52 53# Build for the device (with bionic's .a). Run with: 54# adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static 55include $(CLEAR_VARS) 56LOCAL_MODULE := bionic-unit-tests-static 57LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 58LOCAL_CFLAGS += $(test_c_flags) 59LOCAL_FORCE_STATIC_EXECUTABLE := true 60LOCAL_SRC_FILES := $(test_src_files) 61LOCAL_STATIC_LIBRARIES += libstlport_static libstdc++ libm libc 62include $(BUILD_NATIVE_TEST) 63 64# Build for the host (with glibc). 65# Note that this will build against glibc, so it's not useful for testing 66# bionic's implementation, but it does let you use glibc as a reference 67# implementation for testing the tests themselves. 68ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86) 69include $(CLEAR_VARS) 70LOCAL_MODULE := bionic-unit-tests-glibc 71LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 72LOCAL_CFLAGS += $(test_c_flags) 73LOCAL_LDFLAGS += -lpthread -ldl 74LOCAL_LDFLAGS += $(test_dynamic_ldflags) 75LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files) 76include $(BUILD_HOST_NATIVE_TEST) 77endif 78 79endif # !BUILD_TINY_ANDROID 80