]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/platform-bionic.git/blob - tests/Android.mk
Renamed the misleading libc/netbsd directory to libc/dns.
[android-sdk/platform-bionic.git] / tests / Android.mk
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 #
17 ifneq ($(BUILD_TINY_ANDROID),true)
19 LOCAL_PATH := $(call my-dir)
21 # -----------------------------------------------------------------------------
22 # Unit tests.
23 # -----------------------------------------------------------------------------
25 ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
26 build_host := true
27 else
28 build_host := false
29 endif
31 # -----------------------------------------------------------------------------
32 # All standard tests.
33 # -----------------------------------------------------------------------------
34 test_cflags = \
35     -fstack-protector-all \
36     -g \
37     -Wall -Wextra \
38     -Werror \
39     -fno-builtin \
41 libBionicStandardTests_src_files := \
42     buffer_tests.cpp \
43     dirent_test.cpp \
44     eventfd_test.cpp \
45     fcntl_test.cpp \
46     fenv_test.cpp \
47     ftw_test.cpp \
48     getauxval_test.cpp \
49     getcwd_test.cpp \
50     inttypes_test.cpp \
51     libc_logging_test.cpp \
52     libgen_test.cpp \
53     malloc_test.cpp \
54     math_test.cpp \
55     netdb_test.cpp \
56     pthread_test.cpp \
57     regex_test.cpp \
58     sched_test.cpp \
59     signal_test.cpp \
60     stack_protector_test.cpp \
61     stack_unwinding_test.cpp \
62     stack_unwinding_test_impl.c \
63     stdint_test.cpp \
64     stdio_test.cpp \
65     stdlib_test.cpp \
66     string_test.cpp \
67     strings_test.cpp \
68     stubs_test.cpp \
69     sys_epoll_test.cpp \
70     sys_mman_test.cpp \
71     sys_resource_test.cpp \
72     sys_select_test.cpp \
73     sys_sendfile_test.cpp \
74     sys_stat_test.cpp \
75     sys_statvfs_test.cpp \
76     sys_syscall_test.cpp \
77     sys_time_test.cpp \
78     sys_types_test.cpp \
79     sys_vfs_test.cpp \
80     system_properties_test.cpp \
81     time_test.cpp \
82     unistd_test.cpp \
84 libBionicStandardTests_cflags := \
85     $(test_cflags) \
87 libBionicStandardTests_ldlibs_host := \
88     -lrt \
90 module := libBionicStandardTests
91 module_tag := optional
92 build_type := target
93 build_target := STATIC_TEST_LIBRARY
94 include $(LOCAL_PATH)/Android.build.mk
95 build_type := host
96 include $(LOCAL_PATH)/Android.build.mk
98 # -----------------------------------------------------------------------------
99 # Fortify tests.
100 # -----------------------------------------------------------------------------
101 $(foreach compiler,gcc clang, \
102   $(foreach test,1 2, \
103     $(eval fortify$(test)-tests-$(compiler)_cflags := \
104       $(test_cflags) \
105       -U_FORTIFY_SOURCE \
106       -D_FORTIFY_SOURCE=$(test) \
107       -DTEST_NAME=Fortify$(test)_$(compiler)); \
108     $(eval fortify$(test)-tests-$(compiler)_cflags_host := \
109       -Wno-error); \
110     $(eval fortify$(test)-tests-$(compiler)_src_files := \
111       fortify_test.cpp); \
112     $(eval fortify_libs += fortify$(test)-tests-$(compiler)); \
113   ) \
116 module := fortify1-tests-gcc
117 module_tag := optional
118 build_type := target
119 build_target := STATIC_TEST_LIBRARY
120 include $(LOCAL_PATH)/Android.build.mk
121 build_type := host
122 include $(LOCAL_PATH)/Android.build.mk
124 module := fortify2-tests-gcc
125 module_tag := optional
126 build_type := target
127 build_target := STATIC_TEST_LIBRARY
128 include $(LOCAL_PATH)/Android.build.mk
129 build_type := host
130 include $(LOCAL_PATH)/Android.build.mk
132 fortify1-tests-clang_clang_target := true
133 fortify1-tests-clang_cflags_host := -D__clang__
135 module := fortify1-tests-clang
136 module_tag := optional
137 build_type := target
138 build_target := STATIC_TEST_LIBRARY
139 include $(LOCAL_PATH)/Android.build.mk
140 build_type := host
141 include $(LOCAL_PATH)/Android.build.mk
143 fortify2-tests-clang_clang_target := true
145 fortify2-tests-clang_cflags_host := -D__clang__
147 module := fortify2-tests-clang
148 module_tag := optional
149 build_type := target
150 build_target := STATIC_TEST_LIBRARY
151 include $(LOCAL_PATH)/Android.build.mk
152 build_type := host
153 include $(LOCAL_PATH)/Android.build.mk
155 # -----------------------------------------------------------------------------
156 # Library of all tests (excluding the dynamic linker tests).
157 # -----------------------------------------------------------------------------
158 libBionicTests_whole_static_libraries := \
159     libBionicStandardTests \
160     $(fortify_libs) \
162 module := libBionicTests
163 module_tag := optional
164 build_type := target
165 build_target := STATIC_TEST_LIBRARY
166 include $(LOCAL_PATH)/Android.build.mk
167 build_type := host
168 include $(LOCAL_PATH)/Android.build.mk
170 # -----------------------------------------------------------------------------
171 # Library used by dlfcn tests.
172 # -----------------------------------------------------------------------------
173 ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),mips mips64))
174 no-elf-hash-table-library_src_files := \
175     empty.cpp \
177 no-elf-hash-table-library_ldflags := \
178     -Wl,--hash-style=gnu \
180 module := no-elf-hash-table-library
181 module_tag := optional
182 build_type := target
183 build_target := SHARED_LIBRARY
184 include $(LOCAL_PATH)/Android.build.mk
185 endif
187 # -----------------------------------------------------------------------------
188 # Tests for the device using bionic's .so. Run with:
189 #   adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
190 # -----------------------------------------------------------------------------
191 bionic-unit-tests_whole_static_libraries := \
192     libBionicTests \
194 bionic-unit-tests_src_files := \
195     dlfcn_test.cpp \
197 bionic-unit-tests_ldflags := \
198     -Wl,--export-dynamic \
199     -Wl,-u,DlSymTestFunction \
201 bionic-unit-tests_shared_libraries_target := \
202     libdl \
204 module := bionic-unit-tests
205 module_tag := optional
206 build_type := target
207 build_target := NATIVE_TEST
208 include $(LOCAL_PATH)/Android.build.mk
210 # -----------------------------------------------------------------------------
211 # Tests for the device linked against bionic's static library. Run with:
212 #   adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
213 # -----------------------------------------------------------------------------
214 bionic-unit-tests-static_whole_static_libraries := \
215     libBionicTests \
217 bionic-unit-tests-static_static_libraries := \
218     libstlport_static \
219     libm \
220     libc \
221     libstdc++ \
223 bionic-unit-tests-static_force_static_executable := true
225 module := bionic-unit-tests-static
226 module_tag := optional
227 build_type := target
228 build_target := NATIVE_TEST
229 include $(LOCAL_PATH)/Android.build.mk
231 # -----------------------------------------------------------------------------
232 # Tests to run on the host and linked against glibc. Run with:
233 #   cd bionic/tests; mm bionic-unit-tests-glibc-run
234 # -----------------------------------------------------------------------------
235 bionic-unit-tests-glibc_whole_static_libraries := \
236     libBionicStandardTests \
238 bionic-unit-tests-glibc_ldlibs := \
239     -lrt \
241 module := bionic-unit-tests-glibc
242 module_tag := optional
243 build_type := host
244 build_target := NATIVE_TEST
245 include $(LOCAL_PATH)/Android.build.mk
247 # gtest needs ANDROID_DATA/local/tmp for death test output.
248 # Make sure to create ANDROID_DATA/local/tmp if doesn't exist.
249 # Use the current target out directory as ANDROID_DATA.
250 bionic-unit-tests-glibc-run: bionic-unit-tests-glibc
251         mkdir -p $(TARGET_OUT_DATA)/local/tmp
252         ANDROID_DATA=$(TARGET_OUT_DATA) \
253         ANDROID_ROOT=$(TARGET_OUT) \
254                 $(HOST_OUT_EXECUTABLES)/bionic-unit-tests-glibc
256 # -----------------------------------------------------------------------------
257 # Run the unit tests built against x86 bionic on an x86 host.
258 # -----------------------------------------------------------------------------
259 ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
260 ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
261 ifeq ($(TARGET_ARCH),x86)
262 LINKER = linker
263 else
264 LINKER = linker64
265 endif
266 # gtest needs ANDROID_DATA/local/tmp for death test output.
267 # Make sure to create ANDROID_DATA/local/tmp if doesn't exist.
268 # bionic itself should always work relative to ANDROID_DATA or ANDROID_ROOT.
269 bionic-unit-tests-run-on-host: bionic-unit-tests $(TARGET_OUT_EXECUTABLES)/$(LINKER) $(TARGET_OUT_EXECUTABLES)/sh
270         if [ ! -d /system -o ! -d /system/bin ]; then \
271           echo "Attempting to create /system/bin"; \
272           sudo mkdir -p -m 0777 /system/bin; \
273         fi
274         mkdir -p $(TARGET_OUT_DATA)/local/tmp
275         cp $(TARGET_OUT_EXECUTABLES)/$(LINKER) /system/bin
276         cp $(TARGET_OUT_EXECUTABLES)/sh /system/bin
277         ANDROID_DATA=$(TARGET_OUT_DATA) \
278         ANDROID_ROOT=$(TARGET_OUT) \
279         LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) \
280                 $(TARGET_OUT_DATA_NATIVE_TESTS)/bionic-unit-tests/bionic-unit-tests
281 endif
282 endif
284 endif # !BUILD_TINY_ANDROID