Android.mk revision 8de1ddece0d0b85eafeb86c06cf3a734dadf2b55
1cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes#
2cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# Copyright (C) 2012 The Android Open Source Project
3cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes#
4cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# Licensed under the Apache License, Version 2.0 (the "License");
5cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# you may not use this file except in compliance with the License.
6cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# You may obtain a copy of the License at
7cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes#
8cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes#      http://www.apache.org/licenses/LICENSE-2.0
9cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes#
10cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# Unless required by applicable law or agreed to in writing, software
11cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# distributed under the License is distributed on an "AS IS" BASIS,
12cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# See the License for the specific language governing permissions and
14cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# limitations under the License.
155ac9eee1d3291a0d203a125849b4636a11c0d124Benoit Goby#
165ac9eee1d3291a0d203a125849b4636a11c0d124Benoit Goby
17e7c59f9e2041812c597ff1c8689d47d1bfd32883Elliott Hughesifneq ($(BUILD_TINY_ANDROID),true)
18cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes
19cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott HughesLOCAL_PATH := $(call my-dir)
20cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes
217be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# -----------------------------------------------------------------------------
227be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# Unit tests.
237be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# -----------------------------------------------------------------------------
247be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes
25f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
26f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_host := true
27f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferriselse
28f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_host := false
29f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisendif
30f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris
31f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris# -----------------------------------------------------------------------------
32f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris# All standard tests.
33f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris# -----------------------------------------------------------------------------
34f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferristest_cflags = \
35dcab1b2c76a498c56bc00024613386de8b4b2aaeNick Kralevich    -fstack-protector-all \
36ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughes    -g \
37d286796fce1e6fff407b719a53eb2afbeb96c327Elliott Hughes    -Wall -Wextra -Wunused \
38ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughes    -Werror \
39a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes    -fno-builtin \
40ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughes
413d7a0d9b08ecab054b2dff8332507644de3690b0Elliott Hughestest_cflags += -D__STDC_LIMIT_MACROS  # For glibc.
423d7a0d9b08ecab054b2dff8332507644de3690b0Elliott Hughes
438e32b7b3543eadbb58a92443fb57d60aac92ef88Christopher Ferrisifeq ($(MALLOC_IMPL),dlmalloc)
448e32b7b3543eadbb58a92443fb57d60aac92ef88Christopher Ferristest_cflags += -DUSE_DLMALLOC
458e32b7b3543eadbb58a92443fb57d60aac92ef88Christopher Ferriselse
4672bbd423579bb971dc06cdd3c06201faf3fe95e6Christopher Ferristest_cflags += -DUSE_JEMALLOC
4772bbd423579bb971dc06cdd3c06201faf3fe95e6Christopher Ferrisendif
4872bbd423579bb971dc06cdd3c06201faf3fe95e6Christopher Ferris
49b8425c549a0bfe08b01b5906b95603d8523c1b16Dan Alberttest_cppflags = \
50b8425c549a0bfe08b01b5906b95603d8523c1b16Dan Albert    -std=gnu++11 \
51b8425c549a0bfe08b01b5906b95603d8523c1b16Dan Albert
52f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher FerrislibBionicStandardTests_src_files := \
536a41b0fb0e589c4afc4ecbcf7c425f0aa40eaea4Elliott Hughes    arpa_inet_test.cpp \
54b687ad3c3491fffe22507cafc9347e10cbf6bd31Christopher Ferris    buffer_tests.cpp \
55f3c73901cb5ca4de2651151cf2c65b31a729466eElliott Hughes    ctype_test.cpp \
56063cfb2084ea4b12d3c85b2d2c44e888f0857eb4Elliott Hughes    dirent_test.cpp \
578baa929d5d3bcf63381cf78ba76168c80c303f5eKito Cheng    eventfd_test.cpp \
58062092543fdbd6fa2676e4f5b37a15f7bba94332Elliott Hughes    fcntl_test.cpp \
5990e10d41c4271a5d517f60f4ff1d2891b8ccc034Elliott Hughes    fenv_test.cpp \
60d4934a70e69365c97b1378820152e134a0089b5eCalin Juravle    ftw_test.cpp \
612c5153b043b44e9935a334ae9b2d5a4bc5258b40Nick Kralevich    getauxval_test.cpp \
6204a83a48ed89f433c78e31106ed50059764797a0Elliott Hughes    getcwd_test.cpp \
6374f0833df6d04d51eb4e554845862ed7279f78b0Elliott Hughes    inttypes_test.cpp \
648f2a5a0b40fc82126c691d5c30131d908772aab7Elliott Hughes    libc_logging_test.cpp \
6558b575485c446f9d76ee00f67516ed42cf017769Elliott Hughes    libgen_test.cpp \
6650282f72bb9be6b49212a3978faec70786e9f97fPavel Chupin    locale_test.cpp \
67885f3b9cad01b8158aadc55c159c17dbf34f622cChristopher Ferris    malloc_test.cpp \
68568d64dc6213b137e43d65e007cc2c60adc16071Jingwei Zhang    math_cos_test.cpp \
69568d64dc6213b137e43d65e007cc2c60adc16071Jingwei Zhang    math_cosf_test.cpp \
70568d64dc6213b137e43d65e007cc2c60adc16071Jingwei Zhang    math_exp_test.cpp \
71568d64dc6213b137e43d65e007cc2c60adc16071Jingwei Zhang    math_expf_test.cpp \
72568d64dc6213b137e43d65e007cc2c60adc16071Jingwei Zhang    math_log_test.cpp \
73568d64dc6213b137e43d65e007cc2c60adc16071Jingwei Zhang    math_logf_test.cpp \
74568d64dc6213b137e43d65e007cc2c60adc16071Jingwei Zhang    math_pow_test.cpp \
75568d64dc6213b137e43d65e007cc2c60adc16071Jingwei Zhang    math_powf_test.cpp \
76568d64dc6213b137e43d65e007cc2c60adc16071Jingwei Zhang    math_sin_test.cpp \
77568d64dc6213b137e43d65e007cc2c60adc16071Jingwei Zhang    math_sinf_test.cpp \
78568d64dc6213b137e43d65e007cc2c60adc16071Jingwei Zhang    math_sincos_test.cpp \
79568d64dc6213b137e43d65e007cc2c60adc16071Jingwei Zhang    math_sincosf_test.cpp \
80568d64dc6213b137e43d65e007cc2c60adc16071Jingwei Zhang    math_tan_test.cpp \
81568d64dc6213b137e43d65e007cc2c60adc16071Jingwei Zhang    math_tanf_test.cpp \
82a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes    math_test.cpp \
83eb664e24c074b88539b743668109d8b4eaa925bdElliott Hughes    mntent_test.cpp \
84d3b9d11369ee15dc0ce512014284c3c5432f2813Elliott Hughes    netdb_test.cpp \
85bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott Hughes    pthread_test.cpp \
86cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes    regex_test.cpp \
8753bfdae4ffdbd43d0c019d1a35af1f8477a272c9Elliott Hughes    sched_test.cpp \
88b902641d7303d2ea24c10f6d6e7ff49e7ee75611Elliott Hughes    search_test.cpp \
89da73f655fcbac6e1a8bfd35303cef6f41187d12bElliott Hughes    signal_test.cpp \
90ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughes    stack_protector_test.cpp \
91c45087bffa528c0809f0df2e0a3708eba7018b33Sergey Melnikov    stack_unwinding_test.cpp \
92e6c57fcb05b0dcbfa8129bb6f7d99093f4819370Elliott Hughes    stdatomic_test.cpp \
93da030de702b756077fec536ed139e7ea38b51022Calin Juravle    stdint_test.cpp \
9491875dcd6e17b7f3b251efe9b236b905ef414ddeElliott Hughes    stdio_test.cpp \
95774c7f54ff375d71106283d42779b0cc5f238f87Elliott Hughes    stdlib_test.cpp \
96b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea    string_test.cpp \
9773964c592c8d23901e9479893dfbd3d0f25bab04Elliott Hughes    strings_test.cpp \
982a54e5ecd0a96398e8d7d9b1629ecf8fb1633a2bKenny Root    stubs_test.cpp \
998c42606ae10b59318c9a4ea83854049bab5b9328Elliott Hughes    sstream_test.cpp \
10011952073af22568bba0b661f7a9d4402c443a888Elliott Hughes    sys_epoll_test.cpp \
101431166d99519f6794f10c48694913d2fe864b841Elliott Hughes    sys_mman_test.cpp \
1020f461e35f63200641fc53bba222845a84589c024Elliott Hughes    sys_resource_test.cpp \
1035b9310e502003e584bcb3a028ca3db7aa4d3f01bElliott Hughes    sys_select_test.cpp \
104b4f7616fd618875768b8fffc122b58bdb84a9969Elliott Hughes    sys_sendfile_test.cpp \
1056ff0c75c838e73d2aeccc0102ab58a7b865172caGuillaume Ranquet    sys_socket_test.cpp \
106d0be7c8f9a06b3ca8ea7647ea35c8f9dc63f0fe1Elliott Hughes    sys_stat_test.cpp \
107db1ea3474899ebbd783aba872d3005f95a816d0fElliott Hughes    sys_statvfs_test.cpp \
108e61dc71efca544f4066a93706b639a29b3600229Elliott Hughes    sys_syscall_test.cpp \
109f8fcfbc85a3ce3e195626b90736d3a484331494bElliott Hughes    sys_time_test.cpp \
110894f8cb1395d3409bb995d18abc1b3409c557d01Elliott Hughes    sys_types_test.cpp \
111db1ea3474899ebbd783aba872d3005f95a816d0fElliott Hughes    sys_vfs_test.cpp \
112b27e200ad6170ba3163f5ae6ba581bdaabb2e696Colin Cross    system_properties_test.cpp \
113e0175ca7e440a87e9d03f249fc8f210063df7908Elliott Hughes    time_test.cpp \
1147a7f9952c12b216fbf91fc4cdbb97045e8861115Dan Albert    uchar_test.cpp \
11559c12a652794273da22907a374222f4fa7d975c6Dmitriy Ivanov    uniqueptr_test.cpp \
116a55f63083fb16b2595f517a3260083e5f8cddd02Elliott Hughes    unistd_test.cpp \
11777e944fd46728075fe632bcb5211da9daf5b7e68Elliott Hughes    wchar_test.cpp \
118cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes
119f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher FerrislibBionicStandardTests_cflags := \
120f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    $(test_cflags) \
121acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhao
1228e32b7b3543eadbb58a92443fb57d60aac92ef88Christopher Ferrisifeq ($(MALLOC_IMPL),dlmalloc)
123e5fdaa4f9d102461a4d8a865e6ca84666893b9e7Dan Albert  libBionicStandardTests_cflags += -DUSE_DLMALLOC
1248e32b7b3543eadbb58a92443fb57d60aac92ef88Christopher Ferriselse
1258e32b7b3543eadbb58a92443fb57d60aac92ef88Christopher Ferris  libBionicStandardTests_cflags += -DUSE_JEMALLOC
126e5fdaa4f9d102461a4d8a865e6ca84666893b9e7Dan Albertendif
127e5fdaa4f9d102461a4d8a865e6ca84666893b9e7Dan Albert
128b8425c549a0bfe08b01b5906b95603d8523c1b16Dan AlbertlibBionicStandardTests_cppflags := \
129b8425c549a0bfe08b01b5906b95603d8523c1b16Dan Albert    $(test_cppflags) \
130b8425c549a0bfe08b01b5906b95603d8523c1b16Dan Albert
131e5fdaa4f9d102461a4d8a865e6ca84666893b9e7Dan AlbertlibBionicStandardTests_c_includes := \
132e5fdaa4f9d102461a4d8a865e6ca84666893b9e7Dan Albert    bionic/libc \
133e5fdaa4f9d102461a4d8a865e6ca84666893b9e7Dan Albert
134f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher FerrislibBionicStandardTests_ldlibs_host := \
135f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    -lrt \
1365bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevich
137d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher FerrislibBionicStandardTests_whole_static_libraries := \
138d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferris    libBionicUnwindTest \
139d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferris
140f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule := libBionicStandardTests
141f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule_tag := optional
142f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_type := target
143f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_target := STATIC_TEST_LIBRARY
144f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
145f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_type := host
146f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
147c45087bffa528c0809f0df2e0a3708eba7018b33Sergey Melnikov
148f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris# -----------------------------------------------------------------------------
149d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferris# Special stack unwinding test library compiled with special flags.
150d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferris# -----------------------------------------------------------------------------
151d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher FerrislibBionicUnwindTest_cflags := \
152d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferris    $(test_cflags) \
153d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferris    -fexceptions \
154d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferris    -fnon-call-exceptions \
155d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferris
156d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher FerrislibBionicUnwindTest_src_files := \
157d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferris    stack_unwinding_test_impl.c \
158d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferris
159d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferrismodule := libBionicUnwindTest
160d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferrismodule_tag := optional
161d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferrisbuild_type := target
162d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferrisbuild_target := STATIC_TEST_LIBRARY
163d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
164d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferrisbuild_type := host
165d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
166d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferris
167d178c83d45ef5ff5caa6f8e92d461ada72c37bd2Christopher Ferris# -----------------------------------------------------------------------------
168f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris# Fortify tests.
169f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris# -----------------------------------------------------------------------------
170f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris$(foreach compiler,gcc clang, \
171f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris  $(foreach test,1 2, \
172f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    $(eval fortify$(test)-tests-$(compiler)_cflags := \
173f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris      $(test_cflags) \
174f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris      -U_FORTIFY_SOURCE \
175f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris      -D_FORTIFY_SOURCE=$(test) \
176f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris      -DTEST_NAME=Fortify$(test)_$(compiler)); \
177f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    $(eval fortify$(test)-tests-$(compiler)_cflags_host := \
178f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris      -Wno-error); \
179f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    $(eval fortify$(test)-tests-$(compiler)_src_files := \
180f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris      fortify_test.cpp); \
181f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    $(eval fortify_libs += fortify$(test)-tests-$(compiler)); \
182f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris  ) \
183f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris)
184f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris
185f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule := fortify1-tests-gcc
186f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule_tag := optional
187f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_type := target
188f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_target := STATIC_TEST_LIBRARY
189f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
190f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_type := host
191f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
192f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris
193f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule := fortify2-tests-gcc
194f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule_tag := optional
195f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_type := target
196f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_target := STATIC_TEST_LIBRARY
197f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
198f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_type := host
199f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
200f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris
201f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisfortify1-tests-clang_clang_target := true
202f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisfortify1-tests-clang_cflags_host := -D__clang__
203f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris
204f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule := fortify1-tests-clang
205f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule_tag := optional
206f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_type := target
207f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_target := STATIC_TEST_LIBRARY
208f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
209f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_type := host
210f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
211f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris
212f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisfortify2-tests-clang_clang_target := true
213f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris
214f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisfortify2-tests-clang_cflags_host := -D__clang__
215f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris
216f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule := fortify2-tests-clang
217f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule_tag := optional
218f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_type := target
219f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_target := STATIC_TEST_LIBRARY
220f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
221f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_type := host
222f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
223c45087bffa528c0809f0df2e0a3708eba7018b33Sergey Melnikov
224f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris# -----------------------------------------------------------------------------
225f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris# Library of all tests (excluding the dynamic linker tests).
226f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris# -----------------------------------------------------------------------------
227f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher FerrislibBionicTests_whole_static_libraries := \
228f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    libBionicStandardTests \
229f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    $(fortify_libs) \
230f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris
231f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule := libBionicTests
232f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule_tag := optional
233f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_type := target
234f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_target := STATIC_TEST_LIBRARY
235f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
236f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_type := host
237f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
238bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott Hughes
2397be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# -----------------------------------------------------------------------------
240f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris# Tests for the device using bionic's .so. Run with:
241c8cf3513ecb265ba3aadc846aa2113290a504c44Hans Boehm#   adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests32
242c8cf3513ecb265ba3aadc846aa2113290a504c44Hans Boehm#   adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests64
243f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris# -----------------------------------------------------------------------------
244f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbionic-unit-tests_whole_static_libraries := \
245f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    libBionicTests \
246f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris
247f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbionic-unit-tests_src_files := \
2486b56691a678420477595a531b2d2829980eb51c0Dmitriy Ivanov    atexit_test.cpp \
24912bbb9164578b6512b8b07a3fb093858244b7c7bTorne (Richard Coles)    dlext_test.cpp \
250f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    dlfcn_test.cpp \
2518240bed918722944c9985bc0cca89eb44c4f6c91Christopher Ferris
252d06ee1d6db6165126161044fb662301bf9f04b3aElliott Hughesbionic-unit-tests_cflags := $(test_cflags)
253d06ee1d6db6165126161044fb662301bf9f04b3aElliott Hughesbionic-unit-tests_cppflags := $(test_cppflags)
2546396da98cb3313048ae9a8147523ed61f675fd50Dmitriy Ivanov
255f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbionic-unit-tests_ldflags := \
256f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    -Wl,--export-dynamic \
257f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    -Wl,-u,DlSymTestFunction \
2588240bed918722944c9985bc0cca89eb44c4f6c91Christopher Ferris
25926052616915fe2324755687c7db73d69c521b34dTorne (Richard Coles)bionic-unit-tests_c_includes := \
2608de1ddece0d0b85eafeb86c06cf3a734dadf2b55Dmitriy Ivanov    bionic/libc \
26126052616915fe2324755687c7db73d69c521b34dTorne (Richard Coles)    $(call include-path-for, libpagemap) \
26226052616915fe2324755687c7db73d69c521b34dTorne (Richard Coles)
263f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbionic-unit-tests_shared_libraries_target := \
264f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    libdl \
26526052616915fe2324755687c7db73d69c521b34dTorne (Richard Coles)    libpagemap \
2668240bed918722944c9985bc0cca89eb44c4f6c91Christopher Ferris
267f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule := bionic-unit-tests
268f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule_tag := optional
269f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_type := target
270f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_target := NATIVE_TEST
271f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
272153d92765bb693541abf49a2a1d31335e2c90348Christopher Ferris
273153d92765bb693541abf49a2a1d31335e2c90348Christopher Ferris# -----------------------------------------------------------------------------
274f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris# Tests for the device linked against bionic's static library. Run with:
275c8cf3513ecb265ba3aadc846aa2113290a504c44Hans Boehm#   adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static32
276c8cf3513ecb265ba3aadc846aa2113290a504c44Hans Boehm#   adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static64
2777be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# -----------------------------------------------------------------------------
278f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbionic-unit-tests-static_whole_static_libraries := \
279f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    libBionicTests \
280124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott Hughes
281f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbionic-unit-tests-static_static_libraries := \
2827a39094465bbd01a22565fce1f1155c762f8d145Dan Albert    libstlport_static \
283f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    libm \
284f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    libc \
2857a39094465bbd01a22565fce1f1155c762f8d145Dan Albert    libstdc++ \
286f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris
287f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbionic-unit-tests-static_force_static_executable := true
288f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris
289f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule := bionic-unit-tests-static
290f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule_tag := optional
291f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_type := target
292f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_target := NATIVE_TEST
293f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
294124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott Hughes
2957be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# -----------------------------------------------------------------------------
296f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris# Tests to run on the host and linked against glibc. Run with:
297f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris#   cd bionic/tests; mm bionic-unit-tests-glibc-run
2987be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# -----------------------------------------------------------------------------
299156c3afcf178b8a6c29b9edc7e8d13999a58d857Dmitriy Ivanov
300e9f7a9c340a3af11de720042fdc5061b65dc9b78Christopher Ferrisifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
301156c3afcf178b8a6c29b9edc7e8d13999a58d857Dmitriy Ivanov
3026b56691a678420477595a531b2d2829980eb51c0Dmitriy Ivanovbionic-unit-tests-glibc_src_files := \
3036b56691a678420477595a531b2d2829980eb51c0Dmitriy Ivanov    atexit_test.cpp \
3046b56691a678420477595a531b2d2829980eb51c0Dmitriy Ivanov
305f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbionic-unit-tests-glibc_whole_static_libraries := \
306f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris    libBionicStandardTests \
307124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott Hughes
308f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbionic-unit-tests-glibc_ldlibs := \
3096b56691a678420477595a531b2d2829980eb51c0Dmitriy Ivanov    -lrt -ldl \
310f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferris
311d06ee1d6db6165126161044fb662301bf9f04b3aElliott Hughesbionic-unit-tests-glibc_cflags := $(test_cflags)
312d06ee1d6db6165126161044fb662301bf9f04b3aElliott Hughesbionic-unit-tests-glibc_cppflags := $(test_cppflags)
3136396da98cb3313048ae9a8147523ed61f675fd50Dmitriy Ivanov
314f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule := bionic-unit-tests-glibc
315f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrismodule_tag := optional
316f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_type := host
317f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisbuild_target := NATIVE_TEST
318f04935c85e0b466f0d30d2cd4c0fa2fff62e7d6dChristopher Ferrisinclude $(LOCAL_PATH)/Android.build.mk
319b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris
3200c567f1e6cfceada98ba10deb4bac6030c9d20f7Elliott Hughesifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm mips x86))
3210c567f1e6cfceada98ba10deb4bac6030c9d20f7Elliott HughesLINKER = linker64
3220c567f1e6cfceada98ba10deb4bac6030c9d20f7Elliott HughesNATIVE_TEST_SUFFIX=64
3230c567f1e6cfceada98ba10deb4bac6030c9d20f7Elliott Hugheselse
3240c567f1e6cfceada98ba10deb4bac6030c9d20f7Elliott HughesLINKER = linker
3250c567f1e6cfceada98ba10deb4bac6030c9d20f7Elliott HughesNATIVE_TEST_SUFFIX=32
3260c567f1e6cfceada98ba10deb4bac6030c9d20f7Elliott Hughesendif
3270c567f1e6cfceada98ba10deb4bac6030c9d20f7Elliott Hughes
328b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris# gtest needs ANDROID_DATA/local/tmp for death test output.
329b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris# Make sure to create ANDROID_DATA/local/tmp if doesn't exist.
330b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris# Use the current target out directory as ANDROID_DATA.
331722706672617d009279a8485b895bd3389de0396Calin Juravle# BIONIC_TEST_FLAGS is either empty or it comes from the user.
332b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferrisbionic-unit-tests-glibc-run: bionic-unit-tests-glibc
333b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris	mkdir -p $(TARGET_OUT_DATA)/local/tmp
334b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris	ANDROID_DATA=$(TARGET_OUT_DATA) \
335b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris	ANDROID_ROOT=$(TARGET_OUT) \
336156c3afcf178b8a6c29b9edc7e8d13999a58d857Dmitriy Ivanov		$(HOST_OUT_EXECUTABLES)/bionic-unit-tests-glibc$(NATIVE_TEST_SUFFIX) $(BIONIC_TEST_FLAGS)
3375ac9eee1d3291a0d203a125849b4636a11c0d124Benoit Goby
33816d1af167f8e36a9aa4a07ae77034ad519b00463Nick Kralevich# -----------------------------------------------------------------------------
339f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin# Run the unit tests built against x86 bionic on an x86 host.
340f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin# -----------------------------------------------------------------------------
341156c3afcf178b8a6c29b9edc7e8d13999a58d857Dmitriy Ivanov
3420c567f1e6cfceada98ba10deb4bac6030c9d20f7Elliott Hughesifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
343b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris# gtest needs ANDROID_DATA/local/tmp for death test output.
344b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris# Make sure to create ANDROID_DATA/local/tmp if doesn't exist.
345f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin# bionic itself should always work relative to ANDROID_DATA or ANDROID_ROOT.
346722706672617d009279a8485b895bd3389de0396Calin Juravle# BIONIC_TEST_FLAGS is either empty or it comes from the user.
34717558dec7fc60775c940be0e494b42829f35e0b1Pavel Chupinbionic-unit-tests-run-on-host: bionic-unit-tests $(TARGET_OUT_EXECUTABLES)/$(LINKER) $(TARGET_OUT_EXECUTABLES)/sh
348b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris	if [ ! -d /system -o ! -d /system/bin ]; then \
349b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris	  echo "Attempting to create /system/bin"; \
350b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris	  sudo mkdir -p -m 0777 /system/bin; \
351b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris	fi
352f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin	mkdir -p $(TARGET_OUT_DATA)/local/tmp
35317558dec7fc60775c940be0e494b42829f35e0b1Pavel Chupin	cp $(TARGET_OUT_EXECUTABLES)/$(LINKER) /system/bin
354e60c4f0a6cb5836caa8d0de299cc83fe4b13744cElliott Hughes	cp $(TARGET_OUT_EXECUTABLES)/sh /system/bin
355f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin	ANDROID_DATA=$(TARGET_OUT_DATA) \
356f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin	ANDROID_ROOT=$(TARGET_OUT) \
357f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin	LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) \
358156c3afcf178b8a6c29b9edc7e8d13999a58d857Dmitriy Ivanov		$(TARGET_OUT_DATA_NATIVE_TESTS)/bionic-unit-tests/bionic-unit-tests$(NATIVE_TEST_SUFFIX) $(BIONIC_TEST_FLAGS)
359f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupinendif
3600c567f1e6cfceada98ba10deb4bac6030c9d20f7Elliott Hughes
361bd321c1106ed30a71d55d5c365335dfe552b0883Dmitriy Ivanovifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86_64))
362bd321c1106ed30a71d55d5c365335dfe552b0883Dmitriy Ivanov# add target to run lp32 tests
36393c3f4203c92ece8b97d770af9b675f5ffb90c67Dmitriy Ivanovbionic-unit-tests-run-on-host32: bionic-unit-tests_32 $(TARGET_OUT_EXECUTABLES)/$(LINKER) $(TARGET_OUT_EXECUTABLES)/sh
364bd321c1106ed30a71d55d5c365335dfe552b0883Dmitriy Ivanov	if [ ! -d /system -o ! -d /system/bin ]; then \
365bd321c1106ed30a71d55d5c365335dfe552b0883Dmitriy Ivanov	  echo "Attempting to create /system/bin"; \
366bd321c1106ed30a71d55d5c365335dfe552b0883Dmitriy Ivanov	  sudo mkdir -p -m 0777 /system/bin; \
367bd321c1106ed30a71d55d5c365335dfe552b0883Dmitriy Ivanov	fi
368bd321c1106ed30a71d55d5c365335dfe552b0883Dmitriy Ivanov	mkdir -p $(TARGET_OUT_DATA)/local/tmp
369bd321c1106ed30a71d55d5c365335dfe552b0883Dmitriy Ivanov	cp $(TARGET_OUT_EXECUTABLES)/linker /system/bin
370bd321c1106ed30a71d55d5c365335dfe552b0883Dmitriy Ivanov	cp $(TARGET_OUT_EXECUTABLES)/sh /system/bin
371bd321c1106ed30a71d55d5c365335dfe552b0883Dmitriy Ivanov	ANDROID_DATA=$(TARGET_OUT_DATA) \
372bd321c1106ed30a71d55d5c365335dfe552b0883Dmitriy Ivanov	ANDROID_ROOT=$(TARGET_OUT) \
373bd321c1106ed30a71d55d5c365335dfe552b0883Dmitriy Ivanov	LD_LIBRARY_PATH=$(2ND_TARGET_OUT_SHARED_LIBRARIES) \
374bd321c1106ed30a71d55d5c365335dfe552b0883Dmitriy Ivanov		$(2ND_TARGET_OUT_DATA_NATIVE_TESTS)/bionic-unit-tests/bionic-unit-tests32 $(BIONIC_TEST_FLAGS)
375bd321c1106ed30a71d55d5c365335dfe552b0883Dmitriy Ivanovendif
376bd321c1106ed30a71d55d5c365335dfe552b0883Dmitriy Ivanov
3770c567f1e6cfceada98ba10deb4bac6030c9d20f7Elliott Hughesendif # linux-x86
378f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin
3791f5e1a3cbc564c593fe1090894ecdb070f36e20cDmitriy Ivanovinclude $(call first-makefiles-under,$(LOCAL_PATH))
3805ac9eee1d3291a0d203a125849b4636a11c0d124Benoit Gobyendif # !BUILD_TINY_ANDROID
381