• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (C) 2012 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
17ifneq ($(BUILD_TINY_ANDROID), true)
18
19LOCAL_PATH := $(call my-dir)
20
21# -----------------------------------------------------------------------------
22# Benchmarks.
23# -----------------------------------------------------------------------------
24
25benchmark_c_flags = \
26    -O2 \
27    -Wall -Wextra \
28    -Werror \
29    -fno-builtin \
30
31benchmark_src_files = \
32    benchmark_main.cpp \
33    math_benchmark.cpp \
34    string_benchmark.cpp \
35    time_benchmark.cpp \
36
37# Build benchmarks for the device (with bionic's .so). Run with:
38#   adb shell bionic-benchmarks
39include $(CLEAR_VARS)
40LOCAL_MODULE := bionic-benchmarks
41LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
42LOCAL_CFLAGS += $(benchmark_c_flags)
43LOCAL_C_INCLUDES += external/stlport/stlport bionic/ bionic/libstdc++/include
44LOCAL_SHARED_LIBRARIES += libstlport
45LOCAL_SRC_FILES := $(benchmark_src_files)
46include $(BUILD_EXECUTABLE)
47
48# -----------------------------------------------------------------------------
49# Unit tests.
50# -----------------------------------------------------------------------------
51
52test_c_flags = \
53    -fstack-protector-all \
54    -g \
55    -Wall -Wextra \
56    -Werror \
57    -fno-builtin \
58
59test_src_files = \
60    dirent_test.cpp \
61    eventfd_test.cpp \
62    fenv_test.cpp \
63    getauxval_test.cpp \
64    getcwd_test.cpp \
65    libc_logging_test.cpp \
66    libgen_test.cpp \
67    math_test.cpp \
68    netdb_test.cpp \
69    pthread_test.cpp \
70    regex_test.cpp \
71    signal_test.cpp \
72    stack_protector_test.cpp \
73    stdio_test.cpp \
74    stdlib_test.cpp \
75    string_test.cpp \
76    strings_test.cpp \
77    stubs_test.cpp \
78    time_test.cpp \
79    unistd_test.cpp \
80
81test_dynamic_ldflags = -Wl,--export-dynamic -Wl,-u,DlSymTestFunction
82test_dynamic_src_files = \
83    dlfcn_test.cpp \
84
85# Build tests for the device (with bionic's .so). Run with:
86#   adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
87include $(CLEAR_VARS)
88LOCAL_MODULE := bionic-unit-tests
89LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
90LOCAL_CFLAGS += $(test_c_flags)
91LOCAL_LDFLAGS += $(test_dynamic_ldflags)
92LOCAL_SHARED_LIBRARIES += libdl
93LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files)
94include $(BUILD_NATIVE_TEST)
95
96# Build tests for the device (with bionic's .a). Run with:
97#   adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
98include $(CLEAR_VARS)
99LOCAL_MODULE := bionic-unit-tests-static
100LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
101LOCAL_CFLAGS += $(test_c_flags)
102LOCAL_FORCE_STATIC_EXECUTABLE := true
103LOCAL_SRC_FILES := $(test_src_files)
104LOCAL_STATIC_LIBRARIES += libstlport_static libstdc++ libm libc
105include $(BUILD_NATIVE_TEST)
106
107# -----------------------------------------------------------------------------
108# Test library for the unit tests.
109# -----------------------------------------------------------------------------
110
111# Build no-elf-hash-table-library.so to test dlopen(3) on a library that
112# only has a GNU-style hash table. MIPS doesn't support GNU hash style.
113ifneq ($(TARGET_ARCH),mips)
114include $(CLEAR_VARS)
115LOCAL_MODULE := no-elf-hash-table-library
116LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
117LOCAL_SRC_FILES := empty.cpp
118LOCAL_LDFLAGS := -Wl,--hash-style=gnu
119include $(BUILD_SHARED_LIBRARY)
120endif
121
122# -----------------------------------------------------------------------------
123# Unit tests built against glibc.
124# -----------------------------------------------------------------------------
125
126# Build tests for the host (with glibc).
127# Note that this will build against glibc, so it's not useful for testing
128# bionic's implementation, but it does let you use glibc as a reference
129# implementation for testing the tests themselves.
130ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
131include $(CLEAR_VARS)
132LOCAL_MODULE := bionic-unit-tests-glibc
133LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
134LOCAL_CFLAGS += $(test_c_flags)
135LOCAL_LDFLAGS += -lpthread -ldl
136LOCAL_LDFLAGS += $(test_dynamic_ldflags)
137LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files)
138include $(BUILD_HOST_NATIVE_TEST)
139endif
140
141endif # !BUILD_TINY_ANDROID
142