Use ro.debuggable property instead of checking build type

Test: make
Change-Id: I094663c20721f345cd6684e06fcef38f300790be
This commit is contained in:
dimitry 2017-10-18 13:23:08 +02:00
parent a08f704e2a
commit 59d3062f51

View file

@ -181,12 +181,8 @@ static void create_ld_config_file(std::string& config_file) {
#endif #endif
#if defined(__BIONIC__) #if defined(__BIONIC__)
static bool is_user_build() { static bool is_debuggable_build() {
std::string build_type = android::base::GetProperty("ro.build.type", "user"); return android::base::GetBoolProperty("ro.debuggable", false);
if (build_type == "userdebug" || build_type == "eng") {
return false;
}
return true;
} }
#endif #endif
@ -194,7 +190,7 @@ static bool is_user_build() {
// whose search paths include the 'ns2/' subdir. // whose search paths include the 'ns2/' subdir.
TEST(dl, exec_with_ld_config_file) { TEST(dl, exec_with_ld_config_file) {
#if defined(__BIONIC__) #if defined(__BIONIC__)
if (is_user_build()) { if (!is_debuggable_build()) {
// LD_CONFIG_FILE is not supported on user build // LD_CONFIG_FILE is not supported on user build
return; return;
} }
@ -216,7 +212,7 @@ TEST(dl, exec_with_ld_config_file) {
// additional namespaces other than the default namespace. // additional namespaces other than the default namespace.
TEST(dl, exec_with_ld_config_file_with_ld_preload) { TEST(dl, exec_with_ld_config_file_with_ld_preload) {
#if defined(__BIONIC__) #if defined(__BIONIC__)
if (is_user_build()) { if (!is_debuggable_build()) {
// LD_CONFIG_FILE is not supported on user build // LD_CONFIG_FILE is not supported on user build
return; return;
} }
@ -244,7 +240,7 @@ TEST(dl, disable_ld_config_file) {
// This test is only for CTS. // This test is only for CTS.
return; return;
} }
if (!is_user_build()) { if (is_debuggable_build()) {
// Skip the test for non production devices // Skip the test for non production devices
return; return;
} }