Home | History | Annotate | Download | only in tests
      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 
     17 ifneq ($(BUILD_TINY_ANDROID), true)
     18 
     19 LOCAL_PATH := $(call my-dir)
     20 
     21 # -----------------------------------------------------------------------------
     22 # Benchmarks.
     23 # -----------------------------------------------------------------------------
     24 
     25 benchmark_c_flags = \
     26     -O2 \
     27     -Wall -Wextra \
     28     -Werror \
     29     -fno-builtin \
     30 
     31 benchmark_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
     39 include $(CLEAR_VARS)
     40 LOCAL_MODULE := bionic-benchmarks
     41 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
     42 LOCAL_CFLAGS += $(benchmark_c_flags)
     43 LOCAL_C_INCLUDES += external/stlport/stlport bionic/ bionic/libstdc++/include
     44 LOCAL_SHARED_LIBRARIES += libstlport
     45 LOCAL_SRC_FILES := $(benchmark_src_files)
     46 include $(BUILD_EXECUTABLE)
     47 
     48 # -----------------------------------------------------------------------------
     49 # Unit tests.
     50 # -----------------------------------------------------------------------------
     51 
     52 test_c_flags = \
     53     -fstack-protector-all \
     54     -g \
     55     -Wall -Wextra \
     56     -Werror \
     57     -fno-builtin \
     58 
     59 test_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 
     81 test_dynamic_ldflags = -Wl,--export-dynamic -Wl,-u,DlSymTestFunction
     82 test_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
     87 include $(CLEAR_VARS)
     88 LOCAL_MODULE := bionic-unit-tests
     89 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
     90 LOCAL_CFLAGS += $(test_c_flags)
     91 LOCAL_LDFLAGS += $(test_dynamic_ldflags)
     92 LOCAL_SHARED_LIBRARIES += libdl
     93 LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files)
     94 include $(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
     98 include $(CLEAR_VARS)
     99 LOCAL_MODULE := bionic-unit-tests-static
    100 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
    101 LOCAL_CFLAGS += $(test_c_flags)
    102 LOCAL_FORCE_STATIC_EXECUTABLE := true
    103 LOCAL_SRC_FILES := $(test_src_files)
    104 LOCAL_STATIC_LIBRARIES += libstlport_static libstdc++ libm libc
    105 include $(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.
    113 ifneq ($(TARGET_ARCH),mips)
    114 include $(CLEAR_VARS)
    115 LOCAL_MODULE := no-elf-hash-table-library
    116 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
    117 LOCAL_SRC_FILES := empty.cpp
    118 LOCAL_LDFLAGS := -Wl,--hash-style=gnu
    119 include $(BUILD_SHARED_LIBRARY)
    120 endif
    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.
    130 ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
    131 include $(CLEAR_VARS)
    132 LOCAL_MODULE := bionic-unit-tests-glibc
    133 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
    134 LOCAL_CFLAGS += $(test_c_flags)
    135 LOCAL_LDFLAGS += -lpthread -ldl
    136 LOCAL_LDFLAGS += $(test_dynamic_ldflags)
    137 LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files)
    138 include $(BUILD_HOST_NATIVE_TEST)
    139 endif
    140 
    141 endif # !BUILD_TINY_ANDROID
    142