diff options
author | dimitry <dimitry@google.com> | 2018-05-09 14:37:47 +0200 |
---|---|---|
committer | dimitry <dimitry@google.com> | 2018-05-09 14:37:47 +0200 |
commit | 1280cf5fd8147f4c52a758bdc3fdfacff17b0552 (patch) | |
tree | 461cf34d6fd9862decae799633f0f43ab163e910 | |
parent | 775fb0962173f07aeb46c8ae764a35a85e00a3f0 (diff) | |
download | bionic-1280cf5fd8147f4c52a758bdc3fdfacff17b0552.tar.gz |
Unhardcode /system/lib
Default search path may be different for native bridged enviroments
Bug: http://b/73105445
Test: adb shell /data/nativetest/arm/bionic-unit-tests/bionic-unit-tests --gtest_filter=dl.exec_with_ld_config_file
Change-Id: I09d32dcb8a7a3f161ccc6d58c29252e79ea5fd3e
-rw-r--r-- | tests/dl_test.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/dl_test.cpp b/tests/dl_test.cpp index 38d778332..25341f42b 100644 --- a/tests/dl_test.cpp +++ b/tests/dl_test.cpp @@ -168,7 +168,11 @@ TEST(dl, exec_without_ld_config_file) { } #if defined(__BIONIC__) +extern "C" void android_get_LD_LIBRARY_PATH(char*, size_t); static void create_ld_config_file(const char* config_file) { + char default_search_paths[PATH_MAX]; + android_get_LD_LIBRARY_PATH(default_search_paths, sizeof(default_search_paths)); + std::ofstream fout(config_file, std::ios::out); fout << "dir.test = " << get_testlib_root() << "/ld_config_test_helper/" << std::endl << "[test]" << std::endl @@ -176,7 +180,7 @@ static void create_ld_config_file(const char* config_file) { << "namespace.default.search.paths = " << get_testlib_root() << std::endl << "namespace.default.links = ns2" << std::endl << "namespace.default.link.ns2.shared_libs = libc.so:libm.so:libdl.so:ld_config_test_helper_lib1.so" << std::endl - << "namespace.ns2.search.paths = /system/${LIB}:" << get_testlib_root() << "/ns2" << std::endl; + << "namespace.ns2.search.paths = " << default_search_paths << ":" << get_testlib_root() << "/ns2" << std::endl; fout.close(); } #endif |