diff options
author | Ryan Prichard <rprichard@google.com> | 2021-06-04 17:27:39 -0700 |
---|---|---|
committer | Ryan Prichard <rprichard@google.com> | 2021-06-08 14:04:57 -0700 |
commit | 686a21937bb94883adca571b8bcce102a2de4ddc (patch) | |
tree | 9e7eaedceb7a81d2d4bb722660d06fda9707960c | |
parent | 7ed1fcf805331bd92f0c2d56786c4fee7844a197 (diff) | |
download | bionic-686a21937bb94883adca571b8bcce102a2de4ddc.tar.gz |
Use ro.build.type instead of ro.debuggable
The LD_CONFIG_FILE test needs to match how Bionic was compiled, and
Bionic only enables LD_CONFIG_FILE for debug builds (i.e. ro.build.type
is "user"). ro.debuggable can be forced on without recompiling Bionic.
Bug: http://b/140324381
Bug: http://b/189422994
Test: bionic unit tests
Change-Id: I139059a7f94d15a5447dab292927606a6bcc48ef
(cherry picked from commit 546723b2b804d8e12c2774c7338073184cf90075)
-rw-r--r-- | tests/dl_test.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/dl_test.cpp b/tests/dl_test.cpp index 6c9bf3fb5..01c2fe432 100644 --- a/tests/dl_test.cpp +++ b/tests/dl_test.cpp @@ -263,8 +263,11 @@ static void create_ld_config_file(const char* config_file) { #endif #if defined(__BIONIC__) -static bool is_debuggable_build() { - return android::base::GetBoolProperty("ro.debuggable", false); +// This test can't rely on ro.debuggable, because it might have been forced on +// in a user build ("Force Debuggable"). In that configuration, ro.debuggable is +// true, but Bionic's LD_CONFIG_FILE testing support is still disabled. +static bool is_user_build() { + return android::base::GetProperty("ro.build.type", "user") == std::string("user"); } #endif @@ -281,7 +284,7 @@ static bool is_debuggable_build() { TEST(dl, exec_with_ld_config_file) { #if defined(__BIONIC__) SKIP_WITH_HWASAN << "libclang_rt.hwasan is not found with custom ld config"; - if (!is_debuggable_build()) { + if (is_user_build()) { GTEST_SKIP() << "LD_CONFIG_FILE is not supported on user build"; } std::string helper = GetTestlibRoot() + @@ -318,7 +321,7 @@ TEST(dl, exec_with_ld_config_file) { TEST(dl, exec_with_ld_config_file_with_ld_preload) { #if defined(__BIONIC__) SKIP_WITH_HWASAN << "libclang_rt.hwasan is not found with custom ld config"; - if (!is_debuggable_build()) { + if (is_user_build()) { GTEST_SKIP() << "LD_CONFIG_FILE is not supported on user build"; } std::string helper = GetTestlibRoot() + @@ -355,8 +358,8 @@ TEST(dl, disable_ld_config_file) { // This test is only for CTS. GTEST_SKIP() << "test is not supported with root uid"; } - if (is_debuggable_build()) { - GTEST_SKIP() << "test is not supported on debuggable build"; + if (!is_user_build()) { + GTEST_SKIP() << "test requires user build"; } std::string error_message = std::string("CANNOT LINK EXECUTABLE ") + |