Elliott Hughes | cc213f8 | 2012-08-14 15:32:42 -0700 | [diff] [blame] | 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. |
Benoit Goby | 5ac9eee | 2012-08-31 19:52:15 -0700 | [diff] [blame] | 15 | # |
| 16 | |
| 17 | ifneq ($(BUILD_TINY_ANDROID), true) |
Elliott Hughes | cc213f8 | 2012-08-14 15:32:42 -0700 | [diff] [blame] | 18 | |
| 19 | LOCAL_PATH := $(call my-dir) |
| 20 | |
Elliott Hughes | 7be369d | 2012-11-08 15:37:43 -0800 | [diff] [blame] | 21 | # ----------------------------------------------------------------------------- |
| 22 | # Benchmarks. |
| 23 | # ----------------------------------------------------------------------------- |
| 24 | |
| 25 | benchmark_c_flags = \ |
| 26 | -O2 \ |
| 27 | -Wall -Wextra \ |
| 28 | -Werror \ |
Elliott Hughes | 9edb3e0 | 2013-02-06 15:47:09 -0800 | [diff] [blame] | 29 | -fno-builtin \ |
Elliott Hughes | 7be369d | 2012-11-08 15:37:43 -0800 | [diff] [blame] | 30 | |
| 31 | benchmark_src_files = \ |
| 32 | benchmark_main.cpp \ |
Elliott Hughes | 9edb3e0 | 2013-02-06 15:47:09 -0800 | [diff] [blame] | 33 | math_benchmark.cpp \ |
Colin Cross | b27e200 | 2013-01-28 17:19:43 -0800 | [diff] [blame] | 34 | property_benchmark.cpp \ |
Elliott Hughes | 7be369d | 2012-11-08 15:37:43 -0800 | [diff] [blame] | 35 | string_benchmark.cpp \ |
Elliott Hughes | 4a05bef | 2013-03-11 17:17:02 -0700 | [diff] [blame] | 36 | time_benchmark.cpp \ |
Elliott Hughes | 7be369d | 2012-11-08 15:37:43 -0800 | [diff] [blame] | 37 | |
| 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) |
| 48 | |
| 49 | # ----------------------------------------------------------------------------- |
| 50 | # Unit tests. |
| 51 | # ----------------------------------------------------------------------------- |
| 52 | |
Elliott Hughes | ad88a08 | 2012-10-24 18:37:21 -0700 | [diff] [blame] | 53 | test_c_flags = \ |
Nick Kralevich | dcab1b2 | 2013-01-10 17:12:29 -0800 | [diff] [blame] | 54 | -fstack-protector-all \ |
Elliott Hughes | ad88a08 | 2012-10-24 18:37:21 -0700 | [diff] [blame] | 55 | -g \ |
| 56 | -Wall -Wextra \ |
| 57 | -Werror \ |
Elliott Hughes | a0ee078 | 2013-01-30 19:06:37 -0800 | [diff] [blame] | 58 | -fno-builtin \ |
Elliott Hughes | ad88a08 | 2012-10-24 18:37:21 -0700 | [diff] [blame] | 59 | |
Elliott Hughes | cc213f8 | 2012-08-14 15:32:42 -0700 | [diff] [blame] | 60 | test_src_files = \ |
Elliott Hughes | 063cfb2 | 2012-10-25 20:55:23 -0700 | [diff] [blame] | 61 | dirent_test.cpp \ |
Kito Cheng | 8baa929 | 2013-04-03 11:29:40 +0800 | [diff] [blame] | 62 | eventfd_test.cpp \ |
Elliott Hughes | 0620925 | 2013-11-06 16:20:54 -0800 | [diff] [blame] | 63 | fcntl_test.cpp \ |
Elliott Hughes | 90e10d4 | 2012-11-02 17:05:20 -0700 | [diff] [blame] | 64 | fenv_test.cpp \ |
Nick Kralevich | 2c5153b | 2013-01-11 14:43:05 -0800 | [diff] [blame] | 65 | getauxval_test.cpp \ |
Elliott Hughes | 04a83a4 | 2012-08-16 15:59:12 -0700 | [diff] [blame] | 66 | getcwd_test.cpp \ |
Elliott Hughes | 74f0833 | 2013-07-02 15:23:38 -0700 | [diff] [blame] | 67 | inttypes_test.cpp \ |
Elliott Hughes | 8f2a5a0 | 2013-03-15 15:30:25 -0700 | [diff] [blame] | 68 | libc_logging_test.cpp \ |
Elliott Hughes | 58b5754 | 2012-10-29 14:27:10 -0700 | [diff] [blame] | 69 | libgen_test.cpp \ |
Christopher Ferris | 885f3b9 | 2013-05-21 17:48:01 -0700 | [diff] [blame] | 70 | malloc_test.cpp \ |
Elliott Hughes | a0ee078 | 2013-01-30 19:06:37 -0800 | [diff] [blame] | 71 | math_test.cpp \ |
Elliott Hughes | d3b9d11 | 2013-02-13 08:22:07 -0800 | [diff] [blame] | 72 | netdb_test.cpp \ |
Elliott Hughes | bfeab1b | 2012-09-05 17:47:37 -0700 | [diff] [blame] | 73 | pthread_test.cpp \ |
Elliott Hughes | cc213f8 | 2012-08-14 15:32:42 -0700 | [diff] [blame] | 74 | regex_test.cpp \ |
Elliott Hughes | 53bfdae | 2013-10-18 19:39:09 -0700 | [diff] [blame] | 75 | sched_test.cpp \ |
Elliott Hughes | da73f65 | 2012-11-30 16:40:55 -0800 | [diff] [blame] | 76 | signal_test.cpp \ |
Elliott Hughes | ad88a08 | 2012-10-24 18:37:21 -0700 | [diff] [blame] | 77 | stack_protector_test.cpp \ |
Sergey Melnikov | c45087b | 2013-01-25 16:40:13 +0400 | [diff] [blame] | 78 | stack_unwinding_test.cpp \ |
Elliott Hughes | 06040fd | 2013-07-09 13:25:03 -0700 | [diff] [blame] | 79 | statvfs_test.cpp \ |
Elliott Hughes | 91875dc | 2012-09-24 17:55:15 -0700 | [diff] [blame] | 80 | stdio_test.cpp \ |
Elliott Hughes | 774c7f5 | 2012-10-01 13:11:03 -0700 | [diff] [blame] | 81 | stdlib_test.cpp \ |
Irina Tirdea | b5f053b | 2012-09-08 09:17:54 +0300 | [diff] [blame] | 82 | string_test.cpp \ |
Elliott Hughes | 73964c5 | 2013-02-13 14:35:14 -0800 | [diff] [blame] | 83 | strings_test.cpp \ |
Kenny Root | 2a54e5e | 2012-09-13 10:52:52 -0700 | [diff] [blame] | 84 | stubs_test.cpp \ |
Elliott Hughes | 1195207 | 2013-10-24 15:15:14 -0700 | [diff] [blame] | 85 | sys_epoll_test.cpp \ |
Elliott Hughes | 5b9310e | 2013-10-02 16:59:05 -0700 | [diff] [blame] | 86 | sys_select_test.cpp \ |
Elliott Hughes | b4f7616 | 2013-09-19 16:27:24 -0700 | [diff] [blame] | 87 | sys_sendfile_test.cpp \ |
Elliott Hughes | d0be7c8 | 2013-08-08 17:13:33 -0700 | [diff] [blame] | 88 | sys_stat_test.cpp \ |
Elliott Hughes | e61dc71 | 2013-11-13 13:14:31 -0800 | [diff] [blame^] | 89 | sys_syscall_test.cpp \ |
Elliott Hughes | f8fcfbc | 2013-10-22 13:28:46 -0700 | [diff] [blame] | 90 | sys_time_test.cpp \ |
Colin Cross | b27e200 | 2013-01-28 17:19:43 -0800 | [diff] [blame] | 91 | system_properties_test.cpp \ |
Elliott Hughes | e0175ca | 2013-03-14 14:38:08 -0700 | [diff] [blame] | 92 | time_test.cpp \ |
Elliott Hughes | a55f630 | 2013-01-02 14:23:43 -0800 | [diff] [blame] | 93 | unistd_test.cpp \ |
Elliott Hughes | cc213f8 | 2012-08-14 15:32:42 -0700 | [diff] [blame] | 94 | |
jeffhao | acf5aa7 | 2012-09-12 17:25:30 -0700 | [diff] [blame] | 95 | test_dynamic_ldflags = -Wl,--export-dynamic -Wl,-u,DlSymTestFunction |
| 96 | test_dynamic_src_files = \ |
Elliott Hughes | e66190d | 2012-12-18 15:57:55 -0800 | [diff] [blame] | 97 | dlfcn_test.cpp \ |
jeffhao | acf5aa7 | 2012-09-12 17:25:30 -0700 | [diff] [blame] | 98 | |
Nick Kralevich | 5bcf398 | 2013-06-28 10:34:09 -0700 | [diff] [blame] | 99 | test_fortify_static_libraries = \ |
| 100 | fortify1-tests-gcc fortify2-tests-gcc fortify1-tests-clang fortify2-tests-clang |
| 101 | |
Sergey Melnikov | c45087b | 2013-01-25 16:40:13 +0400 | [diff] [blame] | 102 | include $(CLEAR_VARS) |
| 103 | LOCAL_MODULE := bionic-unit-tests-unwind-test-impl |
| 104 | LOCAL_CFLAGS += $(test_c_flags) -fexceptions -fnon-call-exceptions |
| 105 | LOCAL_SRC_FILES := stack_unwinding_test_impl.c |
| 106 | include $(BUILD_STATIC_LIBRARY) |
| 107 | |
| 108 | include $(CLEAR_VARS) |
| 109 | LOCAL_MODULE := bionic-unit-tests-unwind-test-impl-host |
| 110 | LOCAL_CFLAGS += $(test_c_flags) -fexceptions -fnon-call-exceptions |
| 111 | LOCAL_SRC_FILES := stack_unwinding_test_impl.c |
| 112 | include $(BUILD_HOST_STATIC_LIBRARY) |
| 113 | |
Elliott Hughes | 7be369d | 2012-11-08 15:37:43 -0800 | [diff] [blame] | 114 | # Build tests for the device (with bionic's .so). Run with: |
Elliott Hughes | cc213f8 | 2012-08-14 15:32:42 -0700 | [diff] [blame] | 115 | # adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests |
| 116 | include $(CLEAR_VARS) |
Joe Onorato | 7b841f3 | 2012-08-15 20:27:04 -0700 | [diff] [blame] | 117 | LOCAL_MODULE := bionic-unit-tests |
Elliott Hughes | 2e8f434 | 2012-09-05 14:27:17 -0700 | [diff] [blame] | 118 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Elliott Hughes | ad88a08 | 2012-10-24 18:37:21 -0700 | [diff] [blame] | 119 | LOCAL_CFLAGS += $(test_c_flags) |
jeffhao | acf5aa7 | 2012-09-12 17:25:30 -0700 | [diff] [blame] | 120 | LOCAL_LDFLAGS += $(test_dynamic_ldflags) |
| 121 | LOCAL_SHARED_LIBRARIES += libdl |
| 122 | LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files) |
Nick Kralevich | 5bcf398 | 2013-06-28 10:34:09 -0700 | [diff] [blame] | 123 | LOCAL_WHOLE_STATIC_LIBRARIES := $(test_fortify_static_libraries) |
Sergey Melnikov | c45087b | 2013-01-25 16:40:13 +0400 | [diff] [blame] | 124 | LOCAL_STATIC_LIBRARIES += bionic-unit-tests-unwind-test-impl |
Elliott Hughes | cc213f8 | 2012-08-14 15:32:42 -0700 | [diff] [blame] | 125 | include $(BUILD_NATIVE_TEST) |
| 126 | |
Elliott Hughes | 7be369d | 2012-11-08 15:37:43 -0800 | [diff] [blame] | 127 | # Build tests for the device (with bionic's .a). Run with: |
Elliott Hughes | bfeab1b | 2012-09-05 17:47:37 -0700 | [diff] [blame] | 128 | # adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static |
| 129 | include $(CLEAR_VARS) |
Elliott Hughes | bfeab1b | 2012-09-05 17:47:37 -0700 | [diff] [blame] | 130 | LOCAL_MODULE := bionic-unit-tests-static |
| 131 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
jeffhao | acf5aa7 | 2012-09-12 17:25:30 -0700 | [diff] [blame] | 132 | LOCAL_FORCE_STATIC_EXECUTABLE := true |
Christopher Ferris | 153d927 | 2013-08-27 14:32:15 -0700 | [diff] [blame] | 133 | LOCAL_WHOLE_STATIC_LIBRARIES += libBionicTests |
Christopher Ferris | 8240bed | 2013-08-29 11:37:33 -0700 | [diff] [blame] | 134 | LOCAL_STATIC_LIBRARIES += libstlport_static libstdc++ libm libc |
Elliott Hughes | bfeab1b | 2012-09-05 17:47:37 -0700 | [diff] [blame] | 135 | include $(BUILD_NATIVE_TEST) |
| 136 | |
Elliott Hughes | 7be369d | 2012-11-08 15:37:43 -0800 | [diff] [blame] | 137 | # ----------------------------------------------------------------------------- |
Christopher Ferris | 153d927 | 2013-08-27 14:32:15 -0700 | [diff] [blame] | 138 | # We build the static unit tests as a library so they can be used both for |
| 139 | # bionic-unit-tests-static and also as part of CTS. |
| 140 | # ----------------------------------------------------------------------------- |
| 141 | |
| 142 | include $(CLEAR_VARS) |
| 143 | LOCAL_MODULE := libBionicTests |
| 144 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 145 | LOCAL_CFLAGS += $(test_c_flags) |
| 146 | LOCAL_SRC_FILES := $(test_src_files) |
Christopher Ferris | 8240bed | 2013-08-29 11:37:33 -0700 | [diff] [blame] | 147 | LOCAL_CFLAGS += \ |
| 148 | -DGTEST_OS_LINUX_ANDROID \ |
| 149 | -DGTEST_HAS_STD_STRING \ |
| 150 | |
| 151 | LOCAL_C_INCLUDES += \ |
| 152 | bionic bionic/libstdc++/include \ |
| 153 | external/gtest/include \ |
| 154 | external/stlport/stlport \ |
| 155 | |
| 156 | LOCAL_WHOLE_STATIC_LIBRARIES := \ |
| 157 | $(test_fortify_static_libraries) \ |
| 158 | bionic-unit-tests-unwind-test-impl \ |
| 159 | |
Christopher Ferris | 153d927 | 2013-08-27 14:32:15 -0700 | [diff] [blame] | 160 | include $(BUILD_STATIC_LIBRARY) |
| 161 | |
| 162 | # ----------------------------------------------------------------------------- |
Elliott Hughes | 7be369d | 2012-11-08 15:37:43 -0800 | [diff] [blame] | 163 | # Test library for the unit tests. |
| 164 | # ----------------------------------------------------------------------------- |
Elliott Hughes | 124fae9 | 2012-10-31 14:20:03 -0700 | [diff] [blame] | 165 | |
| 166 | # Build no-elf-hash-table-library.so to test dlopen(3) on a library that |
Elliott Hughes | a43e906 | 2013-01-07 14:18:22 -0800 | [diff] [blame] | 167 | # only has a GNU-style hash table. MIPS doesn't support GNU hash style. |
| 168 | ifneq ($(TARGET_ARCH),mips) |
Elliott Hughes | 124fae9 | 2012-10-31 14:20:03 -0700 | [diff] [blame] | 169 | include $(CLEAR_VARS) |
| 170 | LOCAL_MODULE := no-elf-hash-table-library |
| 171 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 172 | LOCAL_SRC_FILES := empty.cpp |
| 173 | LOCAL_LDFLAGS := -Wl,--hash-style=gnu |
| 174 | include $(BUILD_SHARED_LIBRARY) |
Elliott Hughes | a43e906 | 2013-01-07 14:18:22 -0800 | [diff] [blame] | 175 | endif |
Elliott Hughes | 124fae9 | 2012-10-31 14:20:03 -0700 | [diff] [blame] | 176 | |
Elliott Hughes | 7be369d | 2012-11-08 15:37:43 -0800 | [diff] [blame] | 177 | # ----------------------------------------------------------------------------- |
| 178 | # Unit tests built against glibc. |
| 179 | # ----------------------------------------------------------------------------- |
Elliott Hughes | 124fae9 | 2012-10-31 14:20:03 -0700 | [diff] [blame] | 180 | |
Elliott Hughes | 7be369d | 2012-11-08 15:37:43 -0800 | [diff] [blame] | 181 | # Build tests for the host (with glibc). |
Elliott Hughes | cc213f8 | 2012-08-14 15:32:42 -0700 | [diff] [blame] | 182 | # Note that this will build against glibc, so it's not useful for testing |
| 183 | # bionic's implementation, but it does let you use glibc as a reference |
| 184 | # implementation for testing the tests themselves. |
Elliott Hughes | 38bfa21 | 2012-09-13 11:01:46 -0700 | [diff] [blame] | 185 | ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86) |
Elliott Hughes | cc213f8 | 2012-08-14 15:32:42 -0700 | [diff] [blame] | 186 | include $(CLEAR_VARS) |
Joe Onorato | 7b841f3 | 2012-08-15 20:27:04 -0700 | [diff] [blame] | 187 | LOCAL_MODULE := bionic-unit-tests-glibc |
Elliott Hughes | 2e8f434 | 2012-09-05 14:27:17 -0700 | [diff] [blame] | 188 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Elliott Hughes | ad88a08 | 2012-10-24 18:37:21 -0700 | [diff] [blame] | 189 | LOCAL_CFLAGS += $(test_c_flags) |
Jeff Hao | 9b06cc3 | 2013-08-15 14:51:16 -0700 | [diff] [blame] | 190 | LOCAL_LDFLAGS += -lpthread -ldl -lrt |
jeffhao | acf5aa7 | 2012-09-12 17:25:30 -0700 | [diff] [blame] | 191 | LOCAL_LDFLAGS += $(test_dynamic_ldflags) |
| 192 | LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files) |
Sergey Melnikov | c45087b | 2013-01-25 16:40:13 +0400 | [diff] [blame] | 193 | LOCAL_STATIC_LIBRARIES += bionic-unit-tests-unwind-test-impl-host |
Elliott Hughes | cc213f8 | 2012-08-14 15:32:42 -0700 | [diff] [blame] | 194 | include $(BUILD_HOST_NATIVE_TEST) |
Christopher Ferris | b38e4d5 | 2013-10-25 10:06:57 -0700 | [diff] [blame] | 195 | |
| 196 | # gtest needs ANDROID_DATA/local/tmp for death test output. |
| 197 | # Make sure to create ANDROID_DATA/local/tmp if doesn't exist. |
| 198 | # Use the current target out directory as ANDROID_DATA. |
| 199 | bionic-unit-tests-glibc-run: bionic-unit-tests-glibc |
| 200 | mkdir -p $(TARGET_OUT_DATA)/local/tmp |
| 201 | ANDROID_DATA=$(TARGET_OUT_DATA) \ |
| 202 | ANDROID_ROOT=$(TARGET_OUT) \ |
| 203 | $(HOST_OUT_EXECUTABLES)/bionic-unit-tests-glibc |
Elliott Hughes | 38bfa21 | 2012-09-13 11:01:46 -0700 | [diff] [blame] | 204 | endif |
Benoit Goby | 5ac9eee | 2012-08-31 19:52:15 -0700 | [diff] [blame] | 205 | |
Nick Kralevich | 16d1af1 | 2013-06-17 14:49:19 -0700 | [diff] [blame] | 206 | # ----------------------------------------------------------------------------- |
Pavel Chupin | f22fb68 | 2013-09-06 18:43:27 +0400 | [diff] [blame] | 207 | # Run the unit tests built against x86 bionic on an x86 host. |
| 208 | # ----------------------------------------------------------------------------- |
| 209 | |
| 210 | ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86) |
Pavel Chupin | 17558de | 2013-10-17 14:41:34 +0400 | [diff] [blame] | 211 | ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64)) |
Pavel Chupin | f22fb68 | 2013-09-06 18:43:27 +0400 | [diff] [blame] | 212 | ifeq ($(TARGET_ARCH),x86) |
Pavel Chupin | 17558de | 2013-10-17 14:41:34 +0400 | [diff] [blame] | 213 | LINKER = linker |
| 214 | else |
| 215 | LINKER = linker64 |
| 216 | endif |
Christopher Ferris | b38e4d5 | 2013-10-25 10:06:57 -0700 | [diff] [blame] | 217 | # gtest needs ANDROID_DATA/local/tmp for death test output. |
| 218 | # Make sure to create ANDROID_DATA/local/tmp if doesn't exist. |
Pavel Chupin | f22fb68 | 2013-09-06 18:43:27 +0400 | [diff] [blame] | 219 | # bionic itself should always work relative to ANDROID_DATA or ANDROID_ROOT. |
Pavel Chupin | 17558de | 2013-10-17 14:41:34 +0400 | [diff] [blame] | 220 | bionic-unit-tests-run-on-host: bionic-unit-tests $(TARGET_OUT_EXECUTABLES)/$(LINKER) $(TARGET_OUT_EXECUTABLES)/sh |
Christopher Ferris | b38e4d5 | 2013-10-25 10:06:57 -0700 | [diff] [blame] | 221 | if [ ! -d /system -o ! -d /system/bin ]; then \ |
| 222 | echo "Attempting to create /system/bin"; \ |
| 223 | sudo mkdir -p -m 0777 /system/bin; \ |
| 224 | fi |
Pavel Chupin | f22fb68 | 2013-09-06 18:43:27 +0400 | [diff] [blame] | 225 | mkdir -p $(TARGET_OUT_DATA)/local/tmp |
Pavel Chupin | 17558de | 2013-10-17 14:41:34 +0400 | [diff] [blame] | 226 | cp $(TARGET_OUT_EXECUTABLES)/$(LINKER) /system/bin |
Elliott Hughes | e60c4f0 | 2013-09-19 11:28:20 -0700 | [diff] [blame] | 227 | cp $(TARGET_OUT_EXECUTABLES)/sh /system/bin |
Pavel Chupin | f22fb68 | 2013-09-06 18:43:27 +0400 | [diff] [blame] | 228 | ANDROID_DATA=$(TARGET_OUT_DATA) \ |
| 229 | ANDROID_ROOT=$(TARGET_OUT) \ |
Pavel Chupin | f22fb68 | 2013-09-06 18:43:27 +0400 | [diff] [blame] | 230 | LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) \ |
| 231 | $(TARGET_OUT_DATA_NATIVE_TESTS)/bionic-unit-tests/bionic-unit-tests |
| 232 | endif |
| 233 | endif |
| 234 | |
| 235 | # ----------------------------------------------------------------------------- |
Nick Kralevich | 5bcf398 | 2013-06-28 10:34:09 -0700 | [diff] [blame] | 236 | # FORTIFY_SOURCE tests |
Nick Kralevich | 16d1af1 | 2013-06-17 14:49:19 -0700 | [diff] [blame] | 237 | # ----------------------------------------------------------------------------- |
Nick Kralevich | 5bcf398 | 2013-06-28 10:34:09 -0700 | [diff] [blame] | 238 | |
| 239 | fortify_c_includes = \ |
| 240 | bionic \ |
| 241 | bionic/libstdc++/include \ |
| 242 | external/stlport/stlport \ |
| 243 | external/gtest/include |
| 244 | fortify_test_files = fortify_test.cpp |
Nick Kralevich | 16d1af1 | 2013-06-17 14:49:19 -0700 | [diff] [blame] | 245 | |
| 246 | # -Wno-error=unused-parameter needed as |
| 247 | # external/stlport/stlport/stl/_threads.c (included from |
| 248 | # external/gtest/include/gtest/gtest.h) does not compile cleanly under |
| 249 | # clang. TODO: fix this. |
Nick Kralevich | 5bcf398 | 2013-06-28 10:34:09 -0700 | [diff] [blame] | 250 | fortify_c_flags = $(test_c_flags) -Wno-error=unused-parameter |
Nick Kralevich | 16d1af1 | 2013-06-17 14:49:19 -0700 | [diff] [blame] | 251 | |
Nick Kralevich | 5bcf398 | 2013-06-28 10:34:09 -0700 | [diff] [blame] | 252 | include $(CLEAR_VARS) |
| 253 | LOCAL_SRC_FILES := $(fortify_test_files) |
| 254 | LOCAL_MODULE := fortify1-tests-gcc |
| 255 | LOCAL_CFLAGS += $(fortify_c_flags) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DTEST_NAME=Fortify1_Gcc |
Nick Kralevich | 16d1af1 | 2013-06-17 14:49:19 -0700 | [diff] [blame] | 256 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Nick Kralevich | 5bcf398 | 2013-06-28 10:34:09 -0700 | [diff] [blame] | 257 | LOCAL_C_INCLUDES += $(fortify_c_includes) |
| 258 | include $(BUILD_STATIC_LIBRARY) |
Nick Kralevich | 16d1af1 | 2013-06-17 14:49:19 -0700 | [diff] [blame] | 259 | |
Nick Kralevich | 5bcf398 | 2013-06-28 10:34:09 -0700 | [diff] [blame] | 260 | include $(CLEAR_VARS) |
| 261 | LOCAL_SRC_FILES := $(fortify_test_files) |
| 262 | LOCAL_MODULE := fortify2-tests-gcc |
| 263 | LOCAL_CFLAGS += $(fortify_c_flags) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DTEST_NAME=Fortify2_Gcc |
| 264 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 265 | LOCAL_C_INCLUDES += $(fortify_c_includes) |
| 266 | include $(BUILD_STATIC_LIBRARY) |
| 267 | |
| 268 | include $(CLEAR_VARS) |
| 269 | LOCAL_SRC_FILES := $(fortify_test_files) |
| 270 | LOCAL_MODULE := fortify1-tests-clang |
| 271 | LOCAL_CLANG := true |
| 272 | LOCAL_CFLAGS += $(fortify_c_flags) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DTEST_NAME=Fortify1_Clang |
| 273 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 274 | LOCAL_C_INCLUDES += $(fortify_c_includes) |
| 275 | include $(BUILD_STATIC_LIBRARY) |
| 276 | |
| 277 | include $(CLEAR_VARS) |
| 278 | LOCAL_SRC_FILES := $(fortify_test_files) |
| 279 | LOCAL_MODULE := fortify2-tests-clang |
| 280 | LOCAL_CLANG := true |
| 281 | LOCAL_CFLAGS += $(fortify_c_flags) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DTEST_NAME=Fortify2_Clang |
| 282 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 283 | LOCAL_C_INCLUDES += $(fortify_c_includes) |
Nick Kralevich | 16d1af1 | 2013-06-17 14:49:19 -0700 | [diff] [blame] | 284 | include $(BUILD_STATIC_LIBRARY) |
| 285 | |
Benoit Goby | 5ac9eee | 2012-08-31 19:52:15 -0700 | [diff] [blame] | 286 | endif # !BUILD_TINY_ANDROID |