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 -Wall \ 28 -Wextra \ 29 -Werror \ 30 -fno-builtin \ 31 32 benchmark_src_files := \ 33 liblog_benchmark.cpp 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) 40 LOCAL_CFLAGS += $(benchmark_c_flags) 41 LOCAL_SHARED_LIBRARIES += liblog libm libbase 42 LOCAL_SRC_FILES := $(benchmark_src_files) 43 include $(BUILD_NATIVE_BENCHMARK) 44 45 # ----------------------------------------------------------------------------- 46 # Unit tests. 47 # ----------------------------------------------------------------------------- 48 49 test_c_flags := \ 50 -fstack-protector-all \ 51 -g \ 52 -Wall -Wextra \ 53 -Werror \ 54 -fno-builtin \ 55 56 cts_src_files := \ 57 libc_test.cpp \ 58 liblog_test_default.cpp \ 59 liblog_test_local.cpp \ 60 liblog_test_stderr.cpp \ 61 liblog_test_stderr_local.cpp \ 62 log_id_test.cpp \ 63 log_radio_test.cpp \ 64 log_read_test.cpp \ 65 log_system_test.cpp \ 66 log_time_test.cpp \ 67 log_wrap_test.cpp 68 69 test_src_files := \ 70 $(cts_src_files) \ 71 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) 77 LOCAL_CFLAGS += $(test_c_flags) 78 LOCAL_SHARED_LIBRARIES := liblog libcutils libbase 79 LOCAL_SRC_FILES := $(test_src_files) 80 include $(BUILD_NATIVE_TEST) 81 82 cts_executable := CtsLiblogTestCases 83 84 include $(CLEAR_VARS) 85 LOCAL_MODULE := $(cts_executable) 86 LOCAL_MODULE_TAGS := tests 87 LOCAL_CFLAGS += $(test_c_flags) -DNO_PSTORE 88 LOCAL_SRC_FILES := $(cts_src_files) 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 95 LOCAL_COMPATIBILITY_SUITE := cts vts 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 113 LOCAL_LDLIBS_linux := -lrt 114 include $(BUILD_HOST_NATIVE_TEST) 115 116 endif # ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64)) 117