summaryrefslogtreecommitdiff
path: root/tests/dl_test.cpp
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-10-03 23:17:15 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-10-03 23:17:15 +0000
commitec6c3975ffd435af1a95d3d314e5f59e91ed2acb (patch)
tree49bc8590a6928047b99f9e2fc859a4fedb63e253 /tests/dl_test.cpp
parent48fbf91672d096bdec664374d16d65488b77251c (diff)
parent41704cdf615eab4318539da0f0c03f443d2d89c7 (diff)
Merge "Don't run exec_with_ld_config_file* tests on non-production devices"
Diffstat (limited to 'tests/dl_test.cpp')
-rw-r--r--tests/dl_test.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/tests/dl_test.cpp b/tests/dl_test.cpp
index ceb0b4d67..2133a2c11 100644
--- a/tests/dl_test.cpp
+++ b/tests/dl_test.cpp
@@ -180,12 +180,24 @@ static void create_ld_config_file(std::string& config_file) {
}
#endif
-#ifdef USE_LD_CONFIG_FILE
+#if defined(__BIONIC__)
+static bool is_user_build() {
+ std::string build_type = android::base::GetProperty("ro.build.type", "user");
+ if (build_type == "userdebug" || build_type == "eng") {
+ return false;
+ }
+ return true;
+}
+#endif
// _lib1.so and _lib2.so are now searchable by having another namespace 'ns2'
// whose search paths include the 'ns2/' subdir.
TEST(dl, exec_with_ld_config_file) {
#if defined(__BIONIC__)
+ if (is_user_build()) {
+ // LD_CONFIG_FILE is not supported on user build
+ return;
+ }
std::string helper = get_testlib_root() +
"/ld_config_test_helper/ld_config_test_helper";
std::string config_file = get_testlib_root() + "/ld.config.txt";
@@ -204,6 +216,10 @@ TEST(dl, exec_with_ld_config_file) {
// additional namespaces other than the default namespace.
TEST(dl, exec_with_ld_config_file_with_ld_preload) {
#if defined(__BIONIC__)
+ if (is_user_build()) {
+ // LD_CONFIG_FILE is not supported on user build
+ return;
+ }
std::string helper = get_testlib_root() +
"/ld_config_test_helper/ld_config_test_helper";
std::string config_file = get_testlib_root() + "/ld.config.txt";
@@ -218,8 +234,6 @@ TEST(dl, exec_with_ld_config_file_with_ld_preload) {
#endif
}
-#endif // USE_LD_CONFIG_FILE
-
// ensures that LD_CONFIG_FILE env var does not work for production builds.
// The test input is the same as exec_with_ld_config_file, but it must fail in
// this case.
@@ -230,8 +244,7 @@ TEST(dl, disable_ld_config_file) {
// This test is only for CTS.
return;
}
- std::string build_type = android::base::GetProperty("ro.build.type", "user");
- if (build_type == "userdebug" || build_type == "eng") {
+ if (!is_user_build()) {
// Skip the test for non production devices
return;
}