"libbase",
],
host_ldlibs: ["-lrt"],
+ shared: {
+ enabled: false,
+ },
}
// -----------------------------------------------------------------------------
"-D_FORTIFY_SOURCE=1",
"-DTEST_NAME=Fortify1_gcc"
],
+ shared: {
+ enabled: false,
+ },
}
cc_test_library {
"-D_FORTIFY_SOURCE=2",
"-DTEST_NAME=Fortify2_gcc"
],
+ shared: {
+ enabled: false,
+ },
}
cc_test_library {
"-D_FORTIFY_SOURCE=1",
"-DTEST_NAME=Fortify1_clang"
],
+ shared: {
+ enabled: false,
+ },
}
cc_test_library {
"-D_FORTIFY_SOURCE=2",
"-DTEST_NAME=Fortify2_clang"
],
+ shared: {
+ enabled: false,
+ },
}
// -----------------------------------------------------------------------------
],
shared: {
enabled: false,
- }
+ },
}
// -----------------------------------------------------------------------------
enabled: true,
},
},
+ shared: {
+ enabled: false,
+ },
}
// -----------------------------------------------------------------------------
defaults: ["bionic_tests_defaults"],
srcs: ["gtest_main.cpp"],
cppflags: ["-DUSING_GTEST_OUTPUT_FORMAT"],
+ shared: {
+ enabled: false,
+ },
}
// -----------------------------------------------------------------------------
"libz",
"libutils",
],
+ ldflags: [
+ "-Wl,--rpath,\\$${ORIGIN}/../bionic-loader-test-libs",
+ "-Wl,--enable-new-dtags",
+ ],
},
}
}
include $(CLEAR_VARS)
LOCAL_MULTILIB := both
LOCAL_MODULE := $(bionic_tests_module)
-LOCAL_MODULE_PATH_32 := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS)/prebuilt-elf-files
-LOCAL_MODULE_PATH_64 := $(TARGET_OUT_DATA_NATIVE_TESTS)/prebuilt-elf-files
+LOCAL_MODULE_PATH_32 := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/prebuilt-elf-files
+LOCAL_MODULE_PATH_64 := $(TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/prebuilt-elf-files
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_SRC_FILES_arm := prebuilt-elf-files/arm/$(bionic_tests_module)
LOCAL_SRC_FILES_mips := prebuilt-elf-files/mips/$(bionic_tests_module)
LOCAL_SRC_FILES_mips64 := prebuilt-elf-files/mips64/$(bionic_tests_module)
include $(BUILD_PREBUILT)
+bionic-loader-test-libs-target: $(LOCAL_MODULE)
constexpr auto LIBSIZE = 1024 * 1024; // how much address space to reserve for it
#if defined(__LP64__)
-#define NATIVE_TESTS_PATH "/nativetest64"
+#define NATIVE_TESTS_PATH "/nativetest64/bionic-loader-test-libs"
#else
-#define NATIVE_TESTS_PATH "/nativetest"
+#define NATIVE_TESTS_PATH "/nativetest/bionic-loader-test-libs"
#endif
#define LIBPATH NATIVE_TESTS_PATH "/libdlext_test_fd/libdlext_test_fd.so"
}
TEST_F(DlExtTest, ExtInfoUseFdWithInvalidOffset) {
- const std::string lib_path = std::string(getenv("ANDROID_DATA")) + LIBZIPPATH;
// lib_path is relative when $ANDROID_DATA is relative
- char lib_realpath_buf[PATH_MAX];
- ASSERT_TRUE(realpath(lib_path.c_str(), lib_realpath_buf) == lib_realpath_buf);
- const std::string lib_realpath = std::string(lib_realpath_buf);
+ std::string lib_path;
+ ASSERT_TRUE(get_realpath(std::string(getenv("ANDROID_DATA")) + LIBZIPPATH, &lib_path)) << strerror(errno);
android_dlextinfo extinfo;
extinfo.flags = ANDROID_DLEXT_USE_LIBRARY_FD | ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET;
extinfo.library_fd_offset = 0;
handle_ = android_dlopen_ext("libname_ignored", RTLD_NOW, &extinfo);
ASSERT_TRUE(handle_ == nullptr);
- ASSERT_EQ("dlopen failed: \"" + lib_realpath + "\" has bad ELF magic", dlerror());
+ ASSERT_EQ("dlopen failed: \"" + lib_path + "\" has bad ELF magic", dlerror());
// Check if dlsym works after unsuccessful dlopen().
// Supply non-exiting one to make linker visit every soinfo.
}
TEST(dlfcn, dlopen_from_zip_absolute_path) {
- const std::string lib_path = std::string(getenv("ANDROID_DATA")) + LIBZIPPATH;
+ std::string lib_path;
+ ASSERT_TRUE(get_realpath(std::string(getenv("ANDROID_DATA")) + LIBZIPPATH, &lib_path)) << strerror(errno);
void* handle = dlopen((lib_path + "!/libdir/libatest_simple_zip.so").c_str(), RTLD_NOW);
ASSERT_TRUE(handle != nullptr) << dlerror();
}
TEST(dlfcn, dlopen_from_zip_with_dt_runpath) {
- const std::string lib_path = std::string(getenv("ANDROID_DATA")) + LIBZIPPATH_WITH_RUNPATH;
+ std::string data_path;
+ ASSERT_TRUE(get_realpath(std::string(getenv("ANDROID_DATA")), &data_path)) << strerror(errno);
+ const std::string lib_path = data_path + LIBZIPPATH_WITH_RUNPATH;
void* handle = dlopen((lib_path + "!/libdir/libtest_dt_runpath_d_zip.so").c_str(), RTLD_NOW);
}
TEST(dlfcn, dlopen_from_zip_ld_library_path) {
- const std::string lib_path = std::string(getenv("ANDROID_DATA")) + LIBZIPPATH + "!/libdir";
+ std::string data_path;
+ ASSERT_TRUE(get_realpath(std::string(getenv("ANDROID_DATA")), &data_path)) << strerror(errno);
+ const std::string lib_path = data_path + LIBZIPPATH + "!/libdir";
typedef void (*fn_t)(const char*);
fn_t android_update_LD_LIBRARY_PATH =
static const char* root_lib = "libnstest_root.so";
std::string path = std::string("libc.so:libc++.so:libdl.so:libm.so:") + g_public_lib;
- const std::string lib_path = std::string(getenv("ANDROID_DATA")) + NATIVE_TESTS_PATH;
+ std::string data_path;
+ ASSERT_TRUE(get_realpath(std::string(getenv("ANDROID_DATA")), &data_path)) << strerror(errno);
+ const std::string lib_path = data_path + NATIVE_TESTS_PATH;
const std::string lib_public_path = lib_path + "/public_namespace_libs/" + g_public_lib;
void* handle_public = dlopen(lib_public_path.c_str(), RTLD_NOW);
dlclose(handle);
}
+// Bionic specific tests
+#if defined(__BIONIC__)
+
+#if defined(__LP64__)
+#define NATIVE_TESTS_PATH "/nativetest64/bionic-loader-test-libs"
+#else
+#define NATIVE_TESTS_PATH "/nativetest/bionic-loader-test-libs"
+#endif
+
+#define PREBUILT_ELF_PATH NATIVE_TESTS_PATH "/prebuilt-elf-files"
+
TEST(dlfcn, dt_runpath_absolute_path) {
- void* handle = dlopen(PATH_TO_SYSTEM_LIB "libtest_dt_runpath_d.so", RTLD_NOW);
+ std::string libpath = std::string(getenv("ANDROID_DATA")) + NATIVE_TESTS_PATH + "/libtest_dt_runpath_d.so";
+ void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle != nullptr) << dlerror();
typedef void *(* dlopen_b_fn)();
dlclose(handle);
}
-// Bionic specific tests
-#if defined(__BIONIC__)
-
-#if defined(__LP64__)
-#define NATIVE_TESTS_PATH "/nativetest64"
-#else
-#define NATIVE_TESTS_PATH "/nativetest"
-#endif
-
-#define PREBUILT_ELF_PATH NATIVE_TESTS_PATH "/prebuilt-elf-files"
-
TEST(dlfcn, dlopen_invalid_rw_load_segment) {
- std::string libpath = std::string(getenv("ANDROID_DATA")) + PREBUILT_ELF_PATH + "/libtest_invalid-rw_load_segment.so";
+ std::string data_path;
+ ASSERT_TRUE(get_realpath(std::string(getenv("ANDROID_DATA")), &data_path)) << strerror(errno);
+ const std::string libpath = data_path + PREBUILT_ELF_PATH + "/libtest_invalid-rw_load_segment.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
std::string expected_dlerror = std::string("dlopen failed: \"") + libpath + "\": W + E load segments are not allowed";
}
TEST(dlfcn, dlopen_invalid_unaligned_shdr_offset) {
- std::string libpath = std::string(getenv("ANDROID_DATA")) + PREBUILT_ELF_PATH + "/libtest_invalid-unaligned_shdr_offset.so";
+ std::string data_path;
+ ASSERT_TRUE(get_realpath(std::string(getenv("ANDROID_DATA")), &data_path)) << strerror(errno);
+ const std::string libpath = data_path + PREBUILT_ELF_PATH + "/libtest_invalid-unaligned_shdr_offset.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
std::string expected_dlerror = std::string("dlopen failed: \"") + libpath + "\" has invalid shdr offset/size: ";
}
TEST(dlfcn, dlopen_invalid_zero_shentsize) {
- std::string libpath = std::string(getenv("ANDROID_DATA")) + PREBUILT_ELF_PATH + "/libtest_invalid-zero_shentsize.so";
+ std::string data_path;
+ ASSERT_TRUE(get_realpath(std::string(getenv("ANDROID_DATA")), &data_path)) << strerror(errno);
+ const std::string libpath = data_path + PREBUILT_ELF_PATH + "/libtest_invalid-zero_shentsize.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
std::string expected_dlerror = std::string("dlopen failed: \"") + libpath + "\" has unsupported e_shentsize: 0x0 (expected 0x";
}
TEST(dlfcn, dlopen_invalid_zero_shstrndx) {
- std::string libpath = std::string(getenv("ANDROID_DATA")) + PREBUILT_ELF_PATH + "/libtest_invalid-zero_shstrndx.so";
+ std::string data_path;
+ ASSERT_TRUE(get_realpath(std::string(getenv("ANDROID_DATA")), &data_path)) << strerror(errno);
+ const std::string libpath = data_path + PREBUILT_ELF_PATH + "/libtest_invalid-zero_shstrndx.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
std::string expected_dlerror = std::string("dlopen failed: \"") + libpath + "\" has invalid e_shstrndx";
}
TEST(dlfcn, dlopen_invalid_empty_shdr_table) {
- std::string libpath = std::string(getenv("ANDROID_DATA")) + PREBUILT_ELF_PATH + "/libtest_invalid-empty_shdr_table.so";
+ std::string data_path;
+ ASSERT_TRUE(get_realpath(std::string(getenv("ANDROID_DATA")), &data_path)) << strerror(errno);
+ std::string libpath = data_path + PREBUILT_ELF_PATH + "/libtest_invalid-empty_shdr_table.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
std::string expected_dlerror = std::string("dlopen failed: \"") + libpath + "\" has no section headers";
}
TEST(dlfcn, dlopen_invalid_zero_shdr_table_offset) {
- std::string libpath = std::string(getenv("ANDROID_DATA")) + PREBUILT_ELF_PATH + "/libtest_invalid-zero_shdr_table_offset.so";
+ std::string data_path;
+ ASSERT_TRUE(get_realpath(std::string(getenv("ANDROID_DATA")), &data_path)) << strerror(errno);
+ const std::string libpath = data_path + PREBUILT_ELF_PATH + "/libtest_invalid-zero_shdr_table_offset.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
std::string expected_dlerror = std::string("dlopen failed: \"") + libpath + "\" has invalid shdr offset/size: 0/";
}
TEST(dlfcn, dlopen_invalid_zero_shdr_table_content) {
- std::string libpath = std::string(getenv("ANDROID_DATA")) + PREBUILT_ELF_PATH + "/libtest_invalid-zero_shdr_table_content.so";
+ std::string data_path;
+ ASSERT_TRUE(get_realpath(std::string(getenv("ANDROID_DATA")), &data_path)) << strerror(errno);
+ const std::string libpath = data_path + PREBUILT_ELF_PATH + "/libtest_invalid-zero_shdr_table_content.so";
void* handle = dlopen(libpath.c_str(), RTLD_NOW);
ASSERT_TRUE(handle == nullptr);
std::string expected_dlerror = std::string("dlopen failed: \"") + libpath + "\" .dynamic section header was not found";
return g_executable_path;
}
+bool get_realpath(const std::string& path, std::string* real_path) {
+ char realpath_buf[PATH_MAX];
+ if (realpath(path.c_str(), realpath_buf) != realpath_buf) {
+ return false;
+ }
+
+ *real_path = realpath_buf;
+ return true;
+}
+
int get_argc() {
return g_argc;
}
cc_defaults {
name: "bionic_testlib_defaults",
host_supported: true,
+ ldflags: [
+ "-Wl,--rpath,\\$${ORIGIN}",
+ "-Wl,--enable-new-dtags",
+ ],
+ relative_install_path: "bionic-loader-test-libs",
+ gtest: false,
sanitize: {
never: true,
},
// -----------------------------------------------------------------------------
// Library to test gnu-styled hash
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libgnu-hash-table-library",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlext_test_library.cpp"],
// -----------------------------------------------------------------------------
// Library to test sysv-styled hash
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libsysv-hash-table-library",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlext_test_library.cpp"],
// -----------------------------------------------------------------------------
// Library used by dlext tests - without GNU RELRO program header
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libdlext_test_norelro",
+ defaults: ["bionic_testlib_defaults"],
srcs: ["dlext_test_library.cpp"],
ldflags: ["-Wl,-z,norelro"],
shared_libs = ["libtest_simple"],
// -----------------------------------------------------------------------------
// Library used by dlfcn tests
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_simple",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_testlib_simple.cpp"],
// -----------------------------------------------------------------------------
// Library used by dlfcn nodelete tests
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_nodelete_1",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_nodelete_1.cpp"],
// -----------------------------------------------------------------------------
// Library used by dlfcn nodelete tests
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_nodelete_2",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_nodelete_2.cpp"],
// -----------------------------------------------------------------------------
// Library used by dlfcn nodelete tests
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_nodelete_dt_flags_1",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_nodelete_dt_flags_1.cpp"],
//
// libtest_with_dependency_loop -> a -> b -> c -> a
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_with_dependency_loop",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_testlib_loopy_root.cpp"],
// -----------------------------------------------------------------------------
// libtest_with_dependency_loop_a.so
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_with_dependency_loop_a",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_testlib_loopy_a.cpp"],
//
// this is temporary placeholder - will be removed
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_with_dependency_loop_b_tmp",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_testlib_loopy_invalid.cpp"],
// -----------------------------------------------------------------------------
// libtest_with_dependency_loop_b.so
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_with_dependency_loop_b",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_testlib_loopy_b.cpp"],
// -----------------------------------------------------------------------------
// libtest_with_dependency_loop_c.so
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_with_dependency_loop_c",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_testlib_loopy_c.cpp"],
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_relo_check_dt_needed_order",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_testlib_relo_check_dt_needed_order.cpp"],
],
}
-cc_library {
+cc_test_library {
name: "libtest_relo_check_dt_needed_order_1",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_testlib_relo_check_dt_needed_order_1.cpp"],
}
-cc_library {
+cc_test_library {
name: "libtest_relo_check_dt_needed_order_2",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_testlib_relo_check_dt_needed_order_2.cpp"],
// -----------------------------------------------------------------------------
// Library used by ifunc tests
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_ifunc",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_testlib_ifunc.c"],
// Library used by atexit tests
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_atexit",
defaults: ["bionic_testlib_defaults"],
srcs: ["atexit_testlib.cpp"],
// This library is used by dl_load test to check symbol preempting
// by main executable
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libdl_preempt_test_1",
defaults: ["bionic_testlib_defaults"],
srcs: ["dl_preempt_library_1.cpp"],
// This library is used by dl_load test to check symbol preempting
// by libdl_preempt_test_1.so
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libdl_preempt_test_2",
defaults: ["bionic_testlib_defaults"],
srcs: ["dl_preempt_library_2.cpp"],
// -----------------------------------------------------------------------------
// Library with DF_1_GLOBAL
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libdl_test_df_1_global",
defaults: ["bionic_testlib_defaults"],
srcs: ["dl_df_1_global.cpp"],
// -----------------------------------------------------------------------------
// Library using symbol from libdl_test_df_1_global
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_dlsym_df_1_global",
defaults: ["bionic_testlib_defaults"],
srcs: ["dl_df_1_use_global.cpp"],
// -----------------------------------------------------------------------------
// Library with weak function
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_dlsym_weak_func",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlsym_weak_function.cpp"],
// -----------------------------------------------------------------------------
// Library to check RTLD_LOCAL with dlsym in 'this'
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_dlsym_from_this",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlsym_from_this_symbol.cpp"],
}
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_dlsym_from_this_child",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlsym_from_this_functions.cpp"],
}
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_dlsym_from_this_grandchild",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlsym_from_this_symbol2.cpp"],
// -----------------------------------------------------------------------------
// Empty library
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_empty",
defaults: ["bionic_testlib_defaults"],
srcs: ["empty.cpp"],
// -----------------------------------------------------------------------------
// Library with weak undefined function
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_dlopen_weak_undefined_func",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_weak_undefined.cpp"],
// -----------------------------------------------------------------------------
// Library with constructor that calls dlopen() b/7941716
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_dlopen_from_ctor",
defaults: ["bionic_testlib_defaults"],
srcs: ["dlopen_testlib_dlopen_from_ctor.cpp"],
// -----------------------------------------------------------------------------
// Library that depends on the library with constructor that calls dlopen() b/7941716
// -----------------------------------------------------------------------------
-cc_library {
+cc_test_library {
name: "libtest_dlopen_from_ctor_main",
defaults: ["bionic_testlib_defaults"],
srcs: ["empty.cpp"],
LOCAL_MODULE := libdlext_test_zip_zipaligned
LOCAL_MODULE_SUFFIX := .zip
LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/libdlext_test_zip
+LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/libdlext_test_zip
LOCAL_2ND_ARCH_VAR_PREFIX := $(bionic_2nd_arch_prefix)
include $(BUILD_SYSTEM)/base_rules.mk
LOCAL_MODULE := libdlext_test_runpath_zip_zipaligned
LOCAL_MODULE_SUFFIX := .zip
LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/libdlext_test_runpath_zip
+LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/libdlext_test_runpath_zip
LOCAL_2ND_ARCH_VAR_PREFIX := $(bionic_2nd_arch_prefix)
include $(BUILD_SYSTEM)/base_rules.mk
# -----------------------------------------------------------------------------
libnstest_root_src_files := namespaces_root.cpp
libnstest_root_shared_libraries := libnstest_public libnstest_private
-libnstest_root_install_to_out_data_dir := private_namespace_libs
+libnstest_root_relative_install_path := private_namespace_libs
module := libnstest_root
-include $(LOCAL_PATH)/Android.build.target.testlib.mk
+include $(LOCAL_PATH)/Android.build.testlib.target.mk
libnstest_public_src_files := namespaces_public.cpp
module := libnstest_public
-libnstest_public_install_to_out_data_dir := public_namespace_libs
-include $(LOCAL_PATH)/Android.build.target.testlib.mk
+libnstest_public_relative_install_path := public_namespace_libs
+include $(LOCAL_PATH)/Android.build.testlib.target.mk
libnstest_private_src_files := namespaces_private.cpp
-libnstest_private_install_to_out_data_dir := private_namespace_libs
+libnstest_private_relative_install_path := private_namespace_libs
module := libnstest_private
-include $(LOCAL_PATH)/Android.build.target.testlib.mk
+include $(LOCAL_PATH)/Android.build.testlib.target.mk
libnstest_dlopened_src_files := namespaces_dlopened.cpp
-libnstest_dlopened_install_to_out_data_dir := private_namespace_libs
+libnstest_dlopened_relative_install_path := private_namespace_libs
module := libnstest_dlopened
-include $(LOCAL_PATH)/Android.build.target.testlib.mk
+include $(LOCAL_PATH)/Android.build.testlib.target.mk
# -----------------------------------------------------------------------------
# This set of libraries is to test isolated namespaces
# -----------------------------------------------------------------------------
libnstest_root_not_isolated_src_files := namespaces_root.cpp
libnstest_root_not_isolated_shared_libraries := libnstest_public libnstest_private_external
-libnstest_root_not_isolated_install_to_out_data_dir := private_namespace_libs
+libnstest_root_not_isolated_relative_install_path := private_namespace_libs
libnstest_root_not_isolated_ldflags := -Wl,--rpath,\$$ORIGIN/../private_namespace_libs_external \
-Wl,--enable-new-dtags
module := libnstest_root_not_isolated
-include $(LOCAL_PATH)/Android.build.target.testlib.mk
+include $(LOCAL_PATH)/Android.build.testlib.target.mk
libnstest_private_external_src_files := namespaces_private.cpp
-libnstest_private_external_install_to_out_data_dir := private_namespace_libs_external
+libnstest_private_external_relative_install_path := private_namespace_libs_external
module := libnstest_private_external
-include $(LOCAL_PATH)/Android.build.target.testlib.mk
+include $(LOCAL_PATH)/Android.build.testlib.target.mk
build_target := SHARED_LIBRARY
build_type := host
include $(TEST_PATH)/Android.build.mk
-build_type := target
-include $(TEST_PATH)/Android.build.mk
+bionic-loader-test-libs-host: $(LOCAL_MODULE)
+
+include $(LOCAL_PATH)/Android.build.testlib.target.mk
--- /dev/null
+#
+# Copyright (C) 2014 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.
+#
+
+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
+
+bionic-loader-test-libs-target: $(LOCAL_MODULE)
+
$(LOCAL_PATH)/Android.build.linker_namespaces.mk \
$(LOCAL_PATH)/Android.build.pthread_atfork.mk \
$(LOCAL_PATH)/Android.build.testlib.mk \
+ $(LOCAL_PATH)/Android.build.testlib.target.mk \
$(LOCAL_PATH)/Android.build.versioned_lib.mk \
$(TEST_PATH)/Android.build.mk
# create symlink to libdlext_test.so for symlink test
# -----------------------------------------------------------------------------
# Use = instead of := to defer the evaluation of $@
-$(TARGET_OUT)/lib/libdlext_test.so: PRIVATE_POST_INSTALL_CMD = \
+$(TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/libdlext_test.so: PRIVATE_POST_INSTALL_CMD = \
$(hide) cd $(dir $@) && ln -sf $(notdir $@) libdlext_test_v2.so
ifneq ($(TARGET_2ND_ARCH),)
# link 64 bit .so
-$(TARGET_OUT)/lib64/libdlext_test.so: PRIVATE_POST_INSTALL_CMD = \
+$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/libdlext_test.so: PRIVATE_POST_INSTALL_CMD = \
$(hide) cd $(dir $@) && ln -sf $(notdir $@) libdlext_test_v2.so
endif
libdlext_test_fd_shared_libraries := libtest_simple
-libdlext_test_fd_install_to_out_data_dir := $(module)
+libdlext_test_fd_relative_install_path := $(module)
+
+libdlext_test_fd_ldflags := -Wl,--rpath,\$${ORIGIN}/.. -Wl,--enable-new-dtags
+
module_tag := optional
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.target.mk
# -----------------------------------------------------------------------------
libdlext_test_zip_shared_libraries := libatest_simple_zip
-libdlext_test_zip_install_to_out_data_dir := $(module)
+libdlext_test_zip_relative_install_path := $(module)
module_tag := optional
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.target.mk
module := libatest_simple_zip
libatest_simple_zip_src_files := \
dlopen_testlib_simple.cpp
-libatest_simple_zip_install_to_out_data_dir := $(module)
+libatest_simple_zip_relative_install_path := $(module)
module_tag := optional
-build_type := target
-build_target := SHARED_LIBRARY
-include $(TEST_PATH)/Android.build.mk
+include $(LOCAL_PATH)/Android.build.testlib.target.mk
# ----------------------------------------------------------------------------
# Library with soname which does not match filename
// The absolute path to the executable
const std::string& get_executable_path();
+// Get realpath
+bool get_realpath(const std::string& path, std::string* realpath);
+
// Access to argc/argv/envp
int get_argc();
char** get_argv();