dlfcn.dt_runpath* tests are amended to handle LIB

LIB is now expanded to either lib or lib64. Add a new lib
libtest_dt_runpath_y which is under lib or lib64 directory to the tests.

Test: run bionic-unit-tests

Change-Id: Ib051d8cae4d50b452759d594c87126b45bc9e959
This commit is contained in:
Jiyong Park 2019-01-20 01:41:42 +09:00
parent c77e201a3b
commit d7ca67859f
4 changed files with 70 additions and 10 deletions

View file

@ -526,6 +526,7 @@ cc_test {
"libtest_dt_runpath_b",
"libtest_dt_runpath_c",
"libtest_dt_runpath_x",
"libtest_dt_runpath_y",
"libatest_simple_zip",
"libcfi-test",
"libcfi-test-bad",

View file

@ -35,8 +35,20 @@ ifneq ($($(module)_install_to_native_tests_dir),)
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)
ifneq ($($(module)_install_to_native_tests_dir_32),)
tests_dir_32 := $($(module)_install_to_native_tests_dir_32)
else
tests_dir_32 := $($(module)_install_to_native_tests_dir)
endif
ifneq ($($(module)_install_to_native_tests_dir_64),)
tests_dir_64 := $($(module)_install_to_native_tests_dir_64)
else
tests_dir_64 := $($(module)_install_to_native_tests_dir)
endif
LOCAL_MODULE_PATH_32 := $($(TARGET_2ND_ARCH_VAR_PREFIX)$(native_tests_var))/$(tests_dir_32)
LOCAL_MODULE_PATH_64 := $($(native_tests_var))/$(tests_dir_64)
endif
endif

View file

@ -59,21 +59,38 @@ lib_a := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_a,,,$(
lib_b := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_b,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_b.so
lib_c := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_c,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_c.so
lib_x := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_x,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_x.so
lib_y := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_y,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_y.so
$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_D := $(lib_d)
$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_A := $(lib_a)
$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_B := $(lib_b)
$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_C := $(lib_c)
$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_X := $(lib_x)
$(LOCAL_BUILT_MODULE) : $(lib_d) $(lib_a) $(lib_b) $(lib_c) $(lib_x) $(BIONIC_TESTS_ZIPALIGN)
$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_Y := $(lib_y)
ifeq ($(TARGET_IS_64_BIT),true)
ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_OR_LIB64 := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),lib/$(TARGET_2ND_ARCH),lib64)
else
$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_OR_LIB64 := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),lib,lib64)
endif
else
ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_OR_LIB64 := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),lib/$(TARGET_2ND_ARCH),lib)
else
$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_OR_LIB64 := lib
endif
endif
$(LOCAL_BUILT_MODULE) : $(lib_d) $(lib_a) $(lib_b) $(lib_c) $(lib_x) $(lib_y) $(BIONIC_TESTS_ZIPALIGN)
@echo "Aligning zip: $@"
$(hide) rm -rf $@.unaligned $@ $(dir $@)/zipdir && mkdir -p $(dir $@)/zipdir/libdir && \
mkdir -p $(dir $@)/zipdir/libdir/dt_runpath_a && mkdir -p $(dir $@)/zipdir/libdir/dt_runpath_b_c_x
mkdir -p $(dir $@)/zipdir/libdir/dt_runpath_a && mkdir -p $(dir $@)/zipdir/libdir/dt_runpath_b_c_x && \
mkdir -p $(dir $@)/zipdir/libdir/dt_runpath_y/$(PRIVATE_LIB_OR_LIB64)
$(hide) cp $(PRIVATE_LIB_D) $(dir $@)/zipdir/libdir
$(hide) cp $(PRIVATE_LIB_A) $(dir $@)/zipdir/libdir/dt_runpath_a
$(hide) cp $(PRIVATE_LIB_B) $(dir $@)/zipdir/libdir/dt_runpath_b_c_x
$(hide) cp $(PRIVATE_LIB_C) $(dir $@)/zipdir/libdir/dt_runpath_b_c_x
$(hide) cp $(PRIVATE_LIB_X) $(dir $@)/zipdir/libdir/dt_runpath_b_c_x
$(hide) cp $(PRIVATE_LIB_Y) $(dir $@)/zipdir/libdir/dt_runpath_y/$(PRIVATE_LIB_OR_LIB64)
$(hide) touch $(dir $@)/zipdir/empty_file.txt
$(hide) (cd $(dir $@)/zipdir && zip -qrD0 ../$(notdir $@).unaligned .)
$(hide) $(BIONIC_TESTS_ZIPALIGN) 4096 $@.unaligned $@

View file

@ -21,11 +21,12 @@
#
# Dependencies
#
# libtest_dt_runpath_d.so runpath: ${ORIGIN}/dt_runpath_b_c_x
# libtest_dt_runpath_d.so runpath: ${ORIGIN}/dt_runpath_b_c_x, ${ORIGIN}/dt_runpath_y/${LIB}
# |-> dt_runpath_b_c_x/libtest_dt_runpath_b.so runpath: ${ORIGIN}/../dt_runpath_a
# | |-> dt_runpath_a/libtest_dt_runpath_a.so
# |-> dt_runpath_b_c_x/libtest_dt_runpath_c.so runpath: ${ORIGIN}/invalid_dt_runpath
# | |-> libtest_dt_runpath_a.so (soname)
# |-> dt_runpath_y/lib[64]/libtest_dt_runpath_y.so
#
# This one is used to test dlopen
# dt_runpath_b_c_x/libtest_dt_runpath_x.so
@ -61,12 +62,18 @@ libtest_dt_runpath_c_relative_path := dt_runpath_b_c_x
module := libtest_dt_runpath_c
include $(LOCAL_PATH)/Android.build.testlib.mk
# D depends on B and C with DT_RUNPATH.
# D depends on B, C, and Y with DT_RUNPATH.
libtest_dt_runpath_d_src_files := \
dlopen_b.cpp
libtest_dt_runpath_d_shared_libraries := libtest_dt_runpath_b libtest_dt_runpath_c
libtest_dt_runpath_d_ldflags := -Wl,--rpath,\$${ORIGIN}/dt_runpath_b_c_x -Wl,--enable-new-dtags
libtest_dt_runpath_d_shared_libraries := \
libtest_dt_runpath_b \
libtest_dt_runpath_c \
libtest_dt_runpath_y
libtest_dt_runpath_d_ldflags := \
-Wl,--rpath,\$${ORIGIN}/dt_runpath_b_c_x \
-Wl,--rpath,\$${ORIGIN}/dt_runpath_y/\$${LIB} \
-Wl,--enable-new-dtags
libtest_dt_runpath_d_ldlibs := -ldl
module := libtest_dt_runpath_d
include $(LOCAL_PATH)/Android.build.testlib.mk
@ -77,8 +84,14 @@ module := libtest_dt_runpath_d_zip
libtest_dt_runpath_d_zip_src_files := \
dlopen_b.cpp
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_shared_libraries := \
libtest_dt_runpath_b \
libtest_dt_runpath_c \
libtest_dt_runpath_y
libtest_dt_runpath_d_zip_ldflags := \
-Wl,--rpath,\$${ORIGIN}/dt_runpath_b_c_x \
-Wl,--rpath,\$${ORIGIN}/dt_runpath_y/\$${LIB} \
-Wl,--enable-new-dtags
libtest_dt_runpath_d_zip_ldlibs := -ldl
libtest_dt_runpath_d_zip_install_to_native_tests_dir := $(module)
@ -96,3 +109,20 @@ libtest_dt_runpath_x_relative_path := dt_runpath_b_c_x
module := libtest_dt_runpath_x
include $(LOCAL_PATH)/Android.build.testlib.mk
# A leaf library in lib or lib64 directory
libtest_dt_runpath_y_src_files := \
empty.cpp
ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
libtest_dt_runpath_y_install_to_native_tests_dir_32 := bionic-loader-test-libs/dt_runpath_y/lib/$(TARGET_2ND_ARCH)
else
libtest_dt_runpath_y_install_to_native_tests_dir_32 := bionic-loader-test-libs/dt_runpath_y/lib
endif
ifeq ($(TARGET_IS_64_BIT),true)
libtest_dt_runpath_y_install_to_native_tests_dir_64 := bionic-loader-test-libs/dt_runpath_y/lib64
else
libtest_dt_runpath_y_install_to_native_tests_dir_64 := bionic-loader-test-libs/dt_runpath_y/lib
endif
module := libtest_dt_runpath_y
include $(LOCAL_PATH)/Android.build.testlib.mk