bionic-unit-tests: Build host testlibs in bionic-loader-test-libs

The target test libs are now all built in
nativetest/bionic-loader-test-libs. However, libs built using
libs/Android.build.testlib.mk are still put in lib/ on the host.

This commit refactors libs/Android.build.testlib*.mk so that all test
libs go into nativetest/bionic-loader-test-libs on the host; nothing
changes on the target. Android.build.mk now understands
*_install_to_native_tests_dir both for host and target builds.

Change-Id: I1022e9bab38bf53036c95fd39b3b240bcb31f23a
This commit is contained in:
Kevin Brodsky 2016-12-09 09:54:42 +00:00
parent 227894a754
commit ee2952e84f
6 changed files with 52 additions and 31 deletions

View File

@ -20,24 +20,30 @@ LOCAL_ADDITIONAL_DEPENDENCIES := $(common_additional_dependencies)
LOCAL_MODULE := $(module)
LOCAL_MODULE_TAGS := $(module_tag)
ifeq ($(build_type),host)
# Always make host multilib
LOCAL_MULTILIB := both
# Always make host multilib
LOCAL_MULTILIB := both
endif
ifneq ($(findstring LIBRARY, $(build_target)),LIBRARY)
LOCAL_MODULE_STEM_32 := $(module)32
LOCAL_MODULE_STEM_64 := $(module)64
LOCAL_MODULE_STEM_32 := $(module)32
LOCAL_MODULE_STEM_64 := $(module)64
else
ifneq ($($(module)_install_to_out_data_dir),)
LOCAL_MODULE_PATH_32 := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS)/$($(module)_install_to_out_data_dir)
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_DATA_NATIVE_TESTS)/$($(module)_install_to_out_data_dir)
ifneq ($($(module)_install_to_native_tests_dir),)
ifeq ($(build_type),host)
native_tests_var := HOST_OUT_NATIVE_TESTS
else
native_tests_var := TARGET_OUT_DATA_NATIVE_TESTS
endif
LOCAL_MODULE_PATH_32 := $($(TARGET_2ND_ARCH_VAR_PREFIX)$(native_tests_var))/$($(module)_install_to_native_tests_dir)
LOCAL_MODULE_PATH_64 := $($(native_tests_var))/$($(module)_install_to_native_tests_dir)
endif
endif
LOCAL_CLANG := $($(module)_clang_$(build_type))
ifneq ($($(module)_allow_asan),true)
LOCAL_SANITIZE := never
LOCAL_SANITIZE := never
endif
LOCAL_FORCE_STATIC_EXECUTABLE := $($(module)_force_static_executable)
@ -45,11 +51,11 @@ LOCAL_FORCE_STATIC_EXECUTABLE := $($(module)_force_static_executable)
LOCAL_ALLOW_UNDEFINED_SYMBOLS := $($(module)_allow_undefined_symbols)
ifneq ($($(module)_multilib),)
LOCAL_MULTILIB := $($(module)_multilib)
LOCAL_MULTILIB := $($(module)_multilib)
endif
ifneq ($($(module)_relative_path),)
LOCAL_MODULE_RELATIVE_PATH := $($(module)_relative_path)
LOCAL_MODULE_RELATIVE_PATH := $($(module)_relative_path)
endif
LOCAL_CFLAGS := \
@ -97,9 +103,9 @@ LOCAL_LDLIBS := \
$($(module)_ldlibs_$(build_type)) \
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
LOCAL_CXX_STL := libc++_static
LOCAL_CXX_STL := libc++_static
else
LOCAL_CXX_STL := libc++
LOCAL_CXX_STL := libc++
endif
ifeq ($(build_type),target)

View File

@ -80,7 +80,7 @@ libtest_dt_runpath_d_zip_src_files := \
libtest_dt_runpath_d_zip_shared_libraries := libtest_dt_runpath_b libtest_dt_runpath_c
libtest_dt_runpath_d_zip_ldflags := -Wl,--rpath,\$${ORIGIN}/dt_runpath_b_c_x -Wl,--enable-new-dtags
libtest_dt_runpath_d_zip_ldlibs := -ldl
libtest_dt_runpath_d_zip_install_to_out_data_dir := $(module)
libtest_dt_runpath_d_zip_install_to_native_tests_dir := $(module)
module_tag := optional
build_type := target

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2015 The Android Open Source Project
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -15,6 +15,5 @@
#
build_target := SHARED_LIBRARY
build_type := target
include $(TEST_PATH)/Android.build.mk
build_type := host
include $(LOCAL_PATH)/Android.build.testlib.internal.mk

View File

@ -0,0 +1,27 @@
#
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# 1. Install test libraries to $ANDROID_DATA/nativetests../bionic-loader-test-libs/
# by default.
ifeq ($($(module)_relative_install_path),)
$(module)_install_to_native_tests_dir := bionic-loader-test-libs
else
$(module)_install_to_native_tests_dir := bionic-loader-test-libs/$($(module)_relative_install_path)
endif
# 2. Set dt_runpath to origin to resolve dependencies
$(module)_ldflags += -Wl,--rpath,\$${ORIGIN} -Wl,--enable-new-dtags
include $(TEST_PATH)/Android.build.mk

View File

@ -14,9 +14,6 @@
# limitations under the License.
#
build_target := SHARED_LIBRARY
build_type := host
include $(TEST_PATH)/Android.build.mk
include $(LOCAL_PATH)/Android.build.testlib.host.mk
include $(LOCAL_PATH)/Android.build.testlib.target.mk

View File

@ -14,14 +14,6 @@
# limitations under the License.
#
build_target := SHARED_LIBRARY
build_type := target
# 1. Install test libraries to /data/nativetests../bionic-loader-test-libs/
# by default.
ifeq ($($(module)_relative_install_path),)
$(module)_install_to_out_data_dir := bionic-loader-test-libs
else
$(module)_install_to_out_data_dir := bionic-loader-test-libs/$($(module)_relative_install_path)
endif
# 2. Set dt_runpath to origin to resolve dependencies
$(module)_ldflags += -Wl,--rpath,\$${ORIGIN} -Wl,--enable-new-dtags
include $(TEST_PATH)/Android.build.mk
include $(LOCAL_PATH)/Android.build.testlib.internal.mk