From b38e4d536f6592cf22b984c143ee6790d6df2351 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Fri, 25 Oct 2013 10:06:57 -0700 Subject: [PATCH] Update running bionic unit tests on host. Add a bionic-unit-tests-glibc-run target to run the glibc bionic unit tests. Modify the bionic-unit-tests-run-on-host to make sure that the /system/bin directory is created properly. Also remove the EXTERNAL_STORAGE variable which isn't used any more. Bug: 11234772 Change-Id: I9aea501d05700b29e938f672474d550b1872a78b --- tests/Android.mk | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/Android.mk b/tests/Android.mk index f1174808c..3345e3e75 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -190,6 +190,15 @@ LOCAL_LDFLAGS += $(test_dynamic_ldflags) 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 # ----------------------------------------------------------------------------- @@ -203,17 +212,19 @@ LINKER = linker else LINKER = linker64 endif -# gtest needs EXTERNAL_STORAGE for death test output. +# 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. -# We create /data/local/tmp to be as much like the regular target environment -# as possible. 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) \ - EXTERNAL_STORAGE=$(TARGET_OUT_DATA)/local/tmp \ LD_LIBRARY_PATH=$(TARGET_OUT_SHARED_LIBRARIES) \ $(TARGET_OUT_DATA_NATIVE_TESTS)/bionic-unit-tests/bionic-unit-tests endif