Mark Salyzyn | 819c58a | 2013-11-22 12:39:43 -0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2013-2014 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
| 17 | LOCAL_PATH := $(call my-dir) |
| 18 | |
| 19 | # ----------------------------------------------------------------------------- |
| 20 | # Benchmarks. |
| 21 | # ----------------------------------------------------------------------------- |
| 22 | |
| 23 | test_module_prefix := liblog- |
| 24 | test_tags := tests |
| 25 | |
| 26 | benchmark_c_flags := \ |
| 27 | -Ibionic/tests \ |
| 28 | -Wall -Wextra \ |
| 29 | -Werror \ |
| 30 | -fno-builtin \ |
| 31 | -std=gnu++11 |
| 32 | |
| 33 | benchmark_src_files := \ |
| 34 | benchmark_main.cpp \ |
Mark Salyzyn | d2e3747 | 2014-04-25 10:54:53 -0700 | [diff] [blame] | 35 | liblog_benchmark.cpp |
Mark Salyzyn | 819c58a | 2013-11-22 12:39:43 -0800 | [diff] [blame] | 36 | |
| 37 | # Build benchmarks for the device. Run with: |
| 38 | # adb shell liblog-benchmarks |
| 39 | include $(CLEAR_VARS) |
| 40 | LOCAL_MODULE := $(test_module_prefix)benchmarks |
| 41 | LOCAL_MODULE_TAGS := $(test_tags) |
| 42 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 43 | LOCAL_CFLAGS += $(benchmark_c_flags) |
| 44 | LOCAL_SHARED_LIBRARIES += liblog libm |
| 45 | LOCAL_SRC_FILES := $(benchmark_src_files) |
Mark Salyzyn | 819c58a | 2013-11-22 12:39:43 -0800 | [diff] [blame] | 46 | LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE) |
| 47 | include $(BUILD_EXECUTABLE) |
| 48 | |
| 49 | # ----------------------------------------------------------------------------- |
| 50 | # Unit tests. |
| 51 | # ----------------------------------------------------------------------------- |
| 52 | |
| 53 | test_c_flags := \ |
| 54 | -fstack-protector-all \ |
| 55 | -g \ |
| 56 | -Wall -Wextra \ |
| 57 | -Werror \ |
Dmitriy Ivanov | 5f68087 | 2014-09-12 10:39:12 -0700 | [diff] [blame] | 58 | -fno-builtin \ |
| 59 | -std=gnu++11 |
Mark Salyzyn | 819c58a | 2013-11-22 12:39:43 -0800 | [diff] [blame] | 60 | |
| 61 | test_src_files := \ |
Mark Salyzyn | d2e3747 | 2014-04-25 10:54:53 -0700 | [diff] [blame] | 62 | liblog_test.cpp |
| 63 | |
| 64 | # to prevent breaking the build if bionic not relatively visible to us |
| 65 | ifneq ($(wildcard $(LOCAL_PATH)/../../../../bionic/libc/bionic/libc_logging.cpp),) |
| 66 | |
| 67 | test_src_files += \ |
| 68 | libc_test.cpp |
| 69 | |
Dmitriy Ivanov | 85af05a | 2014-08-25 16:26:29 -0700 | [diff] [blame] | 70 | ifneq ($(TARGET_USES_LOGD),false) |
Mark Salyzyn | d2e3747 | 2014-04-25 10:54:53 -0700 | [diff] [blame] | 71 | test_c_flags += -DTARGET_USES_LOGD |
| 72 | endif |
| 73 | |
| 74 | endif |
Mark Salyzyn | 819c58a | 2013-11-22 12:39:43 -0800 | [diff] [blame] | 75 | |
| 76 | # Build tests for the device (with .so). Run with: |
| 77 | # adb shell /data/nativetest/liblog-unit-tests/liblog-unit-tests |
| 78 | include $(CLEAR_VARS) |
| 79 | LOCAL_MODULE := $(test_module_prefix)unit-tests |
| 80 | LOCAL_MODULE_TAGS := $(test_tags) |
| 81 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
| 82 | LOCAL_CFLAGS += $(test_c_flags) |
Mark Salyzyn | 819c58a | 2013-11-22 12:39:43 -0800 | [diff] [blame] | 83 | LOCAL_SHARED_LIBRARIES := liblog |
| 84 | LOCAL_SRC_FILES := $(test_src_files) |
| 85 | include $(BUILD_NATIVE_TEST) |