diff --git a/tests/Android.mk b/tests/Android.mk
index 534aa301782eea5e3ad2ebffaa80a03a46536550..b5398f1529f0c0fd92511f87e32de630358f7b75 100644 (file)
--- a/tests/Android.mk
+++ b/tests/Android.mk
LOCAL_PATH := $(call my-dir)
-# -----------------------------------------------------------------------------
-# Benchmarks.
-# -----------------------------------------------------------------------------
-
-benchmark_c_flags = \
- -O2 \
- -Wall -Wextra \
- -Werror \
- -fno-builtin \
-
-benchmark_src_files = \
- benchmark_main.cpp \
- math_benchmark.cpp \
- property_benchmark.cpp \
- string_benchmark.cpp \
- time_benchmark.cpp \
-
-# Build benchmarks for the device (with bionic's .so). Run with:
-# adb shell bionic-benchmarks
-include $(CLEAR_VARS)
-LOCAL_MODULE := bionic-benchmarks
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-LOCAL_CFLAGS += $(benchmark_c_flags)
-LOCAL_C_INCLUDES += external/stlport/stlport bionic/ bionic/libstdc++/include
-LOCAL_SHARED_LIBRARIES += libstlport
-LOCAL_SRC_FILES := $(benchmark_src_files)
-include $(BUILD_EXECUTABLE)
-
# -----------------------------------------------------------------------------
# Unit tests.
# -----------------------------------------------------------------------------
-fno-builtin \
test_src_files = \
+ buffer_tests.cpp \
dirent_test.cpp \
eventfd_test.cpp \
+ fcntl_test.cpp \
fenv_test.cpp \
getauxval_test.cpp \
getcwd_test.cpp \
netdb_test.cpp \
pthread_test.cpp \
regex_test.cpp \
+ sched_test.cpp \
signal_test.cpp \
stack_protector_test.cpp \
stack_unwinding_test.cpp \
string_test.cpp \
strings_test.cpp \
stubs_test.cpp \
+ sys_epoll_test.cpp \
+ sys_select_test.cpp \
+ sys_sendfile_test.cpp \
sys_stat_test.cpp \
+ sys_syscall_test.cpp \
+ sys_time_test.cpp \
system_properties_test.cpp \
time_test.cpp \
unistd_test.cpp \
LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files)
LOCAL_STATIC_LIBRARIES += bionic-unit-tests-unwind-test-impl-host
include $(BUILD_HOST_NATIVE_TEST)
+
+# gtest needs ANDROID_DATA/local/tmp for death test output.
+# Make sure to create ANDROID_DATA/local/tmp if doesn't exist.
+# Use the current target out directory as ANDROID_DATA.
+bionic-unit-tests-glibc-run: bionic-unit-tests-glibc
+ mkdir -p $(TARGET_OUT_DATA)/local/tmp
+ ANDROID_DATA=$(TARGET_OUT_DATA) \
+ ANDROID_ROOT=$(TARGET_OUT) \
+ $(HOST_OUT_EXECUTABLES)/bionic-unit-tests-glibc
+endif
+
+# -----------------------------------------------------------------------------
+# Run the unit tests built against x86 bionic on an x86 host.
+# -----------------------------------------------------------------------------
+
+ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
+ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
+ifeq ($(TARGET_ARCH),x86)
+LINKER = linker
+else
+LINKER = linker64
+endif
+# 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-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
+ ANDROID_DATA=$(TARGET_OUT_DATA) \
+ ANDROID_ROOT=$(TARGET_OUT) \
+ LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) \
+ $(TARGET_OUT_DATA_NATIVE_TESTS)/bionic-unit-tests/bionic-unit-tests
+endif
endif
# -----------------------------------------------------------------------------