diff --git a/tests/Android.mk b/tests/Android.mk
index 59fe57dc60dfb4335d54be6db65a0553ba267b5f..93ab9bde620fd0ddafbd0a87d485d5c599fa3ce7 100644 (file)
--- a/tests/Android.mk
+++ b/tests/Android.mk
build_host := false
endif
+common_additional_dependencies := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Android.build.mk
+
# -----------------------------------------------------------------------------
# All standard tests.
# -----------------------------------------------------------------------------
libBionicStandardTests_src_files := \
arpa_inet_test.cpp \
buffer_tests.cpp \
+ complex_test.cpp \
ctype_test.cpp \
dirent_test.cpp \
eventfd_test.cpp \
libgen_test.cpp \
locale_test.cpp \
malloc_test.cpp \
- math_cos_test.cpp \
- math_cosf_test.cpp \
- math_exp_test.cpp \
- math_expf_test.cpp \
- math_log_test.cpp \
- math_logf_test.cpp \
- math_pow_test.cpp \
- math_powf_test.cpp \
- math_sin_test.cpp \
- math_sinf_test.cpp \
- math_sincos_test.cpp \
- math_sincosf_test.cpp \
- math_tan_test.cpp \
- math_tanf_test.cpp \
math_test.cpp \
mntent_test.cpp \
netdb_test.cpp \
sched_test.cpp \
search_test.cpp \
semaphore_test.cpp \
+ setjmp_test.cpp \
signal_test.cpp \
stack_protector_test.cpp \
+ stack_unwinding_test.cpp \
stdatomic_test.cpp \
stdint_test.cpp \
stdio_test.cpp \
sys_stat_test.cpp \
sys_statvfs_test.cpp \
sys_syscall_test.cpp \
+ sys_sysinfo_test.cpp \
sys_time_test.cpp \
sys_types_test.cpp \
sys_vfs_test.cpp \
$(foreach test,1 2, \
$(eval fortify$(test)-tests-$(compiler)_cflags := \
$(test_cflags) \
+ -Wno-error \
-U_FORTIFY_SOURCE \
-D_FORTIFY_SOURCE=$(test) \
-DTEST_NAME=Fortify$(test)_$(compiler)); \
- $(eval fortify$(test)-tests-$(compiler)_cflags_host := \
- -Wno-error); \
$(eval fortify$(test)-tests-$(compiler)_src_files := \
fortify_test.cpp); \
$(eval fortify_libs += fortify$(test)-tests-$(compiler)); \
bionic-unit-tests_src_files := \
atexit_test.cpp \
+ dl_test.cpp \
dlext_test.cpp \
dlfcn_test.cpp \
- stack_unwinding_test.cpp \
- stack_unwinding_test_impl.c \
bionic-unit-tests_cflags := $(test_cflags)
bionic-unit-tests_cppflags := $(test_cppflags)
bionic-unit-tests_ldflags := \
- -Wl,--export-dynamic \
- -Wl,-u,DlSymTestFunction \
+ -Wl,--export-dynamic
bionic-unit-tests_c_includes := \
bionic/libc \
bionic-unit-tests_shared_libraries_target := \
libdl \
libpagemap \
+ libdl_preempt_test_1 \
+ libdl_preempt_test_2
+
+ifneq ($(filter $(TARGET_ARCH),arm arm64),$(TARGET_ARCH))
+bionic-unit-tests_shared_libraries_target += libdl_test_df_1_global
+endif
module := bionic-unit-tests
module_tag := optional
libBionicTests \
bionic-unit-tests-static_static_libraries := \
- libstlport_static \
libm \
libc \
- libstdc++ \
+ libc++_static \
+ libdl \
libtinyxml2 \
liblog \
bionic-unit-tests-static_force_static_executable := true
+# libc and libc++ both define std::nothrow. libc's is a private symbol, but this
+# still causes issues when linking libc.a and libc++.a, since private isn't
+# effective until it has been linked. To fix this, just allow multiple symbol
+# definitions for the static tests.
+bionic-unit-tests-static_ldflags := -Wl,--allow-multiple-definition
+
module := bionic-unit-tests-static
module_tag := optional
build_type := target
@@ -296,6 +297,13 @@ ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x
bionic-unit-tests-glibc_src_files := \
atexit_test.cpp \
dlfcn_test.cpp \
+ dl_test.cpp \
+
+bionic-unit-tests-glibc_shared_libraries := \
+ libdl_preempt_test_1 \
+ libdl_preempt_test_2
+
+bionic-unit-tests-glibc_shared_libraries += libdl_test_df_1_global
bionic-unit-tests-glibc_whole_static_libraries := \
libBionicStandardTests \
bionic-unit-tests-glibc_cppflags := $(test_cppflags)
bionic-unit-tests-glibc_ldflags := -Wl,--export-dynamic
+bionic-unit-tests-glibc_allow_asan := true
+
module := bionic-unit-tests-glibc
module_tag := optional
build_type := host
build_target := NATIVE_TEST
include $(LOCAL_PATH)/Android.build.mk
-ifneq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),arm mips x86))
-LINKER = linker64
-NATIVE_TEST_SUFFIX=64
-else
-LINKER = linker
-NATIVE_TEST_SUFFIX=32
-endif
+# -----------------------------------------------------------------------------
+# Compile time tests.
+# -----------------------------------------------------------------------------
+
+# Some of these are intentionally using = instead of := since we need access to
+# some variables not initialtized until we're in the build system.
+
+include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := \
+ $(LOCAL_PATH)/Android.mk \
+ $(LOCAL_PATH)/file-check-cxx \
+ | $(HOST_OUT_EXECUTABLES)/FileCheck$(HOST_EXECUTABLE_SUFFIX) \
+
+LOCAL_CXX = $(LOCAL_PATH)/file-check-cxx \
+ $(HOST_OUT_EXECUTABLES)/FileCheck \
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)CXX_BARE) \
+ GCC \
+
+LOCAL_CLANG := false
+LOCAL_MODULE := bionic-compile-time-tests-g++
+LOCAL_CXXFLAGS := -Wall
+LOCAL_SRC_FILES := fortify_sprintf_warnings.cpp
+include $(BUILD_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := \
+ $(LOCAL_PATH)/Android.mk \
+ $(LOCAL_PATH)/file-check-cxx \
+ | $(HOST_OUT_EXECUTABLES)/FileCheck$(HOST_EXECUTABLE_SUFFIX) \
+
+LOCAL_CXX := $(LOCAL_PATH)/file-check-cxx \
+ $(HOST_OUT_EXECUTABLES)/FileCheck \
+ $(LLVM_PREBUILTS_PATH)/clang++ \
+ CLANG \
+
+LOCAL_CLANG := true
+LOCAL_MODULE := bionic-compile-time-tests-clang++
+LOCAL_CXXFLAGS := -Wall
+# FileCheck will error if there aren't any CLANG: lines in the file, but there
+# don't appear to be any cases where clang _does_ emit warnings for sn?printf :(
+LOCAL_SRC_FILES :=
+include $(BUILD_STATIC_LIBRARY)
+
+# -----------------------------------------------------------------------------
+# Host glibc tests.
+# -----------------------------------------------------------------------------
# gtest needs ANDROID_DATA/local/tmp for death test output.
# Make sure to create ANDROID_DATA/local/tmp if doesn't exist.
mkdir -p $(TARGET_OUT_DATA)/local/tmp
ANDROID_DATA=$(TARGET_OUT_DATA) \
ANDROID_ROOT=$(TARGET_OUT) \
- $(HOST_OUT_EXECUTABLES)/bionic-unit-tests-glibc$(NATIVE_TEST_SUFFIX) $(BIONIC_TEST_FLAGS)
+ $(HOST_OUT_EXECUTABLES)/bionic-unit-tests-glibc64 $(BIONIC_TEST_FLAGS)
# -----------------------------------------------------------------------------
# Run the unit tests built against x86 bionic on an x86 host.
# -----------------------------------------------------------------------------
+include $(LOCAL_PATH)/../build/run-on-host.mk
+
ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
-# gtest needs ANDROID_DATA/local/tmp for death test output.
-# Make sure to create ANDROID_DATA/local/tmp if doesn't exist.
-# bionic itself should always work relative to ANDROID_DATA or ANDROID_ROOT.
# BIONIC_TEST_FLAGS is either empty or it comes from the user.
-bionic-unit-tests-run-on-host: bionic-unit-tests $(TARGET_OUT_EXECUTABLES)/$(LINKER) $(TARGET_OUT_EXECUTABLES)/sh
- if [ ! -d /system -o ! -d /system/bin ]; then \
- echo "Attempting to create /system/bin"; \
- sudo mkdir -p -m 0777 /system/bin; \
- fi
- mkdir -p $(TARGET_OUT_DATA)/local/tmp
- cp $(TARGET_OUT_EXECUTABLES)/$(LINKER) /system/bin
- cp $(TARGET_OUT_EXECUTABLES)/sh /system/bin
+bionic-unit-tests-run-on-host32: bionic-unit-tests bionic-prepare-run-on-host
ANDROID_DATA=$(TARGET_OUT_DATA) \
+ ANDROID_DNS_MODE=local \
ANDROID_ROOT=$(TARGET_OUT) \
- LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) \
- $(TARGET_OUT_DATA_NATIVE_TESTS)/bionic-unit-tests/bionic-unit-tests$(NATIVE_TEST_SUFFIX) $(BIONIC_TEST_FLAGS)
-endif
+ $(TARGET_OUT_DATA)/nativetest/bionic-unit-tests/bionic-unit-tests32 $(BIONIC_TEST_FLAGS)
-ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86_64))
-# add target to run lp32 tests
-bionic-unit-tests-run-on-host32: bionic-unit-tests_32 $(TARGET_OUT_EXECUTABLES)/$(LINKER) $(TARGET_OUT_EXECUTABLES)/sh
- if [ ! -d /system -o ! -d /system/bin ]; then \
- echo "Attempting to create /system/bin"; \
- sudo mkdir -p -m 0777 /system/bin; \
- fi
- mkdir -p $(TARGET_OUT_DATA)/local/tmp
- cp $(TARGET_OUT_EXECUTABLES)/linker /system/bin
- cp $(TARGET_OUT_EXECUTABLES)/sh /system/bin
+ifeq ($(TARGET_IS_64_BIT),true)
+# add target to run lp64 tests
+bionic-unit-tests-run-on-host64: bionic-unit-tests bionic-prepare-run-on-host
ANDROID_DATA=$(TARGET_OUT_DATA) \
+ ANDROID_DNS_MODE=local \
ANDROID_ROOT=$(TARGET_OUT) \
- LD_LIBRARY_PATH=$(2ND_TARGET_OUT_SHARED_LIBRARIES) \
- $(2ND_TARGET_OUT_DATA_NATIVE_TESTS)/bionic-unit-tests/bionic-unit-tests32 $(BIONIC_TEST_FLAGS)
+ $(TARGET_OUT_DATA)/nativetest64/bionic-unit-tests/bionic-unit-tests64 $(BIONIC_TEST_FLAGS)
endif
+endif # x86 x86_64
endif # linux-x86
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Android.build.mk
-
include $(call first-makefiles-under,$(LOCAL_PATH))
endif # !BUILD_TINY_ANDROID