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