Android.mk revision 124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1
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
66
67
68# Build no-elf-hash-table-library.so to test dlopen(3) on a library that
69# only has a GNU-style hash table.
70include $(CLEAR_VARS)
71LOCAL_MODULE := no-elf-hash-table-library
72LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
73LOCAL_SRC_FILES := empty.cpp
74LOCAL_LDFLAGS := -Wl,--hash-style=gnu
75include $(BUILD_SHARED_LIBRARY)
76
77
78
79
80# Build for the host (with glibc).
81# Note that this will build against glibc, so it's not useful for testing
82# bionic's implementation, but it does let you use glibc as a reference
83# implementation for testing the tests themselves.
84ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
85include $(CLEAR_VARS)
86LOCAL_MODULE := bionic-unit-tests-glibc
87LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
88LOCAL_CFLAGS += $(test_c_flags)
89LOCAL_LDFLAGS += -lpthread -ldl
90LOCAL_LDFLAGS += $(test_dynamic_ldflags)
91LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files)
92include $(BUILD_HOST_NATIVE_TEST)
93endif
94
95endif # !BUILD_TINY_ANDROID
96