Fix bionic-unit-tests in some non-standard builds

The binary bionic-unit-tests is linked with some shared libraries
and these libraries are found in ${ORIGIN}/../bionic-loader-test-libs
directory specified by runpath.  This makes it higly unlikely that
anyone would be run these files when ${ORIGIN}/../bionic-loader-test-libs
does not include proper files.

Bug: http://b/34681268
Test: run bionic-unit-tests --gtest_filter=dl*:Dl*

Change-Id: I52fc31339fdfa232c0fdafa218eadaeaf5551a8d
diff --git a/tests/gtest_globals.cpp b/tests/gtest_globals.cpp
index bb99dd6..75c08b1 100644
--- a/tests/gtest_globals.cpp
+++ b/tests/gtest_globals.cpp
@@ -22,27 +22,18 @@
 #include <string>
 
 static std::string init_testlib_root() {
+  // Calculate ANDROID_DATA assuming the binary is in "$ANDROID_DATA/somedir/binary-dir/binary"
+  std::string path = get_executable_path();
+
+  path = get_dirname(path.c_str());
+  path += "/..";
+
   std::string out_path;
-  const char* data_dir = getenv("ANDROID_DATA");
-  if (data_dir == nullptr) {
-    // Calculate ANDROID_DATA assuming the binary is in "$ANDROID_DATA/somedir/binary-dir/binary"
-    std::string path = get_executable_path();
-
-    path = get_dirname(path.c_str());
-    path += "/../..";
-
-    if (!get_realpath(path.c_str(), &out_path)) {
-      printf("Failed to get realpath for \"%s\"", path.c_str());
-      abort();
-    }
-  } else {
-    out_path = data_dir;
+  if (!get_realpath(path.c_str(), &out_path)) {
+    printf("Failed to get realpath for \"%s\"", path.c_str());
+    abort();
   }
 
-  out_path = out_path + "/nativetest";
-#if defined(__LP64__)
-  out_path += "64";
-#endif
   out_path += "/bionic-loader-test-libs";
 
   std::string real_path;