]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/platform-bionic.git/commitdiff
Add bionic-unit-tests-run-on-host special target
authorPavel Chupin <pavel.v.chupin@intel.com>
Fri, 6 Sep 2013 14:43:27 +0000 (18:43 +0400)
committerElliott Hughes <enh@google.com>
Thu, 19 Sep 2013 02:09:24 +0000 (19:09 -0700)
Allows running the tests linked with bionic .so on the host if host and
target are compatible. See more comments and usage limitation inlined.

make bionic-unit-tests-run-on-host should do build and run.

Change-Id: I5946fa72e009d324baa9da18f460294b3c1a615e
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
tests/Android.mk

index 534aa301782eea5e3ad2ebffaa80a03a46536550..c7688de20619aee90cc2f3442c7077305f4eb6b5 100644 (file)
@@ -187,6 +187,27 @@ LOCAL_STATIC_LIBRARIES += bionic-unit-tests-unwind-test-impl-host
 include $(BUILD_HOST_NATIVE_TEST)
 endif
 
+# -----------------------------------------------------------------------------
+# Run the unit tests built against x86 bionic on an x86 host.
+# -----------------------------------------------------------------------------
+
+ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
+ifeq ($(TARGET_ARCH),x86)
+# gtest needs EXTERNAL_STORAGE for death test output.
+# 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
+       mkdir -p $(TARGET_OUT_DATA)/local/tmp
+       cp $(TARGET_OUT_EXECUTABLES)/linker /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
+endif
+
 # -----------------------------------------------------------------------------
 # FORTIFY_SOURCE tests
 # -----------------------------------------------------------------------------