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