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 \ |
Mark Salyzyn | 819c58a | 2013-11-22 12:39:43 -0800 | [diff] [blame] | 31 | |
| 32 | benchmark_src_files := \ |
| 33 | benchmark_main.cpp \ |
Mark Salyzyn | d2e3747 | 2014-04-25 10:54:53 -0700 | [diff] [blame] | 34 | liblog_benchmark.cpp |
Mark Salyzyn | 819c58a | 2013-11-22 12:39:43 -0800 | [diff] [blame] | 35 | |
| 36 | # Build benchmarks for the device. Run with: |
| 37 | # adb shell liblog-benchmarks |
| 38 | include $(CLEAR_VARS) |
| 39 | LOCAL_MODULE := $(test_module_prefix)benchmarks |
| 40 | LOCAL_MODULE_TAGS := $(test_tags) |
Mark Salyzyn | 819c58a | 2013-11-22 12:39:43 -0800 | [diff] [blame] | 41 | LOCAL_CFLAGS += $(benchmark_c_flags) |
Mark Salyzyn | 807e40e | 2016-09-22 09:56:51 -0700 | [diff] [blame] | 42 | LOCAL_SHARED_LIBRARIES += liblog libm libbase |
Mark Salyzyn | 819c58a | 2013-11-22 12:39:43 -0800 | [diff] [blame] | 43 | LOCAL_SRC_FILES := $(benchmark_src_files) |
Mark Salyzyn | 53016d8 | 2015-02-04 12:28:47 -0800 | [diff] [blame] | 44 | include $(BUILD_NATIVE_TEST) |
Mark Salyzyn | 819c58a | 2013-11-22 12:39:43 -0800 | [diff] [blame] | 45 | |
| 46 | # ----------------------------------------------------------------------------- |
| 47 | # Unit tests. |
| 48 | # ----------------------------------------------------------------------------- |
| 49 | |
| 50 | test_c_flags := \ |
| 51 | -fstack-protector-all \ |
| 52 | -g \ |
| 53 | -Wall -Wextra \ |
| 54 | -Werror \ |
Dmitriy Ivanov | 5f68087 | 2014-09-12 10:39:12 -0700 | [diff] [blame] | 55 | -fno-builtin \ |
Mark Salyzyn | 819c58a | 2013-11-22 12:39:43 -0800 | [diff] [blame] | 56 | |
| 57 | test_src_files := \ |
Mark Salyzyn | 7100288 | 2016-03-08 16:18:26 -0800 | [diff] [blame] | 58 | liblog_test_default.cpp \ |
| 59 | liblog_test_local.cpp \ |
Mark Salyzyn | c89fea4 | 2016-12-22 08:01:45 -0800 | [diff] [blame] | 60 | log_id_test.cpp \ |
Mark Salyzyn | dd61659 | 2016-12-22 08:08:11 -0800 | [diff] [blame] | 61 | log_radio_test.cpp \ |
Mark Salyzyn | 21de8ac | 2017-01-25 09:00:57 -0800 | [diff] [blame] | 62 | log_read_test.cpp \ |
Mark Salyzyn | 52c140c | 2017-01-25 08:16:33 -0800 | [diff] [blame] | 63 | log_system_test.cpp \ |
| 64 | log_time_test.cpp |
Mark Salyzyn | d2e3747 | 2014-04-25 10:54:53 -0700 | [diff] [blame] | 65 | |
| 66 | # to prevent breaking the build if bionic not relatively visible to us |
| 67 | ifneq ($(wildcard $(LOCAL_PATH)/../../../../bionic/libc/bionic/libc_logging.cpp),) |
| 68 | |
| 69 | test_src_files += \ |
| 70 | libc_test.cpp |
| 71 | |
Mark Salyzyn | d2e3747 | 2014-04-25 10:54:53 -0700 | [diff] [blame] | 72 | endif |
Mark Salyzyn | 819c58a | 2013-11-22 12:39:43 -0800 | [diff] [blame] | 73 | |
| 74 | # Build tests for the device (with .so). Run with: |
| 75 | # adb shell /data/nativetest/liblog-unit-tests/liblog-unit-tests |
| 76 | include $(CLEAR_VARS) |
| 77 | LOCAL_MODULE := $(test_module_prefix)unit-tests |
| 78 | LOCAL_MODULE_TAGS := $(test_tags) |
Mark Salyzyn | 819c58a | 2013-11-22 12:39:43 -0800 | [diff] [blame] | 79 | LOCAL_CFLAGS += $(test_c_flags) |
Mark Salyzyn | 807e40e | 2016-09-22 09:56:51 -0700 | [diff] [blame] | 80 | LOCAL_SHARED_LIBRARIES := liblog libcutils libbase |
Mark Salyzyn | 819c58a | 2013-11-22 12:39:43 -0800 | [diff] [blame] | 81 | LOCAL_SRC_FILES := $(test_src_files) |
| 82 | include $(BUILD_NATIVE_TEST) |
Mark Salyzyn | 52ed8c6 | 2016-03-29 16:54:25 -0700 | [diff] [blame] | 83 | |
| 84 | cts_executable := CtsLiblogTestCases |
| 85 | |
| 86 | include $(CLEAR_VARS) |
| 87 | LOCAL_MODULE := $(cts_executable) |
| 88 | LOCAL_MODULE_TAGS := tests |
| 89 | LOCAL_CFLAGS += $(test_c_flags) |
| 90 | LOCAL_SRC_FILES := $(test_src_files) |
| 91 | LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest |
| 92 | LOCAL_MULTILIB := both |
| 93 | LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32 |
| 94 | LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64 |
| 95 | LOCAL_SHARED_LIBRARIES := liblog libcutils libbase |
| 96 | LOCAL_STATIC_LIBRARIES := libgtest libgtest_main |
| 97 | LOCAL_COMPATIBILITY_SUITE := cts |
| 98 | LOCAL_CTS_TEST_PACKAGE := android.core.liblog |
| 99 | include $(BUILD_CTS_EXECUTABLE) |
| 100 | |
| 101 | ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64)) |
| 102 | |
| 103 | include $(CLEAR_VARS) |
| 104 | LOCAL_MODULE := $(cts_executable)_list |
| 105 | LOCAL_MODULE_TAGS := optional |
| 106 | LOCAL_CFLAGS := $(test_c_flags) -DHOST |
| 107 | LOCAL_C_INCLUDES := external/gtest/include |
| 108 | LOCAL_SRC_FILES := $(test_src_files) |
| 109 | LOCAL_MULTILIB := both |
| 110 | LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE) |
| 111 | LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64 |
| 112 | LOCAL_CXX_STL := libc++ |
| 113 | LOCAL_SHARED_LIBRARIES := liblog libcutils libbase |
| 114 | LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk |
Mark Salyzyn | 62d0d2d | 2016-03-08 16:18:26 -0800 | [diff] [blame] | 115 | LOCAL_LDLIBS_linux := -lrt |
Mark Salyzyn | 52ed8c6 | 2016-03-29 16:54:25 -0700 | [diff] [blame] | 116 | include $(BUILD_HOST_NATIVE_TEST) |
| 117 | |
| 118 | endif # ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64)) |