blob: a407c50a5f9ec23b25e186638daab50f773f7403 [file] [log] [blame]
Mark Salyzyn819c58a2013-11-22 12:39:43 -08001#
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
17LOCAL_PATH := $(call my-dir)
18
19# -----------------------------------------------------------------------------
20# Benchmarks.
21# -----------------------------------------------------------------------------
22
23test_module_prefix := liblog-
24test_tags := tests
25
26benchmark_c_flags := \
27 -Ibionic/tests \
28 -Wall -Wextra \
29 -Werror \
30 -fno-builtin \
31 -std=gnu++11
32
33benchmark_src_files := \
34 benchmark_main.cpp \
Mark Salyzynd2e37472014-04-25 10:54:53 -070035 liblog_benchmark.cpp
Mark Salyzyn819c58a2013-11-22 12:39:43 -080036
37# Build benchmarks for the device. Run with:
38# adb shell liblog-benchmarks
39include $(CLEAR_VARS)
40LOCAL_MODULE := $(test_module_prefix)benchmarks
41LOCAL_MODULE_TAGS := $(test_tags)
Mark Salyzyn819c58a2013-11-22 12:39:43 -080042LOCAL_CFLAGS += $(benchmark_c_flags)
43LOCAL_SHARED_LIBRARIES += liblog libm
44LOCAL_SRC_FILES := $(benchmark_src_files)
Mark Salyzyn53016d82015-02-04 12:28:47 -080045include $(BUILD_NATIVE_TEST)
Mark Salyzyn819c58a2013-11-22 12:39:43 -080046
47# -----------------------------------------------------------------------------
48# Unit tests.
49# -----------------------------------------------------------------------------
50
51test_c_flags := \
52 -fstack-protector-all \
53 -g \
54 -Wall -Wextra \
55 -Werror \
Dmitriy Ivanov5f680872014-09-12 10:39:12 -070056 -fno-builtin \
57 -std=gnu++11
Mark Salyzyn819c58a2013-11-22 12:39:43 -080058
59test_src_files := \
Mark Salyzynd2e37472014-04-25 10:54:53 -070060 liblog_test.cpp
61
62# to prevent breaking the build if bionic not relatively visible to us
63ifneq ($(wildcard $(LOCAL_PATH)/../../../../bionic/libc/bionic/libc_logging.cpp),)
64
65test_src_files += \
66 libc_test.cpp
67
Dmitriy Ivanov85af05a2014-08-25 16:26:29 -070068ifneq ($(TARGET_USES_LOGD),false)
Mark Salyzynd2e37472014-04-25 10:54:53 -070069test_c_flags += -DTARGET_USES_LOGD
70endif
71
72endif
Mark Salyzyn819c58a2013-11-22 12:39:43 -080073
74# Build tests for the device (with .so). Run with:
75# adb shell /data/nativetest/liblog-unit-tests/liblog-unit-tests
76include $(CLEAR_VARS)
77LOCAL_MODULE := $(test_module_prefix)unit-tests
78LOCAL_MODULE_TAGS := $(test_tags)
Mark Salyzyn819c58a2013-11-22 12:39:43 -080079LOCAL_CFLAGS += $(test_c_flags)
Mark Salyzync1584562015-03-12 15:46:29 -070080LOCAL_SHARED_LIBRARIES := liblog libcutils
Mark Salyzyn819c58a2013-11-22 12:39:43 -080081LOCAL_SRC_FILES := $(test_src_files)
82include $(BUILD_NATIVE_TEST)