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