Android.mk revision e7c59f9e2041812c597ff1c8689d47d1bfd32883
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 25ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughestest_c_flags = \ 26dcab1b2c76a498c56bc00024613386de8b4b2aaeNick Kralevich -fstack-protector-all \ 27ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughes -g \ 28ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughes -Wall -Wextra \ 29ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughes -Werror \ 30a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes -fno-builtin \ 31ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughes 32282e232e2a32cca8a288e81edddfd95f450cfc79Serban Constantinescuifeq ($(TARGET_ARCH),aarch64) 33282e232e2a32cca8a288e81edddfd95f450cfc79Serban Constantinescu $(info TODO: $(LOCAL_PATH)/Android.mk -fstack-protector not yet available for the AArch64 toolchain) 34282e232e2a32cca8a288e81edddfd95f450cfc79Serban Constantinescu test_c_flags += -fno-stack-protector 35282e232e2a32cca8a288e81edddfd95f450cfc79Serban Constantinescuendif # aarch64 36282e232e2a32cca8a288e81edddfd95f450cfc79Serban Constantinescu 37cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughestest_src_files = \ 38b687ad3c3491fffe22507cafc9347e10cbf6bd31Christopher Ferris buffer_tests.cpp \ 39063cfb2084ea4b12d3c85b2d2c44e888f0857eb4Elliott Hughes dirent_test.cpp \ 408baa929d5d3bcf63381cf78ba76168c80c303f5eKito Cheng eventfd_test.cpp \ 41062092543fdbd6fa2676e4f5b37a15f7bba94332Elliott Hughes fcntl_test.cpp \ 4290e10d41c4271a5d517f60f4ff1d2891b8ccc034Elliott Hughes fenv_test.cpp \ 432c5153b043b44e9935a334ae9b2d5a4bc5258b40Nick Kralevich getauxval_test.cpp \ 4404a83a48ed89f433c78e31106ed50059764797a0Elliott Hughes getcwd_test.cpp \ 4574f0833df6d04d51eb4e554845862ed7279f78b0Elliott Hughes inttypes_test.cpp \ 468f2a5a0b40fc82126c691d5c30131d908772aab7Elliott Hughes libc_logging_test.cpp \ 4758b575485c446f9d76ee00f67516ed42cf017769Elliott Hughes libgen_test.cpp \ 48885f3b9cad01b8158aadc55c159c17dbf34f622cChristopher Ferris malloc_test.cpp \ 49a0ee07829a9ba7e99ef68e8c12551301cc797f0fElliott Hughes math_test.cpp \ 50d3b9d11369ee15dc0ce512014284c3c5432f2813Elliott Hughes netdb_test.cpp \ 51bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott Hughes pthread_test.cpp \ 52cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes regex_test.cpp \ 5353bfdae4ffdbd43d0c019d1a35af1f8477a272c9Elliott Hughes sched_test.cpp \ 54da73f655fcbac6e1a8bfd35303cef6f41187d12bElliott Hughes signal_test.cpp \ 55ad88a0863110798cef5169dcf917e18b967a7cf6Elliott Hughes stack_protector_test.cpp \ 56c45087bffa528c0809f0df2e0a3708eba7018b33Sergey Melnikov stack_unwinding_test.cpp \ 5706040fd75c1edff9e5ffb2b3d3e2a6e66d57c11dElliott Hughes statvfs_test.cpp \ 5891875dcd6e17b7f3b251efe9b236b905ef414ddeElliott Hughes stdio_test.cpp \ 59774c7f54ff375d71106283d42779b0cc5f238f87Elliott Hughes stdlib_test.cpp \ 60b5f053b5a7deb084e7a052d527e0aa41339ae05cIrina Tirdea string_test.cpp \ 6173964c592c8d23901e9479893dfbd3d0f25bab04Elliott Hughes strings_test.cpp \ 622a54e5ecd0a96398e8d7d9b1629ecf8fb1633a2bKenny Root stubs_test.cpp \ 6311952073af22568bba0b661f7a9d4402c443a888Elliott Hughes sys_epoll_test.cpp \ 645b9310e502003e584bcb3a028ca3db7aa4d3f01bElliott Hughes sys_select_test.cpp \ 65b4f7616fd618875768b8fffc122b58bdb84a9969Elliott Hughes sys_sendfile_test.cpp \ 66d0be7c8f9a06b3ca8ea7647ea35c8f9dc63f0fe1Elliott Hughes sys_stat_test.cpp \ 67e61dc71efca544f4066a93706b639a29b3600229Elliott Hughes sys_syscall_test.cpp \ 68f8fcfbc85a3ce3e195626b90736d3a484331494bElliott Hughes sys_time_test.cpp \ 69b27e200ad6170ba3163f5ae6ba581bdaabb2e696Colin Cross system_properties_test.cpp \ 70e0175ca7e440a87e9d03f249fc8f210063df7908Elliott Hughes time_test.cpp \ 71a55f63083fb16b2595f517a3260083e5f8cddd02Elliott Hughes unistd_test.cpp \ 72cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes 73acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaotest_dynamic_ldflags = -Wl,--export-dynamic -Wl,-u,DlSymTestFunction 74acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaotest_dynamic_src_files = \ 75e66190d2a97a713ae4b4786e60ca3d67ab8aa192Elliott Hughes dlfcn_test.cpp \ 76acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhao 775bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevichtest_fortify_static_libraries = \ 785bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevich fortify1-tests-gcc fortify2-tests-gcc fortify1-tests-clang fortify2-tests-clang 795bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevich 80c45087bffa528c0809f0df2e0a3708eba7018b33Sergey Melnikovinclude $(CLEAR_VARS) 81c45087bffa528c0809f0df2e0a3708eba7018b33Sergey MelnikovLOCAL_MODULE := bionic-unit-tests-unwind-test-impl 82c45087bffa528c0809f0df2e0a3708eba7018b33Sergey MelnikovLOCAL_CFLAGS += $(test_c_flags) -fexceptions -fnon-call-exceptions 83c45087bffa528c0809f0df2e0a3708eba7018b33Sergey MelnikovLOCAL_SRC_FILES := stack_unwinding_test_impl.c 84c45087bffa528c0809f0df2e0a3708eba7018b33Sergey Melnikovinclude $(BUILD_STATIC_LIBRARY) 85c45087bffa528c0809f0df2e0a3708eba7018b33Sergey Melnikov 86c45087bffa528c0809f0df2e0a3708eba7018b33Sergey Melnikovinclude $(CLEAR_VARS) 87c45087bffa528c0809f0df2e0a3708eba7018b33Sergey MelnikovLOCAL_MODULE := bionic-unit-tests-unwind-test-impl-host 88c45087bffa528c0809f0df2e0a3708eba7018b33Sergey MelnikovLOCAL_CFLAGS += $(test_c_flags) -fexceptions -fnon-call-exceptions 89c45087bffa528c0809f0df2e0a3708eba7018b33Sergey MelnikovLOCAL_SRC_FILES := stack_unwinding_test_impl.c 90c45087bffa528c0809f0df2e0a3708eba7018b33Sergey Melnikovinclude $(BUILD_HOST_STATIC_LIBRARY) 91c45087bffa528c0809f0df2e0a3708eba7018b33Sergey Melnikov 927be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# Build tests for the device (with bionic's .so). Run with: 93cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests 94cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughesinclude $(CLEAR_VARS) 957b841f3b4ad121dd64f639c1858b42defffd60bdJoe OnoratoLOCAL_MODULE := bionic-unit-tests 962e8f4345dfe16e64d7a3c26f688f17f2b48b2dd1Elliott HughesLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 97ad88a0863110798cef5169dcf917e18b967a7cf6Elliott HughesLOCAL_CFLAGS += $(test_c_flags) 98acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaoLOCAL_LDFLAGS += $(test_dynamic_ldflags) 99acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaoLOCAL_SHARED_LIBRARIES += libdl 100acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaoLOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files) 1015bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_WHOLE_STATIC_LIBRARIES := $(test_fortify_static_libraries) 102c45087bffa528c0809f0df2e0a3708eba7018b33Sergey MelnikovLOCAL_STATIC_LIBRARIES += bionic-unit-tests-unwind-test-impl 103cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughesinclude $(BUILD_NATIVE_TEST) 104cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes 1057be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# Build tests for the device (with bionic's .a). Run with: 106bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott Hughes# adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static 107bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott Hughesinclude $(CLEAR_VARS) 108bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott HughesLOCAL_MODULE := bionic-unit-tests-static 109bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott HughesLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 110acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaoLOCAL_FORCE_STATIC_EXECUTABLE := true 111153d92765bb693541abf49a2a1d31335e2c90348Christopher FerrisLOCAL_WHOLE_STATIC_LIBRARIES += libBionicTests 1128240bed918722944c9985bc0cca89eb44c4f6c91Christopher FerrisLOCAL_STATIC_LIBRARIES += libstlport_static libstdc++ libm libc 113bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott Hughesinclude $(BUILD_NATIVE_TEST) 114bfeab1bbe7e8d0c08b7e3f46aedab64e3b2bf706Elliott Hughes 1157be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# ----------------------------------------------------------------------------- 116153d92765bb693541abf49a2a1d31335e2c90348Christopher Ferris# We build the static unit tests as a library so they can be used both for 117153d92765bb693541abf49a2a1d31335e2c90348Christopher Ferris# bionic-unit-tests-static and also as part of CTS. 118153d92765bb693541abf49a2a1d31335e2c90348Christopher Ferris# ----------------------------------------------------------------------------- 119153d92765bb693541abf49a2a1d31335e2c90348Christopher Ferris 120153d92765bb693541abf49a2a1d31335e2c90348Christopher Ferrisinclude $(CLEAR_VARS) 121153d92765bb693541abf49a2a1d31335e2c90348Christopher FerrisLOCAL_MODULE := libBionicTests 122153d92765bb693541abf49a2a1d31335e2c90348Christopher FerrisLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 123153d92765bb693541abf49a2a1d31335e2c90348Christopher FerrisLOCAL_CFLAGS += $(test_c_flags) 124153d92765bb693541abf49a2a1d31335e2c90348Christopher FerrisLOCAL_SRC_FILES := $(test_src_files) 1258240bed918722944c9985bc0cca89eb44c4f6c91Christopher FerrisLOCAL_CFLAGS += \ 1268240bed918722944c9985bc0cca89eb44c4f6c91Christopher Ferris -DGTEST_OS_LINUX_ANDROID \ 1278240bed918722944c9985bc0cca89eb44c4f6c91Christopher Ferris -DGTEST_HAS_STD_STRING \ 1288240bed918722944c9985bc0cca89eb44c4f6c91Christopher Ferris 1298240bed918722944c9985bc0cca89eb44c4f6c91Christopher FerrisLOCAL_C_INCLUDES += \ 1308240bed918722944c9985bc0cca89eb44c4f6c91Christopher Ferris bionic bionic/libstdc++/include \ 1318240bed918722944c9985bc0cca89eb44c4f6c91Christopher Ferris external/gtest/include \ 1328240bed918722944c9985bc0cca89eb44c4f6c91Christopher Ferris external/stlport/stlport \ 1338240bed918722944c9985bc0cca89eb44c4f6c91Christopher Ferris 1348240bed918722944c9985bc0cca89eb44c4f6c91Christopher FerrisLOCAL_WHOLE_STATIC_LIBRARIES := \ 1358240bed918722944c9985bc0cca89eb44c4f6c91Christopher Ferris $(test_fortify_static_libraries) \ 1368240bed918722944c9985bc0cca89eb44c4f6c91Christopher Ferris bionic-unit-tests-unwind-test-impl \ 1378240bed918722944c9985bc0cca89eb44c4f6c91Christopher Ferris 138153d92765bb693541abf49a2a1d31335e2c90348Christopher Ferrisinclude $(BUILD_STATIC_LIBRARY) 139153d92765bb693541abf49a2a1d31335e2c90348Christopher Ferris 140153d92765bb693541abf49a2a1d31335e2c90348Christopher Ferris# ----------------------------------------------------------------------------- 1417be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# Test library for the unit tests. 1427be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# ----------------------------------------------------------------------------- 143124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott Hughes 144124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott Hughes# Build no-elf-hash-table-library.so to test dlopen(3) on a library that 145a43e906221a3e9c70a66118a8692cd46f77e144eElliott Hughes# only has a GNU-style hash table. MIPS doesn't support GNU hash style. 146a43e906221a3e9c70a66118a8692cd46f77e144eElliott Hughesifneq ($(TARGET_ARCH),mips) 147124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott Hughesinclude $(CLEAR_VARS) 148124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott HughesLOCAL_MODULE := no-elf-hash-table-library 149124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott HughesLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 150124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott HughesLOCAL_SRC_FILES := empty.cpp 151124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott HughesLOCAL_LDFLAGS := -Wl,--hash-style=gnu 152124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott Hughesinclude $(BUILD_SHARED_LIBRARY) 153a43e906221a3e9c70a66118a8692cd46f77e144eElliott Hughesendif 154124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott Hughes 1557be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# ----------------------------------------------------------------------------- 1567be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# Unit tests built against glibc. 1577be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# ----------------------------------------------------------------------------- 158124fae9eabd7a25d80dfa8c3b56bed0f0fba16f1Elliott Hughes 1597be369d4c60e9df2316fdb6c73181a40020abef2Elliott Hughes# Build tests for the host (with glibc). 160cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# Note that this will build against glibc, so it's not useful for testing 161cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# bionic's implementation, but it does let you use glibc as a reference 162cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughes# implementation for testing the tests themselves. 16338bfa21695b19c21784d2074de30d5d102f08972Elliott Hughesifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86) 164cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughesinclude $(CLEAR_VARS) 1657b841f3b4ad121dd64f639c1858b42defffd60bdJoe OnoratoLOCAL_MODULE := bionic-unit-tests-glibc 1662e8f4345dfe16e64d7a3c26f688f17f2b48b2dd1Elliott HughesLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 167ad88a0863110798cef5169dcf917e18b967a7cf6Elliott HughesLOCAL_CFLAGS += $(test_c_flags) 1689b06cc3c1b2c4e2b08582f3fc9393a05aa589766Jeff HaoLOCAL_LDFLAGS += -lpthread -ldl -lrt 169acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaoLOCAL_LDFLAGS += $(test_dynamic_ldflags) 170acf5aa76a56f101607aeb8e6d1fbea24d0d4f68cjeffhaoLOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files) 171c45087bffa528c0809f0df2e0a3708eba7018b33Sergey MelnikovLOCAL_STATIC_LIBRARIES += bionic-unit-tests-unwind-test-impl-host 172cc213f871bf4c5329eb5eb7a80a0ce9d4a880af8Elliott Hughesinclude $(BUILD_HOST_NATIVE_TEST) 173b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris 174b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris# gtest needs ANDROID_DATA/local/tmp for death test output. 175b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris# Make sure to create ANDROID_DATA/local/tmp if doesn't exist. 176b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris# Use the current target out directory as ANDROID_DATA. 177b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferrisbionic-unit-tests-glibc-run: bionic-unit-tests-glibc 178b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris mkdir -p $(TARGET_OUT_DATA)/local/tmp 179b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris ANDROID_DATA=$(TARGET_OUT_DATA) \ 180b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris ANDROID_ROOT=$(TARGET_OUT) \ 181b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris $(HOST_OUT_EXECUTABLES)/bionic-unit-tests-glibc 18238bfa21695b19c21784d2074de30d5d102f08972Elliott Hughesendif 1835ac9eee1d3291a0d203a125849b4636a11c0d124Benoit Goby 18416d1af167f8e36a9aa4a07ae77034ad519b00463Nick Kralevich# ----------------------------------------------------------------------------- 185f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin# Run the unit tests built against x86 bionic on an x86 host. 186f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin# ----------------------------------------------------------------------------- 187f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin 188f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupinifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86) 18917558dec7fc60775c940be0e494b42829f35e0b1Pavel Chupinifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64)) 190f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupinifeq ($(TARGET_ARCH),x86) 19117558dec7fc60775c940be0e494b42829f35e0b1Pavel ChupinLINKER = linker 19217558dec7fc60775c940be0e494b42829f35e0b1Pavel Chupinelse 19317558dec7fc60775c940be0e494b42829f35e0b1Pavel ChupinLINKER = linker64 19417558dec7fc60775c940be0e494b42829f35e0b1Pavel Chupinendif 195b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris# gtest needs ANDROID_DATA/local/tmp for death test output. 196b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris# Make sure to create ANDROID_DATA/local/tmp if doesn't exist. 197f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin# bionic itself should always work relative to ANDROID_DATA or ANDROID_ROOT. 19817558dec7fc60775c940be0e494b42829f35e0b1Pavel Chupinbionic-unit-tests-run-on-host: bionic-unit-tests $(TARGET_OUT_EXECUTABLES)/$(LINKER) $(TARGET_OUT_EXECUTABLES)/sh 199b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris if [ ! -d /system -o ! -d /system/bin ]; then \ 200b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris echo "Attempting to create /system/bin"; \ 201b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris sudo mkdir -p -m 0777 /system/bin; \ 202b38e4d536f6592cf22b984c143ee6790d6df2351Christopher Ferris fi 203f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin mkdir -p $(TARGET_OUT_DATA)/local/tmp 20417558dec7fc60775c940be0e494b42829f35e0b1Pavel Chupin cp $(TARGET_OUT_EXECUTABLES)/$(LINKER) /system/bin 205e60c4f0a6cb5836caa8d0de299cc83fe4b13744cElliott Hughes cp $(TARGET_OUT_EXECUTABLES)/sh /system/bin 206f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin ANDROID_DATA=$(TARGET_OUT_DATA) \ 207f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin ANDROID_ROOT=$(TARGET_OUT) \ 208f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) \ 209f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin $(TARGET_OUT_DATA_NATIVE_TESTS)/bionic-unit-tests/bionic-unit-tests 210f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupinendif 211f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupinendif 212f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin 213f22fb68751c4040f3335cb0bd2d47f87c3ee1aacPavel Chupin# ----------------------------------------------------------------------------- 2145bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevich# FORTIFY_SOURCE tests 21516d1af167f8e36a9aa4a07ae77034ad519b00463Nick Kralevich# ----------------------------------------------------------------------------- 2165bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevich 2175bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevichfortify_c_includes = \ 2185bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevich bionic \ 2195bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevich bionic/libstdc++/include \ 2205bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevich external/stlport/stlport \ 2215bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevich external/gtest/include 2225bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevichfortify_test_files = fortify_test.cpp 22316d1af167f8e36a9aa4a07ae77034ad519b00463Nick Kralevich 22416d1af167f8e36a9aa4a07ae77034ad519b00463Nick Kralevich# -Wno-error=unused-parameter needed as 22516d1af167f8e36a9aa4a07ae77034ad519b00463Nick Kralevich# external/stlport/stlport/stl/_threads.c (included from 22616d1af167f8e36a9aa4a07ae77034ad519b00463Nick Kralevich# external/gtest/include/gtest/gtest.h) does not compile cleanly under 22716d1af167f8e36a9aa4a07ae77034ad519b00463Nick Kralevich# clang. TODO: fix this. 2285bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevichfortify_c_flags = $(test_c_flags) -Wno-error=unused-parameter 2295bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevich 2305bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevichinclude $(CLEAR_VARS) 2315bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_SRC_FILES := $(fortify_test_files) 2325bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_MODULE := fortify1-tests-gcc 2335bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_CFLAGS += $(fortify_c_flags) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DTEST_NAME=Fortify1_Gcc 2345bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 2355bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_C_INCLUDES += $(fortify_c_includes) 2365bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevichinclude $(BUILD_STATIC_LIBRARY) 2375bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevich 2385bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevichinclude $(CLEAR_VARS) 2395bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_SRC_FILES := $(fortify_test_files) 2405bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_MODULE := fortify2-tests-gcc 2415bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_CFLAGS += $(fortify_c_flags) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DTEST_NAME=Fortify2_Gcc 2425bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 2435bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_C_INCLUDES += $(fortify_c_includes) 2445bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevichinclude $(BUILD_STATIC_LIBRARY) 24516d1af167f8e36a9aa4a07ae77034ad519b00463Nick Kralevich 2465bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevichinclude $(CLEAR_VARS) 2475bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_SRC_FILES := $(fortify_test_files) 2485bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_MODULE := fortify1-tests-clang 2495bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_CLANG := true 2505bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_CFLAGS += $(fortify_c_flags) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DTEST_NAME=Fortify1_Clang 25116d1af167f8e36a9aa4a07ae77034ad519b00463Nick KralevichLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 2525bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_C_INCLUDES += $(fortify_c_includes) 2535bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevichinclude $(BUILD_STATIC_LIBRARY) 25416d1af167f8e36a9aa4a07ae77034ad519b00463Nick Kralevich 2555bcf39842e8c4b02ae557a2765a84e724f762469Nick Kralevichinclude $(CLEAR_VARS) 2565bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_SRC_FILES := $(fortify_test_files) 2575bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_MODULE := fortify2-tests-clang 2585bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_CLANG := true 2595bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_CFLAGS += $(fortify_c_flags) -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DTEST_NAME=Fortify2_Clang 2605bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk 2615bcf39842e8c4b02ae557a2765a84e724f762469Nick KralevichLOCAL_C_INCLUDES += $(fortify_c_includes) 26216d1af167f8e36a9aa4a07ae77034ad519b00463Nick Kralevichinclude $(BUILD_STATIC_LIBRARY) 26316d1af167f8e36a9aa4a07ae77034ad519b00463Nick Kralevich 2645ac9eee1d3291a0d203a125849b4636a11c0d124Benoit Gobyendif # !BUILD_TINY_ANDROID 265