]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/platform-bionic.git/blob - tests/Android.mk
Upgrade to tzdata2013i.
[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 # Benchmarks.
23 # -----------------------------------------------------------------------------
25 benchmark_c_flags = \
26     -O2 \
27     -Wall -Wextra \
28     -Werror \
29     -fno-builtin \
31 benchmark_src_files = \
32     benchmark_main.cpp \
33     math_benchmark.cpp \
34     property_benchmark.cpp \
35     string_benchmark.cpp \
36     time_benchmark.cpp \
38 # Build benchmarks for the device (with bionic's .so). Run with:
39 #   adb shell bionic-benchmarks
40 include $(CLEAR_VARS)
41 LOCAL_MODULE := bionic-benchmarks
42 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
43 LOCAL_CFLAGS += $(benchmark_c_flags)
44 LOCAL_C_INCLUDES += external/stlport/stlport bionic/ bionic/libstdc++/include
45 LOCAL_SHARED_LIBRARIES += libstlport
46 LOCAL_SRC_FILES := $(benchmark_src_files)
47 include $(BUILD_EXECUTABLE)
49 # -----------------------------------------------------------------------------
50 # Unit tests.
51 # -----------------------------------------------------------------------------
53 test_c_flags = \
54     -fstack-protector-all \
55     -g \
56     -Wall -Wextra \
57     -Werror \
58     -fno-builtin \
60 test_src_files = \
61     dirent_test.cpp \
62     eventfd_test.cpp \
63     fenv_test.cpp \
64     getauxval_test.cpp \
65     getcwd_test.cpp \
66     inttypes_test.cpp \
67     libc_logging_test.cpp \
68     libgen_test.cpp \
69     malloc_test.cpp \
70     math_test.cpp \
71     netdb_test.cpp \
72     pthread_test.cpp \
73     regex_test.cpp \
74     signal_test.cpp \
75     stack_protector_test.cpp \
76     stack_unwinding_test.cpp \
77     statvfs_test.cpp \
78     stdio_test.cpp \
79     stdlib_test.cpp \
80     string_test.cpp \
81     strings_test.cpp \
82     stubs_test.cpp \
83     sys_stat_test.cpp \
84     system_properties_test.cpp \
85     time_test.cpp \
86     unistd_test.cpp \
88 test_dynamic_ldflags = -Wl,--export-dynamic -Wl,-u,DlSymTestFunction
89 test_dynamic_src_files = \
90     dlfcn_test.cpp \
92 test_fortify_static_libraries = \
93     fortify1-tests-gcc fortify2-tests-gcc fortify1-tests-clang fortify2-tests-clang
95 include $(CLEAR_VARS)
96 LOCAL_MODULE := bionic-unit-tests-unwind-test-impl
97 LOCAL_CFLAGS += $(test_c_flags) -fexceptions -fnon-call-exceptions
98 LOCAL_SRC_FILES := stack_unwinding_test_impl.c
99 include $(BUILD_STATIC_LIBRARY)
101 include $(CLEAR_VARS)
102 LOCAL_MODULE := bionic-unit-tests-unwind-test-impl-host
103 LOCAL_CFLAGS += $(test_c_flags) -fexceptions -fnon-call-exceptions
104 LOCAL_SRC_FILES := stack_unwinding_test_impl.c
105 include $(BUILD_HOST_STATIC_LIBRARY)
107 # Build tests for the device (with bionic's .so). Run with:
108 #   adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
109 include $(CLEAR_VARS)
110 LOCAL_MODULE := bionic-unit-tests
111 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
112 LOCAL_CFLAGS += $(test_c_flags)
113 LOCAL_LDFLAGS += $(test_dynamic_ldflags)
114 LOCAL_SHARED_LIBRARIES += libdl
115 LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files)
116 LOCAL_WHOLE_STATIC_LIBRARIES := $(test_fortify_static_libraries)
117 LOCAL_STATIC_LIBRARIES += bionic-unit-tests-unwind-test-impl
118 include $(BUILD_NATIVE_TEST)
120 # Build tests for the device (with bionic's .a). Run with:
121 #   adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
122 include $(CLEAR_VARS)
123 LOCAL_MODULE := bionic-unit-tests-static
124 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
125 LOCAL_FORCE_STATIC_EXECUTABLE := true
126 LOCAL_WHOLE_STATIC_LIBRARIES += libBionicTests
127 LOCAL_STATIC_LIBRARIES += libstlport_static libstdc++ libm libc
128 include $(BUILD_NATIVE_TEST)
130 # -----------------------------------------------------------------------------
131 # We build the static unit tests as a library so they can be used both for
132 # bionic-unit-tests-static and also as part of CTS.
133 # -----------------------------------------------------------------------------
135 include $(CLEAR_VARS)
136 LOCAL_MODULE := libBionicTests
137 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
138 LOCAL_CFLAGS += $(test_c_flags)
139 LOCAL_SRC_FILES := $(test_src_files)
140 LOCAL_CFLAGS += \
141     -DGTEST_OS_LINUX_ANDROID \
142     -DGTEST_HAS_STD_STRING \
144 LOCAL_C_INCLUDES += \
145     bionic bionic/libstdc++/include \
146     external/gtest/include \
147     external/stlport/stlport \
149 LOCAL_WHOLE_STATIC_LIBRARIES := \
150     $(test_fortify_static_libraries) \
151     bionic-unit-tests-unwind-test-impl \
153 include $(BUILD_STATIC_LIBRARY)
155 # -----------------------------------------------------------------------------
156 # Test library for the unit tests.
157 # -----------------------------------------------------------------------------
159 # Build no-elf-hash-table-library.so to test dlopen(3) on a library that
160 # only has a GNU-style hash table. MIPS doesn't support GNU hash style.
161 ifneq ($(TARGET_ARCH),mips)
162 include $(CLEAR_VARS)
163 LOCAL_MODULE := no-elf-hash-table-library
164 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
165 LOCAL_SRC_FILES := empty.cpp
166 LOCAL_LDFLAGS := -Wl,--hash-style=gnu
167 include $(BUILD_SHARED_LIBRARY)
168 endif
170 # -----------------------------------------------------------------------------
171 # Unit tests built against glibc.
172 # -----------------------------------------------------------------------------
174 # Build tests for the host (with glibc).
175 # Note that this will build against glibc, so it's not useful for testing
176 # bionic's implementation, but it does let you use glibc as a reference
177 # implementation for testing the tests themselves.
178 ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
179 include $(CLEAR_VARS)
180 LOCAL_MODULE := bionic-unit-tests-glibc
181 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
182 LOCAL_CFLAGS += $(test_c_flags)
183 LOCAL_LDFLAGS += -lpthread -ldl -lrt
184 LOCAL_LDFLAGS += $(test_dynamic_ldflags)
185 LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files)
186 LOCAL_STATIC_LIBRARIES += bionic-unit-tests-unwind-test-impl-host
187 include $(BUILD_HOST_NATIVE_TEST)
188 endif
190 # -----------------------------------------------------------------------------
191 # FORTIFY_SOURCE tests
192 # -----------------------------------------------------------------------------
194 fortify_c_includes = \
195     bionic \
196     bionic/libstdc++/include \
197     external/stlport/stlport \
198     external/gtest/include
199 fortify_test_files = fortify_test.cpp
201 # -Wno-error=unused-parameter needed as
202 # external/stlport/stlport/stl/_threads.c (included from
203 # external/gtest/include/gtest/gtest.h) does not compile cleanly under
204 # clang. TODO: fix this.
205 fortify_c_flags = $(test_c_flags) -Wno-error=unused-parameter
207 include $(CLEAR_VARS)
208 LOCAL_SRC_FILES := $(fortify_test_files)
209 LOCAL_MODULE := fortify1-tests-gcc
210 LOCAL_CFLAGS += $(fortify_c_flags) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DTEST_NAME=Fortify1_Gcc
211 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
212 LOCAL_C_INCLUDES += $(fortify_c_includes)
213 include $(BUILD_STATIC_LIBRARY)
215 include $(CLEAR_VARS)
216 LOCAL_SRC_FILES := $(fortify_test_files)
217 LOCAL_MODULE := fortify2-tests-gcc
218 LOCAL_CFLAGS += $(fortify_c_flags) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DTEST_NAME=Fortify2_Gcc
219 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
220 LOCAL_C_INCLUDES += $(fortify_c_includes)
221 include $(BUILD_STATIC_LIBRARY)
223 include $(CLEAR_VARS)
224 LOCAL_SRC_FILES := $(fortify_test_files)
225 LOCAL_MODULE := fortify1-tests-clang
226 LOCAL_CLANG := true
227 LOCAL_CFLAGS += $(fortify_c_flags) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DTEST_NAME=Fortify1_Clang
228 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
229 LOCAL_C_INCLUDES += $(fortify_c_includes)
230 include $(BUILD_STATIC_LIBRARY)
232 include $(CLEAR_VARS)
233 LOCAL_SRC_FILES := $(fortify_test_files)
234 LOCAL_MODULE := fortify2-tests-clang
235 LOCAL_CLANG := true
236 LOCAL_CFLAGS += $(fortify_c_flags) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DTEST_NAME=Fortify2_Clang
237 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
238 LOCAL_C_INCLUDES += $(fortify_c_includes)
239 include $(BUILD_STATIC_LIBRARY)
241 endif # !BUILD_TINY_ANDROID