Android.mk revision b5f053b5a7deb084e7a052d527e0aa41339ae05c
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
21test_src_files = \
22    getcwd_test.cpp \
23    pthread_test.cpp \
24    regex_test.cpp \
25    string_test.cpp \
26
27test_dynamic_ldflags = -Wl,--export-dynamic -Wl,-u,DlSymTestFunction
28test_dynamic_src_files = \
29    dlopen_test.cpp \
30
31# Build for the device (with bionic's .so). Run with:
32#   adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
33include $(CLEAR_VARS)
34LOCAL_MODULE := bionic-unit-tests
35LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
36LOCAL_LDFLAGS += $(test_dynamic_ldflags)
37LOCAL_SHARED_LIBRARIES += libdl
38LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files)
39include $(BUILD_NATIVE_TEST)
40
41# Build for the device (with bionic's .a). Run with:
42#   adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
43include $(CLEAR_VARS)
44LOCAL_MODULE := bionic-unit-tests-static
45LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
46LOCAL_FORCE_STATIC_EXECUTABLE := true
47LOCAL_SRC_FILES := $(test_src_files)
48LOCAL_STATIC_LIBRARIES += libstlport_static libstdc++ libm libc
49include $(BUILD_NATIVE_TEST)
50
51# Build for the host (with glibc).
52# Note that this will build against glibc, so it's not useful for testing
53# bionic's implementation, but it does let you use glibc as a reference
54# implementation for testing the tests themselves.
55include $(CLEAR_VARS)
56LOCAL_MODULE := bionic-unit-tests-glibc
57LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
58LOCAL_LDFLAGS += -lpthread -ldl
59LOCAL_LDFLAGS += $(test_dynamic_ldflags)
60LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files)
61include $(BUILD_HOST_NATIVE_TEST)
62
63endif # !BUILD_TINY_ANDROID
64